Forum Replies Created

Viewing 15 posts - 3,811 through 3,825 (of 4,085 total)

  • RE: select a record based on a time range

    GilaMonster (10/29/2010)


    DECLARE @date1 DATETIME

    DECLARE @date2 DATETIME

    SET @date1 = DATEADD(mi, 120, DATEADD(dd,0,DATEDIFF(dd,0,GETDATE())-1)) -- yesterday at 2:00 am

    SET @date2 = DATEADD(mi,60,@date1)

    I'm curious about why you used minutes rather than hours for the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: using group by and count together.

    BenWard (10/28/2010)


    thats brilliant thanks.

    I'm surprised there isnt an alternative version of count in sql server that returns the number of rows like a numrows() function or whatever.

    Thanks

    You mean like Count(DISTINCT...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How does my concatenation UDF work?

    It uses the "quirky update". Jeff Moden wrote an article about the quirky update.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Really Simple - "Join" clarification

    My issue with defining it as multiple tables is that you lose the fact that the order is important when you start introducing outer joins. Consider the following example:

    WITH...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Really Simple - "Join" clarification

    Actually, this is like Wave/Particle duality. In some situations, it helps to think of the joins working on multiple tables, but in other situations it helps to think of...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: EXCEPT usage

    Craig Farrell (10/25/2010)


    Okay, the error message is simple enough, but I thought the point of EXCEPT was to reword the anti semi-join operation?

    The purpose of EXCEPT is to handle set...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Dynamically generate node names

    You may also need to use dynamic SQL. It's really difficult to tell without DDL, sample data, and expected results to work with.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Dynamically generate node names

    Depending on the complexity of your query, you could try FOR XML AUTO, ELEMENTS or FOR XML PATH('some value') instead of XML EXPLICIT.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Converting Varchar colum to Money in SQlserver2005

    Your data is missing the decimal point whose sole purpose is to indicate which part is the integer portion and which part is the decimal portion. By convention, the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Dynamically generate node names

    This sounds suspiciously like a homework assignment. The answer to this question is easily found with a little research. The fact that you didn't find it suggests that...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: using Partition to creat a matrix. IDs not going into column 1

    Your row number is only partitioned by the Systalk_ID, but the grouping in the outer query is based on Systalk_ID, Attendance_Type, and SC_Attendance_ID. You want these to match.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Bundle/Group data elements linked in M-M table

    This should get you close to what you are looking for. Essentially it takes the intersection (A) of two sets (B) and (C) and adds the values to the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Convert Varchar to Datetime

    Iulian -207023 (10/21/2010)


    What about storing data as int like this yyyymmdd? (year*10000 + month*100 + day)

    There is a perfectly good datatype that is optimized for working with datetime data. ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Debugging Stored Procedure with looping cursor

    From what I understand, there is some overhead for every transaction. With a set-based query, this overhead is performed once; with a cursor, this overhead is performed for every...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help with TSQL Code

    I think I found the problem. Your original query was only grouping on the Customer Number, but you want to group on the Order Number as well. Otherwise...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,811 through 3,825 (of 4,085 total)