Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to 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 1-Mar-11 21:56pm
Edited 1-Mar-11 22:01pm
Tarun.K.S42.1K
v2
Comments
Tarun.K.S at 2-Mar-11 3:01am
   
Use <pre> tags to wrap your code.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 15 Mar 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100