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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-04-21 : 07:55:17
|
| Dion writes "Hi,I need to insert a unique record number to each record in an existing table(v 6.5). CREATE TABLE dbo.AGENT ( AGENT_CODE varchar (5) NOT NULL , INSTANSIE_NR smallint NULL , INSTANSIE_ROL char (2) NULL , DESCRIPTION varchar (35) NULL , AREACODE varchar (4) NULL , USERNAME varchar (20) NULL , PASSWORD varchar (20) NULL , UPLOAD tinyint NOT NULL , FTP_ADDRESS varchar (255) NULL , GTIN_IND tinyint NULL , AgentSeqNo int NULL ,)I have added the AgentSeqNo column to effect this. I want to run this piece of SQL found on this web site:- declare @intCounter int select @intCounter = 0 update Agent SET @intCounter = AgentSeqNo = @intCounter+1but get this error:- Msg 425, Level 16, State 1 Datatype 'int' of receiving variable not equal to datatype 'int null' of column 'AgentSeqNo'.Any ideas?Regards,Dion" |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-04-21 : 08:09:46
|
| Try making all values of AgentSeqNo zero (not null), then alter the table so AgentSeqNo is NOT NULL.Sam |
 |
|
|
|
|
|
|
|