Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IS NOT NULL not working in stored procedure when SET ANSINULL ON

Status
Not open for further replies.

viper78

IS-IT--Management
May 6, 2003
1
MY
Hi,

I have a simple query in a stored procedure that have something like "WHERE Col1 IS NOT NULL". The query run correctly when SET ANSINULL OFF but not working when SET ANSINULL ON. (IS NULL work correctly in two situation.)

below is my code

I'm using Sybase 11.0 running in Sun Solaris 5.6

CREATE TABLE test
(
F1 VARCHAR ( 100 ) NULL,
F2 VARCHAR ( 100 ) NULL
)

INSERT INTO test VALUES ( 'data1', 'hello')
INSERT INTO test VALUES ( 'data2', 'dfdf')
INSERT INTO test VALUES ( 'data3', NULL)

CREATE PROC usp_test
AS
SELECT * FROM test WHERE F2 IS NOT NULL
GO

SET ANSINULL OFF
EXEC usp_test
--the result is expected

SET ANSINULL ON
EXEC usp_test
--no result


Pls help

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top