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 |
|
u2envy1
Yak Posting Veteran
77 Posts |
Posted - 2008-11-27 : 01:18:33
|
| How do I assign a column a value in a select statement ?select column1, column2, column3 = 'T'From Table1 |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2008-11-27 : 01:28:43
|
| SELECT column1,column2,column3FROM Table1WHERE column3 ='T' |
 |
|
|
u2envy1
Yak Posting Veteran
77 Posts |
Posted - 2008-11-27 : 02:38:05
|
| That will bring back column3 with value T.I want to add a new column that does not exist in the Table to have the Value 'T'select column1, column2, NewColumn = 'T'From Table1 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-27 : 02:57:24
|
quote: Originally posted by u2envy1 That will bring back column3 with value T.I want to add a new column that does not exist in the Table to have the Value 'T'select column1, column2, NewColumn = 'T'From Table1
Do you get any error with this SELECT?MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-27 : 03:02:43
|
select column1, column2, 'T' AS NewColumnFrom Table1 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-27 : 03:16:46
|
quote: Originally posted by u2envy1 That will bring back column3 with value T.I want to add a new column that does not exist in the Table to have the Value 'T'select column1, column2, NewColumn = 'T'From Table1
this works for me anyways |
 |
|
|
u2envy1
Yak Posting Veteran
77 Posts |
Posted - 2008-11-27 : 04:14:06
|
| Thx, perfecto !! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-27 : 04:42:15
|
quote: Originally posted by u2envy1 Thx, perfecto !!
Which is perfecto?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|