Viewing 15 posts - 136 through 150 (of 356 total)
There are many ways to set up a permanent Tally or Numbers table.
Here's one way that inserts all the integers from 0 to 9999.
If you wish to use a permanent...
April 20, 2009 at 8:40 am
To ensure that everyone can understand your requirements properly, can you also show your expected results when run against the test data you have supplied.
Also, how do you want to...
April 17, 2009 at 7:22 am
I'm sitting here trying to get my head around this, and I don't understand what the benefit of having a nonclustered PK would be. Is it only to enforce the...
April 17, 2009 at 3:03 am
Greg,
I set up some test data with 1000000 rows - 1000 rows for each of 1000 distinct values of Company column and investigated the effect of the following 3 indexing...
April 16, 2009 at 12:30 pm
Greg,
No offense taken. I've also had a few performance issues with correlated subqueries in the past. I was intimating this by this statement in a previous post:
If you have a...
April 16, 2009 at 10:35 am
Christopher Stobbs (4/15/2009)
I normally always use this format 'YYYY-MM-DD'
Unfortunately, the 'YYYY-MM-DD' format is not interpreted 100% consistently either though the ISO8601 datetime format 'YYYY-MM-DDTHH:MM:SS' is. For example, you can set...
April 16, 2009 at 7:42 am
Todd Young (4/16/2009)
I couldn't get the last sample to work but the one you last
posted works great. I'll pop that into my sproc today.
I tossed a...
April 16, 2009 at 7:34 am
tony (4/15/2009)
Silly me for not realising that I had to use American Date Format when all the entries are in a UK format.....
Adding to that, would it...
April 16, 2009 at 6:11 am
Wow, a WHILE loop just to convert a decimal fraction to a string representation of hours and minutes.
I have 2 comments:
1) Formatting should be done on the front end rather...
April 16, 2009 at 4:05 am
kokkula (4/16/2009)
Try this
CREATE TABLE #TestData (
Id int IDENTITY(1, 1) PRIMARY KEY,
StartDate datetime NOT NULL,
EndDate datetime NOT NULL,
StartTime datetime NOT NULL,
EndTime datetime NOT NULL
)
INSERT INTO #TestData (StartDate, EndDate, StartTime, EndTime)
SELECT...
April 16, 2009 at 3:25 am
New Commer (4/15/2009)
i am bit confused, with declaration of
DECLARE @StartTime datetime
DECLARE @EndTime datetime
SELECT @StartTime = '10:00', @EndTime = '14:30'
I am unable to modify without this declaration. the values...
April 16, 2009 at 2:47 am
Todd,
Did you try my correlated subquery solution? I believe it gives the results you require. If you have a large number of rows in your table and performance is an...
April 15, 2009 at 4:27 pm
I've tried to simplify the situation to see more clearly what is going on.
CREATE TABLE #MSFO (StorageFee numeric(11, 2))
GO
INSERT INTO #MSFO VALUES(1.0)
GO
CREATE TABLE #FS (StorageMonthFee numeric(11, 2))
GO
INSERT...
April 15, 2009 at 3:30 pm
This query appears to reproduce your expected results.
It uses a Tally / Numbers table with name Tally that includes the value 0 (zero).
There is a pre-query to retrieve the...
April 15, 2009 at 10:37 am
If you're sure you don't need to consider holidays and weekends then the following will give the duration in hours, only counting the time interval (@StartTime, @EndTime) on each day.
/*...
April 15, 2009 at 5:28 am
Viewing 15 posts - 136 through 150 (of 356 total)