• okbangas


    Points: 11773

    Comments posted to this topic are about the item Merge

    Ole Kristian Velstadbråten Bangås - Virinco - Facebook - Twitter

    Concatenating Row Values in Transact-SQL[/url]

  • Lokesh Vij


    Points: 10836

    Nice question Kristian! Thanks 🙂

    ~ Lokesh Vij

    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post -->[/url]

    Follow me @Twitter

  • Koen Verbeeck

    SSC Guru

    Points: 258965

    Great question, thanks!

    Need an answer? No, you need a question
    My blog at
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Vinay Kumar


    Points: 6098

    Good question. I learn something new !!!


    Vinay Kumar
    Keep Learning - Keep Growing !!!

  • Gazareth

    One Orange Chip

    Points: 27737

    Nice question, thanks

  • siddharth.tandon1

    SSC Journeyman

    Points: 95

    Nice question on merge!

  • This was removed by the editor as SPAM

  • (Bob Brown)


    Points: 2705

    Thank you for the question and lesson.

  • Raghavendra Mudugal


    Points: 10658

    Thanks for the question, Ole. Interesting.. (before I knew very little about the merge, but know even little bit more... 🙂 )

    ww; Raghu
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • mtassin


    Points: 23099

    Good question, learned something I didn't know about Merge and I use it not every day, but at least every other week. 🙂

    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • sestell1


    Points: 10230

    Ugh, apparently I really need to use MERGE more often.

    Thanks for the great question!

  • BarbW

    SSCarpal Tunnel

    Points: 4759

    What's Merge got to do with Valentine's Day?? 😉 Just kidding, good question!

  • Venkat Jonnalagadda

    Mr or Mrs. 500

    Points: 510

    Great question... learnt something new today..! Thanks for the qotd

    If I can answer a question then anyone can answer it..trying to reverse the logic.. :hehe:

  • TomThomson

    SSC Guru

    Points: 104773

    Nice question. However, the explanation would have been better if it had pointed out that filters like this can be placed in the when matche/not matched conditions. In this merge statement the when clause should have been when not matched by target and src.RowNo = 1 if the intention was to get only the three rows with RowNo 1.

    In fact even filtering of the target table in the on clause other than with a matching codition between source and target is stated by MS to be bad practice, as it can lead to unexpected results (ie it doesn't necessarily do what you would expect it to do).


    It is important to specify only the columns from the target table that are used for matching purposes. That is, specify columns from the target table that are compared to the corresponding column of the source table.


  • jmoney 69422

    SSC Enthusiast

    Points: 151

    Terrific and subtle point. You got me. Any "filtering" must be done in the WHEN [NOT] MATCHED AND xxx clause.

Viewing 15 posts - 1 through 15 (of 40 total)

You must be logged in to reply to this topic. Login to reply