Viewing 15 posts - 1,306 through 1,320 (of 1,496 total)
If you only have two dates per month, something like the following should work:
SELECT T1.[Date]
,T1.Value - T2.Value AS Value
FROM YourTable T1
JOIN YourTable T2
ON T2.[Date] < T1.[Date]
AND YEAR(T1.[Date]) = YEAR(T2.[Date])
AND MONTH(T1.[Date])...
February 13, 2007 at 6:19 am
The lack of test data and results, along with the mix of old and new style join syntax, makes it difficult to guess what is going on here. I suspect...
February 12, 2007 at 10:39 am
SELECT *
FROM YourTable
ORDER BY
CASE Code
WHEN 1 THEN 'ZZZZZ' -- larger than MAX(ACCT)
ELSE Acct
END
,Amount DESC
February 10, 2007 at 7:09 am
>> what sort of perf improvement do you expect from this change?
One thing I have noticed is that, if a SQL collation sequence is used, comparison operations, especially LIKEs, are...
February 9, 2007 at 11:20 am
How about:
SELECT *
FROM YourTable
ORDER BY
CASE Code
WHEN 1 THEN 10000 -- larger than MAX(ACCT)
ELSE Acct
END
,Amount DESC
February 9, 2007 at 10:58 am
How about:
SELECT [ID]
,COUNT(CASE WHEN Value BETWEEN 0 AND 9 THEN 1 END) AS [0_9]
,COUNT(CASE
February 9, 2007 at 10:21 am
Maybe something like the following will work:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("""c:\program files\internet explorer\iexplore.exe"" http://www.yahoo.com")
February 9, 2007 at 8:20 am
Sorry if I seemed a little hard, but I have seen code like this cause too many problems.
On the question of the results, it is difficult for anyone to comment...
February 9, 2007 at 5:54 am
This is NOT the best approach to take for this type of problem. It is best to use a set based approach with the data either being cleansed first or...
February 8, 2007 at 11:06 am
If possible, change the dates and times to use datetime.
Also, how are you going to define a month? For days, hours and minutes the following should work:
SELECT D.MiDiff/1440 AS...
February 8, 2007 at 9:18 am
Try casting the column to varchar(n) and then back to nvarchar(n) and seeing if it is the same.
SELECT YourNVarCharColumn
FROM YourTable
WHERE YourNVarCharColumn <>
CAST(CAST(YourNVarCharColumn as varchar(<collength>
February 8, 2007 at 4:48 am
Your example output does not seem to make much sense. You may want something along the lines of:
-- *** Start of test data ***
DECLARE @t TABLE
(
UserID int NOT NULL PRIMARY...
February 6, 2007 at 10:16 am
Is this what you want?
WHERE 1 =
CASE
WHEN NULLIF(NEWREQDATE, '00000000') IS NULL AND NULLIF(ORIGREQDATE, '00000000') IS NULL
THEN 0
WHEN NULLIF(NEWREQDATE, '00000000') IS NULL
AND DATEDIFF(d, CAST(ORIGREQDATE AS datetime), GETDATE()) > 1
THEN 1
WHEN NULLIF(NEWREQDATE,...
February 6, 2007 at 9:17 am
Your second SP still uses a pseudo cursor.
You should really look at writing set based code. To do this one needs to know the DDL (CREATE TABLE with PKs and...
February 6, 2007 at 3:40 am
Something else you could try is explicitly specifying the type of join.
When there are more than 3 or 4 tables in a query I have noticed that the optimizer works...
February 5, 2007 at 9:56 am
Viewing 15 posts - 1,306 through 1,320 (of 1,496 total)