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 |
|
rudba
Constraint Violating Yak Guru
415 Posts |
Posted - 2009-08-24 : 11:57:51
|
| How do i update Col3 fields with Col1 value + Col2 valueCol1 is INT field, Col2 is string field.Declare @tbl1 table (ID INT,Col1 INT,Col2 varchar(10),Col3 varchar(15))INSERT INTO @tbl1SELECT 1, 0,'Abc',NULLINSERT INTO @tbl1SELECT 2,1,'xyz',NULLINSERT INTO @tbl1SELECT 3,1,'Mnop',NULL |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-08-24 : 12:00:15
|
you mean this??update @tbl1set Col3 = convert(varchar(10),Col1) + Col2 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-25 : 03:04:37
|
| Why dont you use this?select col1,col2,convert(varchar(10),Col1) + Col2 as col3 from @tbl1MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|