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
 General SQL Server Forums
 New to SQL Server Programming
 SSRS

Author  Topic 

srisha
Starting Member

38 Posts

Posted - 2013-08-28 : 05:12:43
SELECT OEINVD.ITEM,OEINVD.DESC,OEINVD.QTYSHIPPED,OEINVD.UNITCOST,
OEINVD.INVUNIT,OEINVD.EXTICOST,
OEINVH.INVDATE,OEINVH.INVNUMBER
FROM OEINVD
INNER JOIN OEINVH ON OEINVH.INVUNIQ=OEINVD.INVUNIQ
ORDER BY OEINVH.INVUNIQ

error:
an error occurred while executing the query incorrect syntax near the keyword 'DESC'

--------------------------
BY
SRISHA

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-08-28 : 08:43:03
quote:
Originally posted by srisha

SELECT OEINVD.ITEM,OEINVD.[DESC],OEINVD.QTYSHIPPED,OEINVD.UNITCOST,
OEINVD.INVUNIT,OEINVD.EXTICOST,
OEINVH.INVDATE,OEINVH.INVNUMBER
FROM OEINVD
INNER JOIN OEINVH ON OEINVH.INVUNIQ=OEINVD.INVUNIQ
ORDER BY OEINVH.INVUNIQ

error:
an error occurred while executing the query incorrect syntax near the keyword 'DESC'

--------------------------
BY
SRISHA

Try wrapping the "DESC" in square brackets as shown in red in the quote above.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-28 : 11:58:54
DESC is a reserved word in SQL Server (abbreviation for descending) hence the issue. wrapping it within [] will distinguish it as a column name in above case

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -