Forum Replies Created

Viewing 15 posts - 1,051 through 1,065 (of 1,228 total)

  • RE: Hard coding leading zeros to Unique IDs

    Guessing that your unique ID's are integer, you will need to cast them to a string type, preferably a CHAR of the correct length.

    Why do you want to do this?


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Financial modelling query

    You're welcome 🙂 Thanks loads for providing scripts and a perfect spec!


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Nested too deeply

    You're welcome.

    If you choose to go down the table route, you could "encapsulate" the code within a (CROSS) APPLY to provide a very fast solution.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Financial modelling query

    keymoo (10/27/2010)


    🙂 I hope your manflu is being kind to you. I now get:

    Msg 207, Level 16, State 1, Line 18

    Invalid column name 'rn'.

    LOL thanks! It's not the manflu which...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Financial modelling query

    keymoo (10/27/2010)


    Thanks I did that and I now get:

    Msg 207, Level 16, State 1, Line 5

    Invalid column name 'accountPerformance'.

    :unsure:

    Don't worry, we'll get there.

    ;WITH OrderedData AS (

    SELECT tradeId, pctAccountRisked, profit, tradeDateTime,

    ...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Nested too deeply

    Thanks for posting.

    Here's a handy reference for you:

    http://msdn.microsoft.com/en-us/library/ms187489.aspx

    Which would make your code much more compact for the next step:

    ---------------------- Albania POSTCODE VALIDATION ----------------

    ELSE IF @COUNTRY = 'Albania'

    set @Result=(SUBSTRING(@ADDRESSLINE, nullif(patindex('% [0-9][0-9][0-9][0-9]...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Nested too deeply

    Deepthy (10/27/2010)


    Hi ,i have 180 nested if statements and when i run function i get this:

    Some part of your SQL statement is nested too deeply. Rewrite the query or...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: insert if not exists, if it does insert into another table

    Brandie Tarvin (10/27/2010)


    I'm not sure I get Chris's comment of "It will also fail on duplicated rows from TempCustomer because the column ContactID in table ContactAudit is specified NOT NULL."...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Financial modelling query

    keymoo (10/27/2010)


    Hi Chris, thanks for you reply. It doesn't seem to work, I get this error:

    Msg 137, Level 15, State 2, Line 18

    Must declare the scalar variable "@nannyRisk".

    Put this at...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Sub select anomaly

    It's perfectly valid code as others have pointed out. It's interpreted by SQL Server as this:

    select s.SSN from #Select s where s.SSN in (Select s.SSN from #SubSelect ss)


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Financial modelling query

    Wow, what a great question! And I'm stuck at home with manflu and an expired evaluation copy of SQL2k8.

    Ok here goes:

    ;WITH OrderedData AS (

    SELECT accountPerformance, tradeId, pctAccountRisked, profit, tradeDateTime,

    rn =...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: insert if not exists, if it does insert into another table

    Maina-456685 (10/27/2010)


    Hi,

    I hope it makes sense now: i need an sp that does the following:

    Condition 1: If an entry is duplicated in TempCustomer, insert into ContactAudit table.

    An entry...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: would like to create a nested query on the stored procedure

    Sharon, can you post up the actual execution plan for this query?


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Query Question

    You need to write the query properly first - if this returns the correct rows, it's by accident, not by design. Something like this:

    select t1.*, t2.*, t3.*

    FROM TABLE1...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Are the posted questions getting worse?

    GilaMonster (10/25/2010)


    Tom.Thomson (10/25/2010)


    I'm definitely one of those who prefers a quick solution without work. Essentially I'm extremely lazy.

    I think most good developers are to some degree.

    Well I... nah I...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

Viewing 15 posts - 1,051 through 1,065 (of 1,228 total)