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 |
aswindba1
Yak Posting Veteran
62 Posts |
Posted - 2013-04-04 : 16:34:06
|
Hi Please help for below requirement.I need to combine two columns of data and insert in new columnI have two columns liek belwocol1 col21 2 1 56 12 7I need table like belowCol1 col2 col31 2 121 5 156 1 622 7 27 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-04-04 : 16:38:47
|
SELECT Col1, Col2, 10 * Col1 + Col2 AS Col2 FROM dbo.MyTableSELECT Col1, Col2, CAST(Col1 AS VARCHAR(12)) + CAST(Col2 AS VARCHAR(12)) AS Col3 FROM dbo.MyTable N 56°04'39.26"E 12°55'05.63" |
|
|
aswindba1
Yak Posting Veteran
62 Posts |
Posted - 2013-04-04 : 16:42:21
|
Hi Thanks for your help..But I need to Insert new column to the table with combined values. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-05 : 01:12:25
|
ALTER TABLE tablename ADD col3 AS col1 * 10 + col2------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|