Forum Replies Created

Viewing 15 posts - 841 through 855 (of 3,957 total)

  • RE: Clustered Index needed for Time lookup table?

    Row ordering is never guaranteed on retrieval unless you explicitly specify ORDER BY.

    It just so happens that the times are being retrieved in order because that's probably the order you...

  • RE: group by column as sub header

    oliver.morris (1/29/2014)


    Thanks Dwain,

    Will give this a try and try the unpivot alternative, looks good.

    Is performance better than unpivot?

    Cheers

    Oliver

    There's a performance comparison in the linked article, but the short answer is...

  • RE: Permutations (difficult one)

    oliveraustin (1/28/2014)


    Ah ha, thought how to reduce the problem size down to 12 groups 🙂

    Since the Roles with multiple groups consist of<=12 groups and the rest of the all I...

  • RE: Permutations (difficult one)

    Evil Kraig F (1/28/2014)


    dwain.c (1/28/2014)


    That user alone would generate POWER(2,32)-1 rows (working from memory here so check the article to be sure). That's a lot of rows.

    Amusingly:

    select power(2...

  • RE: how to create an alert when a job step fails but the job needs to continue

    Check the following article:

    Logging and Error Handling for SQL Stored Procedures [/url]

    In the TRY steps, where it captures the error information, you can add code to send your email alert.

    You...

  • RE: Optimize PIVOT table to include unlimited column and QTY of SKU - Help

    pietlinden (1/24/2014)


    You might want to read Dwain Camps' article on Creating Dynamic Crosstabs... that might give you some ideas.

    Nice thought, but I think you're referring to the articles by Jeff...

  • RE: group by column as sub header

    Check the first link in my signatures for another concept you can apply to this (the CROSS APPLY VALUES approach to UNPIVOT).

    SELECT citation

    FROM

    (

    SELECT b.citation, a.header, a.rn,...

  • RE: Permutations (difficult one)

    I would bet it's not memory that's the issue. It's row counts.

    Consider the case where you said you have one user in 32 groups. That user alone would...

  • RE: Concatentate DocumentData

    AndrewSQLDBA (1/27/2014)


    Thanks Dwain.C

    That did the trick for that. What are you talking about, "special characters"? You did not include the article. There are some rows that use RTF data, would...

  • RE: Permutations (difficult one)

    pietlinden (1/27/2014)


    ...

    and then I saw the odd requirement (show all permutations)

    ...

    Technically what the OP is looking for is combinations (not permutations).

  • RE: To check a given date fits between a range of dates

    If your fiscal year always starts on April Fool's Day, you don't even need the master table:

    WITH Detail_table (Cust_no, [Date]) AS

    (

    SELECT 'A',CAST('2011-07-15' AS DATETIME) -- 15/07/11

    UNION ALL SELECT 'B','2011-09-21' --21/09/11

    UNION...

  • RE: Get Distinct Value from each column in a Table

    Here's my interpretation of your requirement:

    WITH SampleData (C1, C2) AS

    (

    SELECT 'A', 'AA'

    UNION ALL SELECT 'A', 'BB'

    UNION ALL SELECT...

  • RE: Concatentate DocumentData

    Take a look at this SQL Spackle article by Wayne Sheffield: Creating a comma-separated list[/url]

    SELECT DocumentDataID=MIN(DocumentDataID), PersonDataID

    ,DocumentData=

    (

    ...

  • RE: Permutations (difficult one)

    Take a look at this article:

    Generating n-Tuples with SQL[/url]

    Then look into the discussion thread for a slight performance improvement on the approach:

    http://www.sqlservercentral.com/Forums/Topic1301485-3122-5.aspx

    Coding up the improved approach with your sample data...

  • RE: In a Trace, is CPU = elapsed Time?

    Lowell,

    I'm sure you already know this but there are times that CPU can be quite a lot more than elapsed time, specifically when SQL parallelizes a query. That doesn't...

Viewing 15 posts - 841 through 855 (of 3,957 total)