use sro_vt_shard declare @commonid int declare @itemlinkid int set @commonid = (select id from _refobjcommon where id = (select max(id) from _refobjcommon))+1 set @itemlinkid = (select id from _refobjitem where id = (select max(id) from _refobjitem))+1 print 'common id you have to use: '+cast(@commonid as varchar(15)) print 'common link id you have to use: '+cast(@itemlinkid as varchar(15))