OLE BD Source task - Trying to use Data Access mode - SQL as variable = variable in From Clause
Hi All, I'm reading a table for a division name and trying to use that name as the table name for an OLE DB Source task as sql query from variable. The division name is used to build an SQL query to the given division tables (Access 2003 tables). Expression - "Select prop_cd, acct_num, acct_name, acct_type, acct_zip, territory_code, ee_id, mrg_dt, last_updated_date, updated_by FROM " + (dt_wstr,20) @[User::NewMstr] The expression evaluates ok but at run time throws an error. Error - [OLE DB Source [1]] Error: The SQL command requires 1 parameters, but the parameter mapping only has 0 parameters. Values have been pre-set in the variables collection, to pass validation. I have tried hard coding + var, building variable using a script task, no luck same error. This is quite vexing.
March 29th, 2012 5:16pm

What is the content of the NewMstr variable? What data type is it? What does SQL Profiler show when you have it tracing when you try to run the package? (You should see some type of SELECT query issued... even if it is malformed.) Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
March 29th, 2012 5:35pm

Is there a question mark or something like that in the NewMstr variable? Can you show us the evaluated expression of that variable?MCTS, MCITP - Please mark posts as answered where appropriate.
March 30th, 2012 4:15am

Thanks for the interest. The type of the var User:NewMstr is string, with the value "CST_Account_Master". The trace is listed below: sql from EST Select db_name, prop_cd, SourceSQL from property_list OK Next out of script task, declare @p1 nvarchar(64) set @p1=N'C.0.9.45' exec GetDBVersion @DBVersion=@p1 output select @p1 Then FEL containing DFT (OLE DB scr task) declare @BatchID uniqueidentifier set @BatchID = NEWID() UPDATE [Event] WITH (TABLOCKX) SET [BatchID] = @BatchID, [ProcessStart] = GETUTCDATE(), [ProcessHeartbeat] = GETUTCDATE() FROM ( SELECT TOP 8 [EventID] FROM [Event] WITH (TABLOCKX) WHERE [ProcessStart] is NULL ORDER BY [TimeEntered] ) AS t1 WHERE [Event].[EventID] = t1.[EventID] select top 8 E.[EventID], E.[EventType], E.[EventData] from [Event] E WITH (TABLOCKX) where [BatchID] = @BatchID ORDER BY [TimeEntered] And declare @BatchID uniqueidentifier set @BatchID = newid() UPDATE [Notifications] WITH (TABLOCKX) SET [BatchID] = @BatchID, [ProcessStart] = GETUTCDATE(), [ProcessHeartbeat] = GETUTCDATE() FROM ( SELECT TOP 8 [NotificationID] FROM [Notifications] WITH (TABLOCKX) WHERE ProcessStart is NULL and (ProcessAfter is NULL or ProcessAfter < GETUTCDATE()) ORDER BY [NotificationEntered] ) AS t1 WHERE [Notifications].[NotificationID] = t1.[NotificationID] select top 8 -- Notification data N.[NotificationID], N.[SubscriptionID], N.[ActivationID], N.[ReportID], N.[SnapShotDate], N.[DeliveryExtension], N.[ExtensionSettings], N.[Locale], N.[Parameters], N.[SubscriptionLastRunTime], N.[ProcessStart], N.[NotificationEntered], N.[Attempt], N.[IsDataDriven], SUSER_SNAME(Owner.[Sid]), Owner.[UserName], -- Report Data O.[Path], O.[Type], SD.NtSecDescPrimary, N.[Version], Owner.[AuthType] from [Notifications] N with (TABLOCKX) inner join [Catalog] O on O.[ItemID] = N.[ReportID] inner join [Users] Owner on N.SubscriptionOwnerID = Owner.UserID left outer join [SecData] SD on O.[PolicyID] = SD.[PolicyID] AND SD.AuthType = Owner.AuthType where N.[BatchID] = @BatchID ORDER BY [NotificationEntered]
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2012 12:51pm

I don't see where your "Select prop_cd, acct_num, ..." query is. That's the one reporting the error, right? Talk to me now on
March 30th, 2012 2:00pm

I don't see where your "Select prop_cd, acct_num, ..." query is. That's the one reporting the error, right? Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2012 8:51pm

<p>Thanks Todd, I was overthinking the issue.</p><p>The query as an entire var won't work due to the need to hold the ID of the source.</p><p>I only need to put the table name in a var and I'm off to the races.</p><p>Thanks!!!</p>
April 6th, 2012 12:15pm

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

Other recent topics Other recent topics