Viewing 15 posts - 586 through 600 (of 2,171 total)
Thanks.
Keep us informed about futher testing and progress.
December 16, 2008 at 3:11 am
Output from above suggestion when @SlotSize is 120 minutes is
fromTimetoTime123456
00:00:0002:00:00000000
02:00:0004:00:00000000
04:00:0006:00:00000000
06:00:0008:00:00000000
08:00:0010:00:00201000
12:00:0014:00:00200000
14:00:0016:00:00100000
16:00:0018:00:00110000
18:00:0020:00:00000000
20:00:0022:00:00000000
22:00:0024:00:00000000
December 16, 2008 at 1:20 am
This is how you should solve your problem. The suggested algorithm is very flexible and allows you to set any valid value for @SlotSize (1-1440).
DECLARE@Sample TABLE
(
empID INT,
fromTime DATETIME,
toTime DATETIME
)
INSERT@Sample
SELECT1, '2008-11-01...
December 16, 2008 at 1:19 am
Jeff Moden (12/15/2008)
Damned nice try, Peter... thought you had it, but not quite...
Thanks!
I didn't give it too much effort. Just enough to get OP a direction.
December 16, 2008 at 12:42 am
ALTER FUNCTION dbo.fnResolveFractionals
(
@data VARCHAR(20)
)
RETURNS FLOAT
AS
BEGIN
RETURNCASE
WHEN LEN(@data) - LEN(REPLACE(@data, ' ', '')) = 1 AND LEN(@data) - LEN(REPLACE(@data, '/', '')) = 1 THEN CAST(LEFT(@data, CHARINDEX(' ', @data) - 1) AS FLOAT)...
December 15, 2008 at 6:58 am
In my humble opinion, uses bit calculation in t-sql is the completely wrong way to go at all.
What is your objective? What kind of calculations do you do that makes...
December 15, 2008 at 6:45 am
If depends on what the trigger actually does.
May we see the code?
December 15, 2008 at 6:40 am
There is a workaround, or a quirk, and that is to have an auxiliary sequence table, and not use source table for sequencing.
See http://weblogs.sqlteam.com/peterl/archive/2008/11/28/An-alternative-to-IDENTITY-column.aspx
December 12, 2008 at 12:17 am
December 11, 2008 at 2:05 am
Haven't anyone noticed that column alias SOURCENAME has different values for the two UNIONed queries?
Change UNION to UNION ALL, because the two queries will never return same record values.
December 11, 2008 at 2:02 am
Thank you Jeff!
The use of master..spt_values or a TallyNumber table is ONLY for generating sample data.
The working piece of algorithm is the UPDATE part.
December 11, 2008 at 12:29 am
DECLARE@Sample TABLE
(
ID INT PRIMARY KEY CLUSTERED,
Number INT,
expAvg FLOAT
)
INSERT@Sample
(
ID,
Number
)
SELECT TOP 10Number,
ABS(CHECKSUM(NEWID())) % 50000
FROMmaster..spt_values
WHEREType = 'P'
ORDER BYNumber
DECLARE@expAvg FLOAT
SET@expAvg = 0
UPDATE@Sample
SET@expAvg = ExpAvg = 0.03E * Number + 0.97E * @expAvg
SELECT*
FROM@Sample
December 10, 2008 at 3:15 pm
PRINT statements does't trigger an error. They are just informational messages.
CREATE PROCEDURE dbo.pAddNewThemeSCheme
(
@themeID int,
@label varchar(50),
@isActive bit,
@folderName varchar(50)
)
AS
SET NOCOUNT ON
IF NOT EXISTS (SELECT * FROM dbo.Theme WHERE themeID = @themeID)
BEGIN
RAISERROR('You...
December 10, 2008 at 2:40 pm
Of course you can have OR and AND in the CASE contructor!
declare @integrity varchar(20)
set @integrity = 'all classified'
select*
frominfosys
wherecase
when @integrity = 'all classified' and integrity between 1 and 4 THEN...
December 10, 2008 at 2:34 pm
Viewing 15 posts - 586 through 600 (of 2,171 total)