Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I want to update my table field(by adding new value with previously added value). data type of field is text. query which i tried is as

select notes= cast((convert(nvarchar(max),notes)+ '  ' +convert(nvarchar(max),'shekhar is not here'))as text) from contact1 where accountno='B10228491871N_\vlTes'


This query runs successfully if I use the length of notes data in the text field for the accountNo ='B10228491871N_\vlTes'
eg.
select notes= cast((convert(nvarchar(10),notes)+ '  ' +convert(nvarchar(max),'shekhar is not here'))as text) from contact1 where accountno='B10228491871N_\vlTes'


where I replace first max in convert with 10 ( 10 is the length of the data in notes(text) field.)

also if I use the length more then 10 it does not work ( do not add text )



this will return previous value. how should i add new text value with original value.

this query is running successfully with other db text fields.
( my db was showing 1.6 compatible label when i restored it so i change it as 90.)
Posted
Updated 1-Mar-11 21:01pm
v2
Comments
Tarun.K.S 2-Mar-11 3:01am    
Use <pre> tags to wrap your code.

1 solution

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900