question

aRookieBIdev avatar image
aRookieBIdev asked

MANUAL INCREMENT COLUMN IN MERGE

Hi All, I am using merge statement to insert and update my Destination Table. My destination table has id a primary key column which should be manualy incremented. It should be identity but for some reason they have not made it so. How can I manually increment the id column for every insert. Thanks, Kannan
sqlmerge2012
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Fatherjack avatar image
Fatherjack answered
I would suggest that you look at using SEQUENCES, they are similar to IDENTITY but have some different characteristics http://blogs.msdn.com/b/askjay/archive/2012/10/08/sequence-objects-in-sql-2012-and-sql-2008.aspx. If you can work within their limits then this is the solution I'd recommend
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.