You are here: Re: EXEC keyword « MsSQL Server « IT news, forums, messages
Re: EXEC keyword

Posted by Erland Sommarskog on 08/12/05 17:49

(b_naick@yahoo.ca) writes:
> I am in the process of importing an Oracle database into SQL Server.
> Once of the tables has a field called "EXEC".
>
> SQL Server seems to reject any queries that include that particular
> field because EXEC is a keyword. For eg.
>
> SELECT ID, EXEC from USERS
>
> results in a syntax error near keyword EXEC.
>
> I can't change the fieldname becuase it will require reworking of a
> whole bunch of scripts.
>
> What can I do to adjust the query?

Rather than using [] as suggested in other posts, "" may be better.

SELECT ID, "EXEC" FROM USERS

[] is usually preferred on SQL Server. However, that is proprietary syntax,
whereas quoting with "" is ANSI-compliant, and may thus work on Oracle as
well.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация