Forum Replies Created

Viewing 15 posts - 151 through 165 (of 595 total)

  • RE: DATETIME datatype

    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,...
  • RE: DATETIME datatype

    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...

  • RE: convert datetime

    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' +...
  • RE: Doing Short Circuiting in WHERE clause

    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...

  • RE: Doing Short Circuiting in WHERE clause

    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...

  • RE: DATETIME datatype

    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...

  • RE: Count (*)

    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...

  • RE: Count (*)

    
    
    SELECT column, COUNT(*)
    FROM table1
    WHERE column > 5
    GROUP BY column
    HAVING COUNT(*) < 5

    I think this is what you meant...

  • RE: Updating 2 SQL Server databases at the same time

    You will have to build a distributed transaction. See Books Online for "BEGIN DISTRIBUTED TRANSACTION".

  • RE: asp to sql server - batch update

    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....

  • RE: Not so Random Cursor!

    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()))

    ...

  • RE: delta processing: alternative to cursor

    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
    ,...
  • RE: Storing arrays in SQL.

    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...

  • RE: Temporary Table

    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...

  • RE: Storing arrays in SQL.

    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...

Viewing 15 posts - 151 through 165 (of 595 total)