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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to combine existing and new?

Author  Topic 

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2008-07-27 : 22:31:26
How can i combine existing one(nvarchar type) and new one in update statement?In this procedure,i want to add @cmt to comment but i don't want to remove existing comment.
CREATE PROCEDURE [dbo].[update]
@id int,@cmt nvarchar(500)
AS
update tblRenewalList
set Comment=@cmt
where AutoID=@id
GO
Thanks in advance.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-27 : 22:39:41
[code]update tblRenewalList
set Comment = Comment + @cmt[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2008-07-27 : 23:15:04
Thank u.

quote:
Originally posted by khtan

update tblRenewalList
set Comment = Comment + @cmt



KH
[spoiler]Time is always against us[/spoiler]



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-28 : 10:28:31
is Comment nullable? if yes, you need to account for nulls also

CREATE PROCEDURE [dbo].[update]
@id int,@cmt nvarchar(500)
AS
update tblRenewalList
set Comment=coalese(Comment,'') + @cmt
where AutoID=@id
GO
Go to Top of Page
   

- Advertisement -