Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Sequential Record Number field- Help me understand

Author  Topic 

ThreePea
Yak Posting Veteran

83 Posts

Posted - 2002-04-15 : 11:46:13
I just read the following article: [url]http://www.sqlteam.com/item.asp?ItemID=765[/url]
Basically it talks about the new feature in the UPDATE statement that allows you to do something like<br>

UPDATE table
SET @var = column = @var + 1



I understand the concept - it's a cool way to sequentially renumber a field. However, I was able to do the same thing with the following:

UPDATE table
SET column = @var,
@var = @var + 1


What am I missing that makes this nice tip something that couldn't be done before. Thanks.

Jerry

=======================================================
"You guys start coding - I'll go find out what they want."

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-15 : 11:54:08
I had the same problem when I tried altering it. It seems that syntax is very particular, and it has to be done as described in the article.

Technically you cannot assign a variable while setting or selecting a column value; that syntax is the only acceptable format that works around that limitation.

Go to Top of Page
   

- Advertisement -