Forum Replies Created

Viewing 15 posts - 241 through 255 (of 428 total)

  • RE: Traversal in Columns

    See, that is why we ask you to provide us with a: a script creating the table and some sample data plus b: the expected output, so we know what...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: Traversal in Columns

    Can you give the solution here so that we may all learn from it?



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: Traversal in Columns

    An example and some test data would have been helpful here. But I think what you are looking for is a combination of a cross apply and a union all,...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: How to get output in following formats

    Your image link is broken so you will probably not get any correct answers. But don't mind fixing that. Instead, please click 'Posting Data Etiquette' in my footer text and...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: Script Help Please!

    Sorry, double error: posting the wrong link to the wrong person. Thanks for posting the correct link.



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: Script Help Please!

    HowardW (9/27/2011) They're different as OR's are evaluated last, so you're effectively saying all of the AND conditions are true or the OR condition

    Please read this page on Operator Precedence...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: grouping issue (I think?)

    Can you please add the DDL (= create table statement) too? So we can see the proper types, keys, foreign keys, indexes and load the data into it?

    Have a...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: grouping issue (I think?)

    Ok, first some remarks on that code (I'm trying to be constructive here, not listing this to put you down):

    - numeric constants are not enclosed in quotes (''), i.e. '8'...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: grouping issue (I think?)

    You'll probably need a better key than 'month_name' to group by (maybe include a year?), but this does what you asked for:

    select

    (

    ...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: error handling

    Sudhir Dwivedi (9/26/2011)


    For continuously calling usp_exampleproc until an error occurs you could of course use a while loop:

    Why would one like to do so?? I can't understand.:unsure:

    OP has to answer...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: error handling

    For continuously calling usp_exampleproc until an error occurs you could of course use a while loop:

    DECLARE @result INT = 0;

    WHILE @result...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: error handling

    Or, by changing the order a little bit, you can make the outer catch block catch first procedure's errors, while the 2nd procedure's errors are caught by the inner catch....



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: error handling

    is this inside a stored procedure? If it is, you can use a return statement within the catch block to return to the caller without executing the remaining code.

    CREATE PROCEDURE...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: SQL 2008 - T-SQL query assistance

    Jeff Moden (9/25/2011)


    Heh... that's a hell of a change from the first-blush example. 😀

    Actually, I have to admit that I'm not the Topic Starter on this one. I have -not...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • RE: SQL 2008 - T-SQL query assistance

    The "process" is to analyze the set of expressions and generate static code from it. The expressions are the definitions for an engine processing data changes in near-real-time (using SQL...



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

Viewing 15 posts - 241 through 255 (of 428 total)