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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 need query support

Author  Topic 

cruxmagi
Starting Member

38 Posts

Posted - 2010-04-21 : 00:49:39
I have a table which consists of set of columns,except few columns all columns are having allow null values.When i select a record from the table i want to eliminate the columns which are having null values.I need query support

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-04-21 : 00:55:50
Just to start with:

Select * from yourtable where
col1 is not null and col2 is not null...

If your requirement is different then please give more information along with sample data.

Regards,
Bohra
Go to Top of Page

cruxmagi
Starting Member

38 Posts

Posted - 2010-04-21 : 01:04:11
I want to know is there any possibility of "where [COLUMNS]is not null"
ex:
my table
Id USerId Pwd Adr1 Adr2 State City RegDate
1 test tst

desired o/p
Id UserId Pwd
1 test tst


quote:
Originally posted by pk_bohra

Just to start with:

Select * from yourtable where
col1 is not null and col2 is not null...

If your requirement is different then please give more information along with sample data.

Regards,
Bohra


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-21 : 01:34:54
does that mean you need varied number of column in your resultset always? can i ask need for this? if this is for display why dont do this at front end? or chnage nulls to default value using ISNULL or COALESCE

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

cruxmagi
Starting Member

38 Posts

Posted - 2010-04-21 : 03:01:00
This is not for display,after eliminating the columns[has null value]i need to generate xml format output.I tried [ISNULL] logic,i thought i could get some other possible way of get things done
quote:
Originally posted by visakh16

does that mean you need varied number of column in your resultset always? can i ask need for this? if this is for display why dont do this at front end? or chnage nulls to default value using ISNULL or COALESCE

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-21 : 05:48:28
can you show an example plz to depict your scenario?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -