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)
 Error Msg: 1038

Author  Topic 

sathyav
Starting Member

27 Posts

Posted - 2004-12-28 : 06:55:08
Hi all,

SET @RESULT = ( SELECT nullif(LEFT(FIRSTNAME, 3),'') FROM STUDENT WHERE rollno = @ROLL)

When i use the above query in a SP, I get the following error msg,

Error Description : [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot use empty object or column names. Use a single space if necessary.

pls clarify me if i could use Nullif function in the columnlist of a select query

With thanks and regards
Sathya

Kristen
Test

22859 Posts

Posted - 2004-12-28 : 13:14:49
Is that the exact SQL from your application? It isn't using double quotes is it?

SELECT nullif(LEFT(FIRSTNAME, 3),'')

will return NULL if the first three characters of FIRSTNAME is ... ermmmm ... "an empty string" - is that what you mean?

Kristen
Go to Top of Page
   

- Advertisement -