473,387 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

EXEC keyword

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?

Bijoy

Aug 12 '05 #1
3 1754
You can use square brackets as delimiters:

select [EXEC] from ...

See "Delimited Identifiers" and "Using Identifiers" in Books Online for
more information.

Simon

Aug 12 '05 #2
Try

SELECT [ID], [EXEC] FROM Users

Regards
Steen

b_*****@yahoo.ca wrote:
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?

Bijoy

Aug 12 '05 #3
(b_*****@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, es****@sommarskog.se

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

Aug 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jonathan | last post by:
I'm puzzled by Python's behavior when binding local variables which are introduced within exec() or execfile() statements. First, consider this simple Python program: # main.py def f() : x = 1...
1
by: Andr? Roberge | last post by:
I have the following two files: #--testexec.py-- def exec_code(co): try: exec co except: print "error" #-- test.py--
0
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the...
1
by: Carmine | last post by:
I'm getting this error when I submit the job: DSNU000I DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = LOADSQL DSNU005I DSNUGPRS - EXEC SQL DSNU082I DSNUGPRS - INVALID KEYWORD - EXEC...
17
by: comp.lang.tcl | last post by:
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php"...
5
by: TPJ | last post by:
I have the following code: ----------------------------------- def f(): def g(): a = 'a' # marked line 1 exec 'a = "b"' in globals(), locals() print "g: a =", a
2
by: xml0x1a | last post by:
How do I use exec? Python 2.4.3 ---- from math import * G = 1 def d(): L = 1 exec "def f(x): return L + log(G) " in globals(), locals() f(1)
6
by: vasudevram | last post by:
Hi group, Question: Do eval() and exec not accept a function definition? (like 'def foo: pass) ? I wrote a function to generate other functions using something like eval("def foo: ....") but...
4
by: carl.dhalluin | last post by:
Hello I am completely puzzled why the following exec code does not work: mycode = "import math\ndef f(y):\n print math.floor(y)\nf(3.14)" def execute(): exec mycode execute()
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.