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.
Author |
Topic |
friscapjtn
Starting Member
8 Posts |
Posted - 2009-08-19 : 06:16:02
|
help me plis,how to make a store procedure with input parameter = as of date fromthe simple script in Juli 2009:select top 25 vof_os_ar.*, gencustomer.sandiekonomi from vof_os_ar inner join gencustomer on vof_os_ar.custid=gencustomer.custidwhere asofdate='2009/07/31' andLEFT(BATCHREF,4) IN ('Self','AKIT','SHIN','BNI/','RESO', 'VICTORIA LOAN') order by osph desclike passing parameter with month and year, I must find the last day of month and then I will must passing to store procedures that will I try to make.Hmmm.... |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-19 : 06:50:01
|
declare @month_year varchar(10)set @month_year='july 2009'select top 25 vof_os_ar.*, gencustomer.sandiekonomi from vof_os_ar inner join gencustomer on vof_os_ar.custid=gencustomer.custidwhere asofdate=dateadd(month,1,@month_year)-1 andLEFT(BATCHREF,4) IN ('Self','AKIT','SHIN','BNI/','RESO', 'VICTORIA LOAN') order by osph descMadhivananFailing to plan is Planning to fail |
|
|
friscapjtn
Starting Member
8 Posts |
Posted - 2009-08-19 : 06:56:58
|
@madhivanancreate procedure vof_generatedeclare @month_year varchar(10)set @month_year='july 2009'asselect top 25 vof_os_ar.*, gencustomer.sandiekonomi from vof_os_ar inner joingencustomer on vof_os_ar.custid=gencustomer.custidwhere asofdate=dateadd(month,1,@month_year)-1 andLEFT(BATCHREF,4) IN ('Self','AKIT','SHIN','BNI/','RESO', 'VICTORIA LOAN')order by osph descare you mean that?but I want passing parameter with other month and year not only july 2009.Pliss help meHmmm.... |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-19 : 07:28:38
|
[code]create procedure vof_generate( @month_year varchar(10))asselect top 25 vof_os_ar.*, gencustomer.sandiekonomi from vof_os_ar inner joingencustomer on vof_os_ar.custid=gencustomer.custidwhere asofdate=dateadd(month,1,@month_year)-1 andLEFT(BATCHREF,4) IN ('Self','AKIT','SHIN','BNI/','RESO', 'VICTORIA LOAN')order by osph desc[/code]GOMadhivananFailing to plan is Planning to fail |
|
|
friscapjtn
Starting Member
8 Posts |
Posted - 2009-08-19 : 07:50:10
|
i'm sorry, but i didn't find the result when i execute them.May be you can show me the result.regards,friscapjtnHmmm.... |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-19 : 08:19:01
|
After creating the procedure, execute itEXEC vof_generate 'july 2009'MadhivananFailing to plan is Planning to fail |
|
|
|
|
|
|
|