Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 error in SQL

Author  Topic 

albertramsbottom
Starting Member

4 Posts

Posted - 2010-07-29 : 04:34:02
According to Windows Script host I have an error in my SQL. Now this sql was written for Oracle originally but I was under the impression that it would still work for MSSQL

Here is the SQL and if anyone can just glance over it to confirm that its ok that would be great

SELECT
DBO.INS_MOD.MOD_CODE AS Code,
DBO.CAM_MAV.MAV_OCCUR AS Occurrence,
DBO.CAM_MAV.PSL_CODE AS Period,
DBO.CAM_MAV.MAV_UDF1 AS Description,
DBO.INS_MOD.MOD_NAME AS Name,
DBO.INS_YPS.YPS_BEGD AS Start_Date,
DBO.INS_YPS.YPS_ENDD AS End_Date,
DBO.CAM_TOP.DPT_CODE,
DBO.INS_DPT.DPT_NAME AS Department
FROM DBO.INS_DPT
INNER JOIN (((DBO.CAM_MAV INNER JOIN DBO.INS_MOD ON DBO.CAM_MAV.MOD_CODE = DBO.INS_MOD.MOD_CODE)
INNER JOIN DBO.INS_YPS ON (DBO.CAM_MAV.AYR_CODE = DBO.INS_YPS.YPS_AYRC) AND (DBO.CAM_MAV.PSL_CODE = DBO.INS_YPS.YPS_PSLC))
INNER JOIN DBO.CAM_TOP ON DBO.INS_MOD.MOD_CODE = DBO.CAM_TOP.MOD_CODE) ON DBO.INS_DPT.DPT_CODE = DBO.CAM_TOP.DPT_CODE
WHERE

DBO.CAM_MAV.AYR_CODE = '10/11' OR
DBO.CAM_MAV.AYR_CODE = '09/10' OR
DBO.CAM_MAV.AYR_CODE = '08/09'


Cheers folks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-29 : 04:54:56
What is the error message?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

albertramsbottom
Starting Member

4 Posts

Posted - 2010-07-29 : 05:31:19
The error msg appears when I try to run the vbs file with wscript

Error line 118

"You have an error in SQL syntax. Check the manual that corrosponds to your MySQL version for the right syntax to use near 'r Cyfryngau"

That word is a welsh word and: is a'r Cyfryngau. Basiically I am connecting to a MSSQL database and then putting the results in a Mysql database. It looks like its failing on the bit where the vbscript file is trying to put it in the mysql database

Cheers
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-29 : 05:59:55
The problem is in the column which contains the value a'r Cyfryngau.
But I am a bit confused...
MS SQL or MySQL?
Building the query inside VB?
Dynamic SQL?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -