Need help with update
Hi All, I have a table with the following fields. SERVICEID,DATEOPENED(DATETIME),DATEOPENED_ID(INT). And i have a time DIM with the following fields: ID,PK_Date,Date_Name,Year,Year_Name... In BIDS i opened a PACKAGE and i wanted to populate the field DATEOPENED_ID, with the following query using the EXECUTE SQL TASK Transformation: update dbo.TABLENAME set DATEOPENED_ID = ID from [dbo].DIM_TIME where DATEOPENED = PK_Date GO update dbo.TABLENAME set DATEOPENED_ID= -1 where DATEOPENED_ID is null GO And when i execute the TASK all i see is '-1' in the DATEOPENED_ID field in the NULL instead of ID values from the TIME DIMENSION. Can anyone please tell me where i'm going wrong? Thanks
August 8th, 2012 3:41pm

Very simply I guess the DATEOPENED = PK_Date condition does not materialize, thus you only get all updated to -1 and there is no your fault or SSIS's. Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
August 8th, 2012 3:49pm

Thanks Arthur but when i run the following query to check the dates between the two tables i'm getting data. select t1.*,t2.* from dbo.tablename t1,dbo.DIM_TIME t2 where LTrim(RTrim(t1.dateopened))=LTrim(RTrim(t2.pk_date))
August 8th, 2012 4:04pm

the TRIMs are important, your query in SSIS must be EXACTLY the same to workArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
August 8th, 2012 4:18pm

Thanks i tried and am getting far fewer rows, but will post the results when i execute the task again.
August 8th, 2012 4:20pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics