declare @myint int,
@query = varchar(4000)
set @query = "select max(id) from[" + dbo.fnGetDBName() + "].dbo.mytable"
set @myint = exec @query -- fails
DBCC Checkident reseed(mytable,reseed,@myint)
--more processing statements--
trouble is I cannot get @myint to be asigned.
I can take the long route and create a temp table and assign the value after selecting the first row. I tried sp_executesql which works, but nothing else is processed after that.
View Complete Post