Miscellaneous Ramblings on Hacking

October 14, 2006

Crazy SQL Server Syntax

Filed under: Uncategorized — Zack Bethem @ 10:38 pm

Crazy, but I must admit the convenience. This came up after loading a table. I needed to generate an incremented value in the SQL Server database. Normally, you could do this by setting the column to be of type IDENTITY. I didn’t have the luxury and didn’t want to reload it anyway.

SQL Command:
declare @intCounter int
set @intCounter = 234234  — some random number

–set the column and increment
update stage_conference
set @intCounter = conference_id = @intCounter + 3 

Thanks to Google, which landed me here.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: