Write Function in SQL Server 2005

Published 30 October 07 10:05 AM | Madhivanan 

One of the functions available in SQL Server 2005 that allows you to update a character column of size max is WRITE Function. In fact we can consider this as alternate to STUFF function which wont work for columns with Max length

 

declare @t table(v nvarchar(max))
insert into @t select 'test is test'
update @t set v=stuff(v,1,4,'This')
select v from @t

go

declare @t table(v nvarchar(max))
insert into @t select 'test is test'
update @t set v.write('this',0,4)
select v from @t

PS

You can use STUFF function in both SELECT and UPDATE Statement but WRITE function can be used only in UPDAET statement preceded by Column name.

Filed under: , ,

Comments

# Other SQL Server Blogs around the Web said on October 30, 2007 5:18 AM:

One of the functions available in SQL Server 2005 that allows you to update a character column of size

# SSQA.net - SqlServer-QA.net said on October 30, 2007 5:58 AM:

One of the functions available in SQL Server 2005 that allows you to update a character column of size

Anonymous comments are disabled

Search

Go

This Blog

«October 2007»
SMTWTFS
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Syndication