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 |
|
BankOfficerHere
Posting Yak Master
124 Posts |
Posted - 2008-11-05 : 01:17:28
|
| I have this statement:SELECT CI_LCprivacyFROM dbo.ztestsmsaveragethe results:Column1CI_LCprivacy0.978982300884955I want it to be like this:Column1 Column2CI_LCprivacy 0.978982300884955 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2008-11-05 : 01:19:09
|
| i think you can useselect * from information_schema.columns where table_name='youor table'ArnavEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
BankOfficerHere
Posting Yak Master
124 Posts |
Posted - 2008-11-05 : 01:21:04
|
| i didn't get it..sorry |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2008-11-05 : 01:56:04
|
| run the query, and based on the results, you can join with some other viewa to get the desired resultselect * from information_schema.columns where table_name='youtable_name'ArnavEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
BankOfficerHere
Posting Yak Master
124 Posts |
Posted - 2008-11-05 : 02:00:39
|
| can you give me the exact statement? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-05 : 02:01:34
|
or if column name is static just hardcode it n selectSELECT 'CI_LCprivacy' AS Col1,CI_LCprivacy AS Col2FROM dbo.ztestsmsaverage |
 |
|
|
BankOfficerHere
Posting Yak Master
124 Posts |
Posted - 2008-11-05 : 02:10:36
|
| ok i got it..what if I want to change the first CI_LCprivacy to Question1? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-05 : 02:35:18
|
quote: Originally posted by BankOfficerHere ok i got it..what if I want to change the first CI_LCprivacy to Question1?
you mean alias or value?if aliasSELECT 'CI_LCprivacy' AS Question1,CI_LCprivacy AS Col2FROM dbo.ztestsmsaverage if value SELECT 'Question1' AS Col1,CI_LCprivacy AS Col2FROM dbo.ztestsmsaverage |
 |
|
|
|
|
|