ChuckLKing
IS-IT--Management
I have a SQL script I have tested in SQL Analyzer successfully but it fails in a data transformation task with an error of invalid pointer. This process evaluates the day of the week and depending on the results set the date in the format CCYYMMDD (20030707). The script follows:
--------------------------------------------------
-- EVALUATE DAY OF WEEK AND SET DATE AS (CCYYMMDD)
USE GLTRANS
DECLARE @DW CHAR(1)
DECLARE @DT CHAR(8)
SET @DW = CAST(datepart(Dw,GETDATE()) as CHAR(1))
--PRINT @DW
IF @DW = '2'
BEGIN
SET @DT = CONVERT(CHAR(50), GETDATE(), 112)-3
END
ELSE
IF @DW = '1'
BEGIN
SET @DT = CONVERT(CHAR(50), GETDATE(), 112)-2
END
ELSE
BEGIN
SET @DT = CONVERT(CHAR(50), GETDATE(), 112)-1
END
SELECT Corporation, Account, Center, [Guarantor number],
[Patient number], [Transaction ID], [Service date], [Posting date],
[Batch number], [AGC code],
[Procedure code],
[Transaction type], Physician, Department, [Financial class],
Location, Amount, Creation_Date
FROM GLTRANS
WHERE (Physician = '0000000') and Creation_Date = @DT
ORDER BY Center
------------------------------------------------------
Any ideas?
Thanks,
Chuck
cking@cntllp.com