Adicionar texto en columna de Sql Server

Leave a comment

June 10, 2013 by Moisés Moreno

-- create a test table createtable test (
    a text
)-- insert test valueinsertinto test (a)values('this is a text')-- the following does not work !!!update test set a = a +' and a new text added'-- but this way it works: update test set a = cast ( a as nvarchar(max))+ cast (' and a new text added'as nvarchar(max))-- test resultselect*from test
-- column a contains:
this is a text and a new text added

 

-- create a test table createtable test (
    a text
)-- insert test valueinsertinto test (a)values('this is a text')-- the following does not work !!!update test set a = a +' and a new text added'-- but this way it works: update test set a = cast ( a as nvarchar(max))+ cast (' and a new text added'as nvarchar(max))-- test resultselect*from test
-- column a contains:
this is a text and a new text added


Aqui el enlace:

http://stackoverflow.com/questions/3099237/sql-server-adding-a-string-to-a-text-column-concat-equivalent

 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: