geraldjr30b
Programmer
hi. i have something like
Declare @today2 date
Set @today2 = MSPRunDate
Declare @datadate2 date
Set @datadate2 = (Select max(DateId)
From tablename (nolock)
Where BusinessDay = 'Y'
and DateId = @today2)
Declare @EOM2 date
set @EOM2 =
(SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@datadate2)+1,0)))
declare @BUSdaysremCURR2 int
set @BUSdaysremCURR2 =
(select count(*)-1
from
tablename
where dateid between @datadate2 and @EOM2
and BusinessDay = 'Y')
select
column,
column,
@today2 = EERunDate, --this variable is to be determined by the EERunDate for each record
@BUSdaysremCURR2 , --want this to be determined by looking at a column value and calculated by subtracting 2 dates in each record.
EOM2 ,
column,
column,
column,
column,
column,
column,
[column],
Ownership2,
...
i want the variables to change depending on the row of the query results. Please help.
Thanks
Declare @today2 date
Set @today2 = MSPRunDate
Declare @datadate2 date
Set @datadate2 = (Select max(DateId)
From tablename (nolock)
Where BusinessDay = 'Y'
and DateId = @today2)
Declare @EOM2 date
set @EOM2 =
(SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@datadate2)+1,0)))
declare @BUSdaysremCURR2 int
set @BUSdaysremCURR2 =
(select count(*)-1
from
tablename
where dateid between @datadate2 and @EOM2
and BusinessDay = 'Y')
select
column,
column,
@today2 = EERunDate, --this variable is to be determined by the EERunDate for each record
@BUSdaysremCURR2 , --want this to be determined by looking at a column value and calculated by subtracting 2 dates in each record.
EOM2 ,
column,
column,
column,
column,
column,
column,
[column],
Ownership2,
...
i want the variables to change depending on the row of the query results. Please help.
Thanks