Click here to Skip to main content
11,702,396 members (69,722 online)
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 20:56pm
Edited 1-Mar-11 21: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 Maciej Los 515
1 Sergey Alexandrovich Kryukov 355
2 OriginalGriff 299
3 CHill60 145
4 Mika Wendelius 115
0 OriginalGriff 8,369
1 Sergey Alexandrovich Kryukov 7,547
2 CPallini 4,922
3 Maciej Los 4,411
4 Mika Wendelius 3,556


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 15 Mar 2011
Copyright © CodeProject, 1999-2015
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