Forum Replies Created

Viewing 15 posts - 301 through 315 (of 428 total)

  • RE: please interpret sql clause

    Thanks for that addition, you are right, line 3 needs some more clarification. However, the both statements are not equivalent. I said null was assigned, which is indeed not true:...



    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: Regular Expression Replace using sql server function

    declare @tbl table (

    txt varchar(max) not null

    );

    insert @tbl(txt)

    select 'ABC EN 709+A1'

    union all select 'ABC-EN 1/A1'

    union all select 'ABC 104233/1M'

    union all select 'ABC-EN ISO 50065-4-7 CORR'

    union all 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: please interpret sql clause

    🙂 no problemo.

    I'll skip 1 & 2, these are clear, aren't they?

    Line 3:

    SELECT @Identity = ISNULL(MAX(ApprovalModelId),1)

    FROM mgo.ApprovalModel

    WHERE ApprovalModelId < @IdentityStart

    Assigns into @Identity the highest value from all values...



    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: CONTEXT_INFO() and the SQL Calling Stack

    Nicely done! I hadn't seen @@procid before and I see, next to this one some great usages for it. So thanks a lot for the pointer.

    There is a potential caveat...



    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 add intermediate columns in PIVOT tabe????

    Have a look at Jeff Moden's articles on cross-tab[/url]. These are a (better) alternative to the use of the pivot command. Among other things, cross-tab allows for adding additional columns...



    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: Returning Wrong Decimal Places

    Did you also try Ken Lee's last suggestion?

    Ken Lee-263418 (8/28/2011)


    ... Verify what you are getting in the SQL "string" if you use varchar(20).

    And if so, what was the outcome?



    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: please interpret sql clause

    My guess would be the original author is trying to avoid creating gaps in the assigned id range. An identity value is incremented even if an insert that was attempted,...



    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: Text to Columns in SQL

    :-D, still there is a reason for them being in this example: I generate a lot of my code, and leading comma's happen to be a lot easier to generate...



    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: UPDATE Way Too Slow

    Have a look at the replications' retention cleanup. Can it be your server still holds all changes since "the beginning of times"?



    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: Audit Trail / Logging Specific Changes on a Column by Column Basis

    If you're using stored procedures to make the changes and you plan to do the auditing from in there too, you may want to read up on the output clause....



    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: please advise on temp table solution to automate migration scripts

    Maybe you can have them use osql or sqlcmd instead of management studio to execute the scripts. You can then provide them with the 6 files, plus a batch file...



    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: Insert,update and delete trigger on multiple rows

    There's a big drawback on this type of auditing: the audit table is going to be a real hot spot in your database. Every insert, update, delete on every table...



    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: T-SQL Newbie needs help

    Again, you'll have to test it, but I think this will be faster on larger data sets.

    with cteMaintenanceSales as (

    -- Collect all sales where a maintenance product...



    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: T-SQL Newbie needs help

    I could not test it, as you did not include any DDL or test data, but this should do the trick.

    with cteMaintenanceSales as (

    -- Collect all sales...



    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 convert this 'dd-mm-yyyy' to 'yyyy-MM-ddTHH:mm:ss.fff' string format?

    Yeah, that's what we've been saying too. He's already falling into all the pits that we've warned him for.



    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 - 301 through 315 (of 428 total)