Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SP Dynamic Update

Author  Topic 

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2014-09-22 : 13:42:54
Hi -

I set up a stored procedure. My stored procedure has 8 variables declared at the beginning like this:
===========================
declare @IncurredDateStart smalldatetime
, @IncurredDateEnd smalldatetime
, @PaidDateStart_CU smalldatetime
, @PaidDateEnd_CU smalldatetime
, @PaidDateStart smalldatetime
, @PaidDateEnd smalldatetime
, @RptMoBegin smalldatetime
, @RptMoEnd smalldatetime

set @IncurredDateStart = '08/01/2013'
set @IncurredDateEnd = '07/31/2014'
set @PaidDateStart_CU = '10/01/2013'
set @PaidDateEnd_CU = '09/30/2014'
set @PaidDateStart = '10/01/2013'
set @PaidDateEnd = '09/30/2014'
set @RptMoBegin = '10/01/2013'
set @RptMoEnd = '09/30/2014'
===========================
All of these dates are based on the update of our data warehouse. This stored procedure runs a 5 step process and produces data for 8 - 10 monthly reports.

I was wondering if these variables can be updated dynamically and if they can how it is done.

I have no idea, please help.....

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2014-09-22 : 14:41:43
You could pass them in as variables.

djj
Go to Top of Page

ScottPletcher
Aged Yak Warrior

550 Posts

Posted - 2014-09-22 : 17:43:29
I suggest creating a table, keyed by an identity, that contains all the params to be used. Then you can pass in just an id to specify the full list of parameters to use, even when(if?) you need to add param(s) in the future.
Go to Top of Page

ScottPletcher
Aged Yak Warrior

550 Posts

Posted - 2014-09-22 : 17:43:30
I suggest creating a table, keyed by an identity, that contains all the params to be used. Then you can pass in just an id to specify the full list of parameters to use, even when(if?) you need to add param(s) in the future.
Go to Top of Page
   

- Advertisement -