Forum Replies Created

Viewing 15 posts - 1,351 through 1,365 (of 2,007 total)

  • RE: Fetching the Months in the given Date Range

    Usman Butt (11/17/2011)


    Following the footsteps of Mr. Jeff Moden, I believe this would be good enough

    DECLARE @StartDate DATETIME, @EndDate DATETIME, @MonthDiff INT

    SELECT @StartDate = '20091001', @EndDate =...

  • RE: Fetching the Months in the given Date Range

    Use a calendar table. I've done one on the fly here, for performance you'd be better off with a real table.

    DECLARE @FromDate DATETIME = '2011-08-10',

    @ToDate DATETIME = '2011-10-31'

    ;WITH t1...

  • RE: Searching smallest unused number

    TheSQLGuru (11/16/2011)


    Can someone please do a test where there are 1M rows (or 10M or more) and the MIN missing value is one from the highest number in the range...

  • RE: Cursor Variable in EXEC Statement

    Cursors are bad, blah blah etc etc.

    Now that's over with, can you just build the string dynamically? Like this -

    FETCH FIRST FROM SuffixesCursor INTO @WhichSuffix

    WHILE @@Fetch_Status = 0

    BEGIN

    EXEC ('Update...

  • RE: Concatenate All Duplicate Values

    SELECT SetID, SubSetID, STUFF((SELECT ' ' + TextMessage

    ...

  • RE: Searching smallest unused number

    47 minutes 31 seconds later. . . šŸ™‚

    ========== Ensure Table is ready ==========

    ================================================================================

    ========== Insert 500,000,000(!!) rows ==========

    ================================================================================

    ========== Add Index ==========

    ================================================================================

    ========== Delete 1 ID - 485,001,270 ==========

    ================================================================================

    ========== Queries!! ==========

    ================================================================================

    ========== BASELINE ==========

    Table...

  • RE: Searching smallest unused number

    TheSQLGuru (11/16/2011)


    Can someone please do a test where there are 1M rows (or 10M or more) and the MIN missing value is one from the highest number in the range...

  • RE: Can't figure out why the following T-SQL script doesn't work...

    Donald Bouchard (11/16/2011)


    I’m under a big deadline for a customer, up most of the night, and I have a T-SQL script that aggregates the departments (from 0 to 49) a...

  • RE: Searching smallest unused number

    rahu21 (11/16/2011)


    Conclusion:

    Celko's solutions both are beyond all affairs, not only presenting wrong results, but also excruciatingly slow.

    #testEnvironment without Index: Tally beats my RowNumber

    #testEnvironment with Index: my RowNumber beats Tally

    Never give...

  • RE: Searching smallest unused number

    CELKO (11/15/2011)


    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Please learn to follow...

  • RE: Combine multiple rows into one column

    Jako de Wet (11/15/2011)


    Hi, Im pretty sure my header doesn't explain what I need šŸ™‚

    I have a xls sheet with values like this:

    9780431016191 DHodge

    9780431016771...

  • RE: Why is "Select *" bad in any SQL code?

    SanDroid (11/14/2011)


    Ninja's_RGR'us (11/14/2011)


    You mean aside from ddl change, performance, network overuse, column order change, performance, indexes being useless, not seing the list of columns when working on the code?

    so aside...

  • RE: retrieve the Name Of XML elements in a table

    Mark-101232 (11/14/2011)


    What XML are you trying to generate?

    Let me start again, because I'm sure that I'm attempting to over-complicate this with my lack of XML knowledge.

    Take this XML: -

    <Message>

    ...

  • RE: retrieve the Name Of XML elements in a table

    Mark-101232 (10/5/2011)


    See if this helps

    DECLARE @x XML

    SET @x='<MessageDelivery version="B000">

    <ReturnMessage id="3652789340">

    <AdC ocean="PACCGL">4815044</AdC>

    <MessageStatus code="100" time="2011-09-25 13:43:22">status ok</MessageStatus>

    <MessageData>700A20000018C0375494400000</MessageData>

    <Flags les="0" app="0" read="1" />

    </ReturnMessage>

    </MessageDelivery>

    '

    SELECT x.r.value('local-name(.)','VARCHAR(20)') AS Element,

    x.r.value('./text()[1]','VARCHAR(20)')...

  • RE: ISERROR Function

    carl.meads (11/14/2011)


    I have the following

    SELECT #callhandling2.client

    ,#callhandling2.daycat+' '+#callhandling2.timecat as [Category]

    ,Sum(#callhandling2.calls) as [Total Calls]

    ,[Calls Per 30 Mins] = Case

    When #callhandling2.daycat+' '+#callhandling2.timecat='Weekend 20:00-08:00' then if(iserror(Sum(#callhandling2.calls)/2208.0)),0,Sum(#callhandling2.calls)/2208.0

    When #callhandling2.daycat+' '+#callhandling2.timecat='Weekend 08:00-20:00' then Sum(#callhandling2.calls)/2208.0

    When #callhandling2.daycat+' '+#callhandling2.timecat='Weekday...

Viewing 15 posts - 1,351 through 1,365 (of 2,007 total)