I'd like to use a value from another table to set the seed value for a field in a table variable.
This on its own parses ok:
And this code...
...returns this error:
Is this not allowed? What are my options? Thanks!
This on its own parses ok:
Code:
--Variable to set the MU.Sequence field.
DECLARE @Seq int
SET @Seq = (SELECT (RECNUM + 1) FROM SDE.dbo.SMSYSRECNUM WHERE Name = '_COMPANY_')
And this code...
Code:
--Variable to set the MU.Sequence field.
DECLARE @Seq int
SET @Seq = (SELECT (RECNUM + 1) FROM SDE.dbo.SMSYSRECNUM WHERE Name = '_COMPANY_')
--Table variable for MU data.
declare @tmpMU table (
NewSeq int IDENTITY(@Seq,1),
CompanyID nvarchar (30)
CompanyName nvarchar (50)
)
...returns this error:
Code:
Server: Msg 170, Level 15, State 1, Line 6
Line 6: Incorrect syntax near '@Seq'.
Is this not allowed? What are my options? Thanks!