lp84
asked on
T-SQL, SQL Server Help
Hi all,
Bit of SQL help here, i'm really stuck been working on this for a couple hours. No idea why i'm getting an error whenever I run this SQL query, using a text driver through an ODBC connection to query a csv file...
Can anyone see anything wrong with my sql?
select payee.*,
payee.AHIRDA+'/'+payee.AHI RMO+'/'+pa yee.AHIRYR AS Date_Of_Hire,
CASE ATRMDA
WHEN 0 THEN '31/12/2999'
ELSE payee.ATRMDA+'/'+payee.ATR MMO+'/'+ payee.ATRMYR
END AS Termination_Date
from
ptaagr0999.csv payee
Any help much appreciated.
I keep getting hte following error:
Syntax error(Missing operator) in query expression
'CASE ATRMDA
WHEN 0 THEN '31/12/2999'
ELSE payee.ATRMDA+'/'+payee.ATR MMO+'/'+ payee.ATRMYR
END'
Thanks a lot..
Bit of SQL help here, i'm really stuck been working on this for a couple hours. No idea why i'm getting an error whenever I run this SQL query, using a text driver through an ODBC connection to query a csv file...
Can anyone see anything wrong with my sql?
select payee.*,
payee.AHIRDA+'/'+payee.AHI
CASE ATRMDA
WHEN 0 THEN '31/12/2999'
ELSE payee.ATRMDA+'/'+payee.ATR
END AS Termination_Date
from
ptaagr0999.csv payee
Any help much appreciated.
I keep getting hte following error:
Syntax error(Missing operator) in query expression
'CASE ATRMDA
WHEN 0 THEN '31/12/2999'
ELSE payee.ATRMDA+'/'+payee.ATR
END'
Thanks a lot..
>using a text driver through an ODBC connection to query a csv file...you cannot do that, the text driver does not support all the MS SQL syntax.you have to load the text file with a plain SELECT * into a local table, and then query from there.this technique is called "staging" ...
Which data type does ATRMDA have?
If it is date and you want to check for NULL you need to use
CASE ATRMDA
WHEN NULL THEN '31/12/2999'
ELSE payee.ATRMDA+'/'+payee.ATR MMO+'/'+ payee.ATRMYR
END AS Termination_Date
If it is date and you want to check for NULL you need to use
CASE ATRMDA
WHEN NULL THEN '31/12/2999'
ELSE payee.ATRMDA+'/'+payee.ATR
END AS Termination_Date
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.