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 |
|
m_weltm
Starting Member
8 Posts |
Posted - 2007-06-11 : 15:37:29
|
| I am having a problem finding a solution for this:--this is only an example not a real tableDeclare @t table( addressNum int, addressStreet varchar(8), unitNumber varchar(10), city varchar(20), state varchar(2), zip int)Insert into @t values(12, 'Jackson', 'apt.3D', 'Chicago', 'IL', 60607)Insert into @t values(115, 'Briar', 'apt. 5F', 'Chicago', 'IL', 60657)For certain queries I would like to filter the columns selected based on some user preferences. I.E. if some user doesn't want to see city state or zip I can perform some filtering such that I get NULL for those columns. Ideally it would work something like thisSELECT *FROM ( --some derived table which has been filtered) FilteredTableWHERE id=@idThanks |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2007-06-11 : 16:06:52
|
| Sample output, please....e4 d5 xd5 Nf6 |
 |
|
|
m_weltm
Starting Member
8 Posts |
Posted - 2007-06-11 : 16:25:28
|
| addressNum addressSreet unitNumber city state zip-------------------------------------------------------------------12 'Jackson' 'apt.3D' NULL NULL NULL115 'Briar' 'apt.5F' NULL NULL NULLor if another user doesn't want to see unitNumber the query would result in:addressNum addressSreet unitNumber city state zip-------------------------------------------------------------------12 'Jackson' NULL 'Chicago' 'IL' 60607115 'Briar' NULL 'Chicago' 'IL' 60657 |
 |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2007-06-11 : 17:11:45
|
| This is really a presentation issue that should be handled on the client side.e4 d5 xd5 Nf6 |
 |
|
|
|
|
|
|
|