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)
 error when SQL statement returns NULL

Author  Topic 

froggy
Starting Member

14 Posts

Posted - 2006-11-30 : 19:55:33
Hi,

I have a webpage which shows some results upon executing some SQL statements. However, i will met with some problems when the SQL statements return a NULL value therefore i would like to do some error checking such that when the SQL statement returns NULL, i will direct the user to another page.

Is it possible for me to try sth such as:

if strSQL = SELECT .. FROM .. WHERE .. = NULL then
response redirect ...

Was wondering if anybody would be able to give me some advise.

Thank you.

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2006-11-30 : 23:59:38
SELECT x FROM y WHERE z IS NULL


SqlSpec: a fast and comprehensive data dictionary generator for
SQL Server 2000/2005, Analysis Server 2005, Access 97/2000/XP/2003
http://www.elsasoft.org
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-01 : 03:18:15
You cant use = or <> to compare NULL. You should use is NULL or is not NULL

Madhivanan

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

- Advertisement -