Sql updating identity column
Is the incremental value that is added to the identity value of the previous row that was loaded. IF OBJECT_ID ('dbo.img', ' U') IS NOT NULL DROP TABLE img; GO CREATE TABLE img (id_num int IDENTITY(1,1), company_name sysname); INSERT img(company_name) VALUES (' New Moon Books'); INSERT img(company_name) VALUES (' Lucerne Publishing'); -- SET IDENTITY_INSERT ON and use in img table.You must specify both the seed and increment or neither. Identity columns can be used for generating key values. If so, you're not actually altering the Event ID value, correct?Your update statement is just setting it back to the same value.You can control the column's first and subsequent values, by specifying those values when you create the column.For instance, you might want to begin with a purchase order number of 1001 rather than 1.Matt Miller, another poster suggested that I put in the following commands: SET IDENTITY_INSERT shows ON your insert statement SET IDENTITY_INSERT shows OFF Where in my Stored Procedure should I put this?Any ideas why this happened after moving to another server?
We have inserted duplicate rows but can separate them by the identity column value.Thanks Jeff Boise, IDHere is my stored procedure: CREATE PROCEDURE Item_Update_Show( @Event ID int, @Title varchar(50), @_Date datetime, @Venue int, @Headliner ID int, @Opener varchar(150), @Doorstime varchar(50), @Showtime varchar(50), @Price varchar(50), @Onsaledate datetime, @Vendor ID int, @Ticket URL varchar(250), @Description varchar(1000) )ASUPDATE Shows SET Event ID = @Event ID, Title = @Title, _Date = @_Date, Venue = @Venue, Headliner ID = @Headliner ID, Opener = @Opener, Doorstime = @Doorstime, Showtime = @Showtime, Price = @Price, Onsaledate = @Onsaledate, Vendor ID = @Vendor ID, Ticket URL = @Ticket URL, Description = @Description WHERE Event ID = @Event IDGO Actually, if I read your stored procedure right, you don't need to do this.You're taking the Event ID being passed in via the parameter @Event ID and modifying the row corresponding to @Event ID right?The identity also shows the order in which the rows were inserted.We can find the current identity seed by using The table has not changed but we can see from the checkident that the current seed has been changed and we know that this is used to generate the next value.