![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a stored procedure as follows :- Create Procedure GetNewYear_mnth as Declare @OldYear int, @OldMonth int, @NewYear int, @NewMonth int select @Oldyear=max(uc_year_num) from tprocess_control select @OldMonth=max(UC_MNTH_NUM ) from tprocess_control where uc_year_num=@OldYear If @OldMonth=12 begin set @NewMonth=1 set @NewYear=@OldYear+1 end else if @oldMonth<12 begin set @NewMonth=@OldMonth+1 set @NewYear=@Oldyear end drop table ##month drop table ##year Create table ##month(MonthNumber int) insert into ##month values(@Newmonth) create table ##Year(YearNumber int) insert into ##year values(@Newyear) I want to get the newyear and the newmonth values in a global variable so that i can build a vbscript string in dts. mySqlQuery = "Select count(*) CNT , 'TSLSDALY' TableName , SUM(EXT_HIGH_AMT) AMT,'InProcess' as Status From CDDBA.TSLSDALY WHERE UC_mnth < '" & @Newmonth & "'UC_YR < '" & @NewYear & "'UC AND Rpt_div_id in (1,2,3,4,5,6,7,14,16,35) " .. How can i do this? Thanks Ajay garg |
![]() |
| Thread Tools | |
| Display Modes | |
| |