SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Select Null
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

snow12
Yak Posting Veteran

74 Posts

Posted - 06/28/2012 :  16:00:01  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
5469 Posts

Posted - 06/28/2012 :  16:59:38  Show Profile  Reply with Quote
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 - 06/28/2012 :  17:05:38  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
5469 Posts

Posted - 06/28/2012 :  17:11:18  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
5469 Posts

Posted - 06/28/2012 :  17:19:20  Show Profile  Reply with Quote
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 - 06/29/2012 :  17:38:38  Show Profile  Reply with Quote
Thank you very much!
Go to Top of Page

TG
Flowing Fount of Yak Knowledge

USA
5469 Posts

Posted - 06/29/2012 :  20:47:04  Show Profile  Reply with Quote
you're welcome.

Be One with the Optimizer
TG
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000