DataGirl
DataGirl

Reputation: 449

SQL Server 2005 Run a stored procedure via SSIS using GETDATE() as a Parameter

I've been searching for an answer to this and I can't find it. I want to set up an SSIS package using Visual Studio 2005 and SQL Server 2005 that will send today's date (GETDATE())as the parameter to a stored procedure. I can find how to send a parameter, but not how to declare that parameter to be GETDATE(). Is this even possible?

Upvotes: 1

Views: 2381

Answers (2)

Joe Stefanelli
Joe Stefanelli

Reputation: 135868

One possible workaround to consider. You could make GETDATE() the default value for the parameter in the stored procedure and then call it without that parameter.

CREATE PROCEDURE YourProc 
    @InputDate DATETIME = GETDATE()
AS
...

Upvotes: 2

billinkc
billinkc

Reputation: 61249

If you need a constantly evaluating time, like GETDATE() then, create a Variable in SSIS called GetDate with a Data Type of DateTime. Right click and on the properties window, check the EvaluateAsExpression = True and for the Expression, use GETDATE()

Now wire that variable up to the Execute SQL Task.

If you don't need this very moment, look at using one of the system scoped variables. The ContainerStartTime of the Execute SQL Task would probably suffice. My go to value is the StartTime as that's when the package started execution but you'll know best which one is right for you.

Upvotes: 3

Related Questions