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 2000 Forums
 SQL Server Development (2000)
 SQL view problem

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-04-27 : 08:57:34
amar writes "Hi

I am trying to get the following sql statement to work. Basically im creating a view from another table, some records in this one field have no values, blank. In my sql statement i dont want these to appear in the view. Only thing is the following doesnt work? can anyone help?

SELECT P2_Q21
FROM dbo.questioaires
WHERE (P2_Q21 IS NOT NULL)

It completely ignores the WHERE statment. The data contained in P2_Q21 comes from a form and when the user doesnt enter a value for P2_Q21, it just displays as an empty string in sql server table. Please help as im gettng desperate!

thanks"

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2004-04-27 : 09:01:29
it does not ignore the where statement, a blank is different than a null value.
u may try :

SELECT P2_Q21
FROM dbo.questioaires
WHERE (P2_Q21 IS NOT NULL and len(p2_Q21)>0)

He is a fool for five minutes who asks , but who does not ask remains a fool for life!<N>

http://www.sqldude.4t.com
Go to Top of Page
   

- Advertisement -