Posted by: U?Me June 6, 2008
SQL Automatic incremental generator
Login in to Rate this Post:     0       ?        
Hey guys,
Thanks for the prompt help. Now I was able to insert values, but they were all the same(C000001) for the columns that were inserted since my query does multiple inserts satisfying a condition. But I want values to be inserted as C000001, C000002, and so on. So what I did, was create a Table B, with

CustomerID varchar(60) ---same datatype as TableA
dbID int identity not null primary key,

Then insert into TableB(CustomerID)
select CustomerID........

Now I am trying to insert these values from TableB to TableA,
and i get this error

Msg 512, Level 16, State 1, Procedure NextCustomerNumber, Line 6
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

Any ideas?


Read Full Discussion Thread for this article