I'm trying to loop through my db and fill the values in a field called ExternalID that exists in each table using the following:
exec sp_MSForEachTable 'exec fillidentity "?" '
First I have to set up the sproc, fillidentity but I get an error. I am trying to run:
create procedure FillIdentity
set @ident = 1
set ExternalID = @ident, @ident = @ident + 1
BUT, I keep getting the error when creating the procedure, that says:
Server: Msg 137, Level 15, State 2, Procedure FillIdentity, Line 8
Must declare the variable '@tble'.
What's going wrong? Thanks