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
 Transact-SQL (2000)
 ISNULL 2005

Author  Topic 

influent
Constraint Violating Yak Guru

367 Posts

Posted - 2006-08-02 : 10:57:28
I'm just posting here to let people know that the ISNULL function in T-SQL 2000 works differently than in T-SQL 2005. If the column within the ISNULL statement in 2000 does not exist, the function returns zero or whatever you tell it to.
For example, ISNULL(tableA.column1,0) will return 0 in 2000. In 2005, an error occurs. I'm not sure if this is because of a setting that can be changed, or just reflects what seems to me to be true, that T-SQL 2005 is a lot more strict about syntax.

Kristen
Test

22859 Posts

Posted - 2006-08-02 : 11:06:17
I get a syntax error in SQL 2000 too - am I missing something perhaps? Have you got a standalone example please?

Kristen
Go to Top of Page

influent
Constraint Violating Yak Guru

367 Posts

Posted - 2006-08-02 : 11:29:19
Thank you Kristen, I just discovered that I sort of lied. The procedures in which I was seeing the problem had the form ISNULL(tableA.column1.TextVal,0), and if I take off the "TextVal" part, I do get an error about the column missing. A coworker put the ".TextVal" there, I have no idea what it's supposed to do or how it doesn't cause an error.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-08-02 : 11:36:19
Still can't create a statement that will run without error I'm afraid!

Kristen
Go to Top of Page
   

- Advertisement -