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 2012 Forums
 SSIS and Import/Export (2012)
 generate identity values.

Author  Topic 

Savitha
Starting Member

2 Posts

Posted - 2013-11-11 : 05:48:51
i have a table which has 2 columsn one column is table name another suurogate key value.which intail value is 0.we have been asked to generate values using the surrogate key values as ID column.Once the data is loaded into the table, the max id value should be updated to suuorgate max value column.Next the if the packae runs, it should read from column value and increment the values by 1.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-11-11 : 06:24:35
just add update statment like


UPDATE Table
SET SurrogateKey = (SELECT MAX(IDCol) FROM YourTable)
WHERE TableName = 'Your table name here'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -