EDIT: Most of this thread was self-solved. The result is:
To REPLACE with an SP variable, use this syntax:
DECLARE @.SQL AS VARCHAR(4000)
SELECT @.SQL = REPLACE('A','B','C')
The only outstanding question from the original thread content is:
When using EXEC, does it remain within the scope of a TRANS?
BEGIN
BEGIN TRAN T1
SET @.SQL = 'Some SQL statement'
EXEC (@.SQL)
COMMIT TRAN T1
END
GOI fixed the sysmessages table error. Just a simple transposition of 'master.dbo.sysmessages'. And it appears the "Incorrect syntax near '<' is a result of the failed REPLACEs.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment