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)
 Null Values Vs Blank Value

Author  Topic 

yazasi
Starting Member

11 Posts

Posted - 2008-10-17 : 01:00:45
I'm using some tables where a specific colums have sometimes a blank or the word 'Null'. How can I pull data and exclude all rows where that specific field has a blank.

- The WHERE Field_X IS NOT NULL statment is not helping as it pulls all rows with a blank value.

Thanks.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-10-17 : 02:12:19
where isnull(Field_X,'') <> ''
may help.

Webfred

Planning replaces chance by mistake
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-17 : 02:15:02
The value 'null' (a string of 4 characters) or NULL value?

WHERE NULLIF(NULLIF(Col1, 'NULL'), '') IS NULL



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-17 : 03:58:00
or

WHERE Col1<>'NULL' and Col1<>''


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-17 : 04:16:37
WHERE Col1 NOT IN ('NULL', '')


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-17 : 05:51:02
quote:
Originally posted by Peso

The value 'null' (a string of 4 characters) or NULL value?

WHERE NULLIF(NULLIF(Col1, 'NULL'), '') IS not NULL



E 12°55'05.63"
N 56°04'39.26"




Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

yazasi
Starting Member

11 Posts

Posted - 2008-10-18 : 01:26:53
Thanks guys.
Go to Top of Page
   

- Advertisement -