Viewing 15 posts - 151 through 165 (of 595 total)
I'm an idiot. Alias the SELECT into the ORDER BY:
SELECT DATEADD(day, 0 , DATEDIFF(day, 0, creationdate)) as "Date", COUNT(*)
FROM tblUser
GROUP BY DATEADD(day, 0 , DATEDIFF(day,...
July 29, 2003 at 3:03 pm
Actually, I made the mistake, didn't I...
I was trying to illuminate the return types of the two functions and messed it all up...
If you do a GROUP BY, you need...
July 29, 2003 at 2:53 pm
Fun one.
DECLARE @date DATETIME
SET @date = '7/29/2003 8:02:22 AM'
--
SELECT CAST(CONVERT(CHAR(4), YEAR(@date)) +
RIGHT('0' + CONVERT(VARCHAR, MONTH(@date)), 2) +
RIGHT('0' + CONVERT(VARCHAR, DAY(@date)), 2) +
RIGHT('0' +...
July 29, 2003 at 2:26 pm
Scott,
Agree with all of your points. I prefer the stored procedure groups because it mitigates the negative affects of the stored procedure recompilations and the optimizer's index...
July 29, 2003 at 2:14 pm
One possibility is using stored procedure groups. I tend to like this choice because it offers a clean approach, with the advantage of stored procedures over dynamic sql, and...
July 29, 2003 at 1:28 pm
Don't do CONVERT() to a character type. It does an extra lookup to syslanguages to find the date format localization string. If you need to group by the...
July 29, 2003 at 12:30 pm
quote:
The way I prefer for this is to use a CASE statement, e.g.:SELECT Sum(Case When Column > 5 Then 1 Else 0...
July 29, 2003 at 12:24 pm
SELECT column, COUNT(*)
FROM table1
WHERE column > 5
GROUP BY column
HAVING COUNT(*) < 5
I think this is what you meant...
July 29, 2003 at 11:48 am
You will have to build a distributed transaction. See Books Online for "BEGIN DISTRIBUTED TRANSACTION".
July 29, 2003 at 11:46 am
Check that your Recordset supports the MoveFirst after the MoveNext method. I think that when you have CursorType = adOpenStatic or adOpenForwardOnly or adOpenReadOnly that you can't do this....
July 29, 2003 at 11:26 am
I'm really at a loss as to what exactly is going on in this script, but to get a randow ordering, just do ORDER BY NEWID(), not ORDER BY RAND(CHECKSUM(NEWID()))
...
July 29, 2003 at 11:18 am
gee I love killing cursors.
Suggestion: use the modern JOIN syntax for readability.
UPDATE o
SET
o.data1 = t.data1
, o.data2 = t.data2
, o.data3 = t.data3
, o.modify_date = @processing_date
,...
July 29, 2003 at 8:16 am
You can use a C XML Parser to convert the array to XML, but I don't see any value in storing the XML in SQL Server. You'll just add...
July 29, 2003 at 7:58 am
Why is the stored procedure being executed AFTER the session ends and not BEFORE? Remember, ## temporary tables mean that all users (# means only creating user) can see...
July 29, 2003 at 7:45 am
One more point, though. If you have the need to do searching on your database for any of these "array fields", your task just got incredibly difficult...may be something...
July 29, 2003 at 7:40 am
Viewing 15 posts - 151 through 165 (of 595 total)