try this:CREATE PROCEDURE Votes_SetVotes -- do not use sp_ prefix @Table NVARCHAR(128), -- of SYSNAME @ID BIGINT, @Vote TEXTAS SET NOCOUNT ON DECLARE @SQL NVARCHAR(4000) SET @SQL = 'UPDATE ' + @Table + ' SET col1 = @Vote' + ' WHERE ID = @ID' EXEC sp_executesql @SQL, '@Vote TEXT, @ID BIGINT', @Vote, @ID RETURN 0GO
not sure the UPDATE statement will work for TEXT values that are larger than 8000 characters. The reason you use sp_executesql is you can include dynamic parameters. Of course the current executing user will need to have UPDATE permissions on the @Table passed in, this is the downside of using dynamic sql, it does not support a secure strategy.Edited by - onamuji on 02/08/2003 07:31:29