I wish to do the following:
SET @sql = "SET IDENTITY_INSERT " + @DB_NAME_TO + ".dbo.TBL_RELATIONSHIPS ON"
EXEC(@SQL)
As it may vary which database I write to depending on input paramter, BUT it does not work, I guess its to do with the scope of EXEC dynamic SQL, any work arounds?