June 28, 2005 at 5:02 am
3RD time lucky
declare @v1 int
set @v1 = 105000
update a
set @v1 = @v1+1,
a.attribute_id = @v1
from YourTable a
where isnull(a.attribute_id,0) = 0
June 28, 2005 at 9:08 am
Thank you, q! I checked this, it works. The way u did it is much more clear and faster.
Sergei
June 28, 2005 at 10:06 am
check this out for more information on this method and why you shouldn't use it :
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=189202
Also this may run faster if attribute_id is indexed :
declare @v1 int
set @v1 = 105000
update dbo.YourTable set @v1 = @v1+1, attribute_id = @v1 where attribute_id is null
June 28, 2005 at 11:44 am
Thank u, I will. Needless to say it looks pretty deep to me :=)
June 28, 2005 at 12:07 pm
It looked pretty deep for most of the persons browsing this forum .
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply