472,145 Members | 1,500 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Incorrect syntax near the keyword 'current' ?

gopgally
I am new for sql server so please help me....


Expand|Select|Wrap|Line Numbers
  1. select barcode,current, rec retail, sellPrice from products
  2.  
Aug 10 '10 #1
4 5852
gpl
152 100+
The column 'rec retail' has a space in, the parser does not recognise this so shows the error.

Try this
Expand|Select|Wrap|Line Numbers
  1. select barcode,current, [rec retail], sellPrice from products 
Aug 10 '10 #2
NeoPa
32,499 Expert Mod 16PB
That is another problem. The error message you are getting (Please post it in the body of the question in future) indicates that Current is a reserved word (Keyword) and should not generally be reused as a field name. If you have a table with it then you should use the following syntax :
Expand|Select|Wrap|Line Numbers
  1. SELECT [BarCode]
  2.      , [Current]
  3.      , [Rec Retail]
  4.      , [SellPrice]
  5. FROM   [Products]
Welcome to Bytes!
Aug 10 '10 #3
Hi
Thank you for your code and idea...
code worked perfectly
Aug 10 '10 #4
NeoPa
32,499 Expert Mod 16PB
We're very pleased to have helped I'm sure :)
Aug 11 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Jeff Magouirk | last post: by
11 posts views Thread by Mark Findlay | last post: by
2 posts views Thread by ielmrani via SQLMonster.com | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.