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 |
|
OBINNA_EKE
Posting Yak Master
234 Posts |
Posted - 2009-05-18 : 10:57:50
|
| I have this table structure belowINSERT INTO [Setting] ( SettingID, MoceanUsername, Test)VALUES ( @SettingID, @MoceanUsername, @Test)when I am displaying it on SQL or C# Is it posible to have this kind of structure? Columns Value SettingID 1000 MoceanUsername SuperUser Test YesTherefore switching the rows to two colums only?If it it possible, any help will be appreciated(My data will only have one row only)If it is that easy, everybody will be doing it |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-05-19 : 02:33:52
|
| select 'Settingid' as columns, cast(Settingid as varchar(100)) as value from [Setting]union allselect 'MoceanUsername' as MoceanUsername, MoceanUsername from [Setting]union allselect 'Test' as Test, Test from [Setting]MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-19 : 10:10:45
|
| if you're using sql 2005, you can UNPIVOT also for this. |
 |
|
|
|
|
|