|
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]
|