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 |
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2005-11-07 : 10:58:53
|
| I have the following with union,showing 3 columns is it possible to show a fake column 4th column with hardcoded information in it for the first one says pubs as value in it and for second saying store as a value. column name can be (type)Because i am planning to bind all the data from the resultset in one datagrid: on the front end the user will know this row belongs to pubs and this belongs to stores like that.SELECT type(fake column with hardcoded value pubs in it), pub_id, pub_name, city INTO results FROM publishersUNIONSELECT type(fake column with hardcoded value store in it),stor_id, stor_name, city FROM storesThank you very much for the information. |
|
|
karuna
Aged Yak Warrior
582 Posts |
Posted - 2005-11-07 : 11:07:59
|
| How about this?Select 'pubs' as coltype,pub_id,pub_name,city from publishersunionselect 'store' as coltype,stor_id, stor_name, city FROM storesThanksKarunakaran |
 |
|
|
nathans
Aged Yak Warrior
938 Posts |
Posted - 2005-11-07 : 11:08:20
|
SELECT 'pubs' as type, pub_id, pub_name, city ... Nathan Skerl |
 |
|
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2005-11-07 : 11:31:37
|
| Thank you very much for the info. |
 |
|
|
|
|
|
|
|