Viewing 15 posts - 331 through 345 (of 355 total)
I've noticed that if you run this query
SELECT lastwaittype, LEN(lastwaittype) FROM master.dbo.sysprocesses
the number of characters returned by the second column is one more than you would expect. This final character...
February 4, 2009 at 6:39 am
A calendar table may well be the way to go here, but you will still need a method of calculating dates from week numbers in order to populate the calendar...
February 2, 2009 at 4:35 pm
If the TOP 1 and ORDER BY clauses were removed from my query and the >= 60 condition changed to > 60, it would be functionaly equivalent to your query....
January 30, 2009 at 10:41 am
The following should work on SQL 2000. It does use a triangular join within the derived table so there may be performance issues if the appts table has a large...
January 30, 2009 at 9:57 am
If the last event in the ticket_history table for a particular RNID records when the ticket is closed (RouteQ = 'CLOSED') and that is an end state for the ticket...
January 30, 2009 at 3:16 am
Try this query, which uses the ROW_NUMBER() function to sequentially number rows belonging to the same ticket (RNID) ordered by the time_stamp column. This table expression is then joined with...
January 29, 2009 at 5:01 pm
The following query returns all the clients who visited in 2008 and the year that the client previously visited or NULL if their first visit was in 2008). If I...
January 29, 2009 at 4:12 pm
Are appointments available 24 hours a day, 7 days a week?
If not, you will need to take account of the start and end of appointment availability on each day.
Also, if...
January 29, 2009 at 2:45 pm
Lookup ROW_NUMBER in SQL Server 2005 Books Online
January 9, 2009 at 8:13 am
Agree with you Dugi.
However, here is an improved version of the hex2int function that, from my testing, is almost twice as fast as yours. I think the main reasons for...
January 9, 2009 at 3:55 am
If [font="Courier New"]CAST(0x1604 AS int)[/font] returns what you want, this dynamic SQL will also return what you want.
I'm not that comfortable about the use of dynamic SQL here but the...
January 8, 2009 at 9:24 am
Apologies for my stupid mistake in the expression for Saturdays and Sundays.
The following is a corrected version. Note that [font="Courier New"]@days/5[/font] is replaced by [font="Courier New"](@days-1)/5[/font] in the expression for...
January 2, 2009 at 4:40 am
Here's a method of calculating the Nth working day in the future without using a CTE or tally table.
DECLARE @days int
SELECT @days = 10
DECLARE @inputDate datetime
SELECT @inputDate = '2008-12-23'
DECLARE @weekDay...
December 23, 2008 at 5:24 pm
The following expression that uses integer division:
DATEDIFF(day, apptDateTime, @dt) / recurDays
will increment by one on the day of each recurring appointment (where @dt is a local...
November 30, 2008 at 6:28 pm
Viewing 15 posts - 331 through 345 (of 355 total)