Forum Replies Created

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

  • RE: In Line Subquery versus Join query

    Run them both and look at the actual execution plans. You may be surprised to find they are the same or "trivially different" - maybe.

  • 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?

  • RE: Financial modelling query

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

  • 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.

  • 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...

  • 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,

    ...

  • 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,...

  • 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...

  • 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."...

  • 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...

  • 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)

  • 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 =...

  • 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...

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

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

  • 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...

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