Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
keesvo
Starting Member
10 Posts |
Posted - 2011-11-01 : 10:51:29
|
Hello everyone,I have a table with different columns.In one specific column i want to add data.This data is split into 2 parts.The first part is a static text andthe second part is the value of another column in the same table.Can someone help me ? Thank you in advance.THIS IS THE MEANING OF IT:TABLE : ITEMS BEFORE QUERY ID ITEMCODE DESCRIPTION PACKAGE1 PRODUCT_A THIS IS A TESTPRODUCT PER 1002 PRODUCT_B THIS IS A SECOND TESTPRODUCT PER 503 PRODUCT_C THIS IS A THIRD TESTPRODUCT PER 1000-------------------------------------------------------------------AFTER QUERY ID ITEMCODE DESCRIPTION PACKAGE1 PRODUCT_A THIS IS A TESTPRODUCT PACKAGED PER 100 PER 1002 PRODUCT_B THIS IS A TESTPRODUCT 2 PACKAGED PER 50 PER 503 PRODUCT_C THIS IS A TESTPRODUCT 3 PACKAGED PER 1000 PER 1000 "PACKAGED" IS THE STATIC TEXT I WANT TO ADD THE SECOND PART IS THE DATA FROM THE COLUMN PACKAGE |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-11-01 : 11:04:40
|
Not sure which text is in which column but maybeupdate tblset DESCRIPTION = DESCRIPTION + ' PACKAGED ' + Package==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
keesvo
Starting Member
10 Posts |
Posted - 2011-11-01 : 11:17:18
|
Thank you.But when I'm executing the query i get the following error:String or binary data would be truncated.The statement has been terminated. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-01 : 11:45:57
|
quote: Originally posted by keesvo Thank you.But when I'm executing the query i get the following error:String or binary data would be truncated.The statement has been terminated.
thats because you DESCRIPTION field doesnt have required length to hold value. Increase length of field using ALTER TABLE.. ALTER COLUMN... and then do the update------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|