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 |
jim_jim
Constraint Violating Yak Guru
306 Posts |
Posted - 2013-03-06 : 14:21:51
|
Hi AllIs it possible to restrict the feilds returned from a select statement which means i want to see only the feilds in a record which has some data in them and want to ignore the other feilds where feild is null and i dont know in advance which feilds are null and that is the reason i cannot have it in the where conditionso for exampleSelect * from table_name where column1 =''xxx' returns 1 record with 15 feilds which is the number of feilds existing in the table.if for example there are 3 feilds where the data in those feilds is null i do not want them to be returned in my select queryThanks |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-03-06 : 14:37:08
|
I assume you mean that if the data in every row for a given column is null, then you don't want that row to be included in the result set. To do that, you would have to write a dynamic query.If you describe the reason for wanting it that way, may be people would be able to suggest alternatives. To me at least, the unpredictability of the columns returned based on the variations in data makes it hard to process the result set. So I am not able to imagine what your reason for wanting that might be. |
|
|
jim_jim
Constraint Violating Yak Guru
306 Posts |
Posted - 2013-03-06 : 15:01:23
|
Iam trying to compare two requests(records) one request from previous year(2012) and 1 request from current year(2013) and want o capture only the feilds from the two records where there is a change in data and ignore/hide all the other feilds where data has remained the sameHope the above is making sense |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
|
|
|
|