Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-04-16 : 00:15:14
|
Maya writes "I have stored procedure to update table with 14 parameters. My goal is to update only fields that receive values, and leave old data in others. Here is the short example of what I am trying to do:
Declare @SignOn_1 nvarchar(8) set @SignOn_1 = 'XXXX' declare @UserName_3 nvarchar(50) set @UserName_3 = '' declare @Comments_19 nvarchar(50) set @Comments_19 = 'testing' declare @sqlstring nvarchar (300) select @sqlString = 'UPDATE tblMain SET ' if @UserName_3 != '' BEGIN select @sqlString = @sqlString + 'UserName = @UserName_3,' END if @Comments_19 != '' begin select @sqlString = @sqlString + 'Comments = @Comments_19' end select @sqlString = @sqlString + ' WHERE SignOn = @SignOn_1' exec sp_sqlexec @sqlString
Problem is that sp_sqlexec is not available with SQL 200. Any ideas?
Thanks for your time,
Maya" |
|
|
|
|
|