Page 1 of 1

aborting job while executing the select statement

Posted: Wed Oct 21, 2009 9:12 am
by deesh
SELECT
`A`.`A Key` AS A_Key,
`A`.`E Key` AS E_Key,
`A`.ID
FROM
dbo.`A`
I am trying above query in ODBC connector but its giving bellow error, please can clarify any one


[IIS-CONN-ODBC-000004] ODBC function {0} reported: SQLSTATE = 42000: Native Error Code = 102: Msg = [IBM (DataDirect OEM)][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '`'.

Posted: Wed Oct 21, 2009 9:55 am
by chulett
First try using single quotes (') rather than that accent mark (`).

Posted: Wed Oct 21, 2009 9:55 pm
by deesh
I tried with single quote its giving below error.

[IIS-CONN-ODBC-000004] ODBC function {0} reported: SQLSTATE = 42000: Native Error Code = 102: Msg = [IBM (DataDirect OEM)][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'Key'.

Posted: Wed Oct 21, 2009 10:32 pm
by ray.wurlod
What happens when you let DataStage generate the SQL based on the table definition you have imported?

Posted: Thu Oct 22, 2009 4:00 am
by HariK
I have never worked on SQL server. But the question is, is it possible to have spaces in column identifiers ('A Key') in SQL Server?

Posted: Thu Oct 22, 2009 6:52 am
by chulett
ODBC doesn't support them, from what I recall. For Access you'd need to put square brackets around them, perhaps the same would work here?

Posted: Fri Oct 23, 2009 2:33 am
by deesh
thanx for your help and with the " [ ] " brackets my problem has solved
chulett wrote:ODBC doesn't support them, from what I recall. For Access you'd need to put square brackets around them, perhaps the same would work here? ...