SQL Statement in SSIS Expression Builder
Hi Guys, i have build more then 100 pacakges and now i want to put the update statement on each package, execute sql expression.which is the minmal way to change on the packge to add the update statement.there are few other sql statement after this update. is it possible to add the SQL statemtn like following in the execute sql expression? it should be possible becuase we are writing the sam sort of SQL in the SQLStatement property of the execute sql task without the expression. Note: following excerpt is working fine if i remove the select top 1.... statement . " UPDATE Table SET fld1 = 2 , fld2= GETDATE() , fld3 = ( " + select Top 1 ctrl_ODS_Batch_ID FROM dbo.SYN_ODS_Dim_Cost_Centre order by 1 + ")WHERE fld4 =" + (dt_STR,100,1252) @[User::i] i am getting the following error when i am evaluting the expression: The expression might contain an invalid token, an incomplete token, or an invalid element. It might not be well-formed, or might be missing part of a required element such as a parenthesis. (Microsoft.DataTransformationServices.Controls) thanks, Zaim Raza
May 27th, 2012 10:24pm

try to give space before where clause " UPDATE Table SET fld1 = 2 , fld2= GETDATE() , fld3 = ( " + select Top 1 ctrl_ODS_Batch_ID FROM dbo.SYN_ODS_Dim_Cost_Centre order by 1 + ") WHERE fld4 =" + (dt_STR,100,1252) @[User::i] ESHANI. Please click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2012 10:41pm

still gettting the same error :(
May 27th, 2012 10:51pm

All looks OK try storing the typecasting as well in the varaible as in (dt_STR,100,1252) @[User::i] [User::i] = (dt_STR,100,1252)<Your Values>Abhinav
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2012 11:45pm

Problem here is that the sub-query portion is not within quotes. Try this: " UPDATE Table SET fld1 = 2 , fld2= GETDATE() , fld3 = ( SELECT Top 1 ctrl_ODS_Batch_ID FROM dbo.SYN_ODS_Dim_Cost_Centre order by 1 ) WHERE fld4 =" + (dt_STR,100,1252) @[User::i] In fact if fld4 contains alphanumeric data, you will probably need to use single quotes as well: " UPDATE Table SET fld1 = 2 , fld2= GETDATE() , fld3 = ( SELECT Top 1 ctrl_ODS_Batch_ID FROM dbo.SYN_ODS_Dim_Cost_Centre order by 1 ) WHERE fld4 ='" + (dt_STR,100,1252) @[User::i] + "'"
May 28th, 2012 6:25am

Problem here is that the sub-query portion is not within quotes. Try this: " UPDATE Table SET fld1 = 2 , fld2= GETDATE() , fld3 = ( SELECT Top 1 ctrl_ODS_Batch_ID FROM dbo.SYN_ODS_Dim_Cost_Centre order by 1 ) WHERE fld4 =" + (dt_STR,100,1252) @[User::i] In fact if fld4 contains alphanumeric data, you will probably need to use single quotes as well: " UPDATE Table SET fld1 = 2 , fld2= GETDATE() , fld3 = ( SELECT Top 1 ctrl_ODS_Batch_ID FROM dbo.SYN_ODS_Dim_Cost_Centre order by 1 ) WHERE fld4 ='" + (dt_STR,100,1252) @[User::i] + "'"
Free Windows Admin Tool Kit Click here and download it now
May 28th, 2012 6:28am

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

Other recent topics Other recent topics