I am trying to pass a date to the ODBC user defined sql delete statement listed below from my job but it is deleting the entire table instead of only the records that meet the date criteria. If I hard code the date of 10/01/2010 in the delete statement, it works fine. Any assistance would be greatly appreciated. I have my job param defined as a Date but have also tried string. The Field in the SQL table is defined as datetime.
DELETE UHCDATA.COMORBIDITY_DEV
FROM
(SELECT C.RECORDID, C.UNIVCODE, C.DATABASEID
FROM UHCDATA.ENCOUNTER A, CAPMGT.DATES B, UHCDATA.COMORBIDITY_DEV C
WHERE A.RECORD_ID = C.RECORDID
AND A.UNIV_CODE = C.UNIVCODE
AND A.DATABASE_ID = C.DATABASEID
AND A.DISCHARGEDATE = B.DATE_ID
AND B.FULL_DATE >= #Start_Date#) D
WHERE
D.RECORDID = UHCDATA.COMORBIDITY_DEV.RECORDID
AND D.UNIVCODE = UHCDATA.COMORBIDITY_DEV.UNIVCODE
AND D.DATABASEID = UHCDATA.COMORBIDITY_DEV.DATABASEID
Thank you.
Passing Date Param from Job to ODBC User-Defined SQL Delete
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 51
- Joined: Tue Feb 05, 2002 3:06 pm
Re: Passing Date Param from Job to ODBC User-Defined SQL Del
Try putting double quotes around the parameter.AND B.FULL_DATE >= "#Start_Date#")
Re: Passing Date Param from Job to ODBC User-Defined SQL Del
Try putting double quotes around the parameter.AND B.FULL_DATE >= "#Start_Date#")
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 51
- Joined: Tue Feb 05, 2002 3:06 pm