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 2005 Forums
 Transact-SQL (2005)
 Select Null

Author  Topic 

snow12
Yak Posting Veteran

74 Posts

Posted - 2012-06-28 : 16:00:01
Hello:

I have a column have NULL value. When I use:

select * from student where name IS NULL

I got syntax error Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'IS'.

Where I missed? Thank you for your help

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-06-28 : 16:59:38
There is nothing wrong with the syntax that you posted. If this is still an issue please post the entire batch of code that you are having a problem with.

Be One with the Optimizer
TG
Go to Top of Page

snow12
Yak Posting Veteran

74 Posts

Posted - 2012-06-28 : 17:05:38
Hello:

Thanks for the reply.

I use:
select * from dbo.student

The result:

student	update
aa NULL
ac NULL


I use: select * from dbo.student where update is null
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'is'.

Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-06-28 : 17:11:18
Ugh - "Update" is a sql key word.
put a bracket around "update" - and then don't use sql key words for object names

select * from dbo.student where [update] is null

Be One with the Optimizer
TG
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-06-28 : 17:19:20
reminds me of an oldie but a goodie:
Naming convention for Objects in MS SQL and .net

Be One with the Optimizer
TG
Go to Top of Page

snow12
Yak Posting Veteran

74 Posts

Posted - 2012-06-29 : 17:38:38
Thank you very much!
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-06-29 : 20:47:04
you're welcome.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -