Working on a large Report that has 76 queries of demographics on a quartly basis.
I don't want to requery a quarter if it is completed so we
only recalculate the current quarter and write it to a table that has these columns,
Year, Quarter1,Quarter2,Quarter3,Quarter4,ID
I need help with a dynaminic query that will update the appropriate quarter.
Declare @FieldToUpdate nvarchar(10),@CurYear datetime,
@QtrCnt int
Set @CurYear=getdate()
Set @QtrCnt=15-- result of 1 of 76 queries
Set @FieldToUpdate ='Quarter'+Convert(varchar(1),datepart(qq,@CurYear))
Set @ID=3 -- Really the 1 of 76 queries i'm running
Here is the dynaminic query I need help with. I tried adding the parameters and commas but keept getting errors.
Update mytable set @FieldToUpdate = @QtrCnt where id = @ID
I read Sunl7 FAQ but it doesn't cover multiple params.
Thanks
MikeD
I don't want to requery a quarter if it is completed so we
only recalculate the current quarter and write it to a table that has these columns,
Year, Quarter1,Quarter2,Quarter3,Quarter4,ID
I need help with a dynaminic query that will update the appropriate quarter.
Declare @FieldToUpdate nvarchar(10),@CurYear datetime,
@QtrCnt int
Set @CurYear=getdate()
Set @QtrCnt=15-- result of 1 of 76 queries
Set @FieldToUpdate ='Quarter'+Convert(varchar(1),datepart(qq,@CurYear))
Set @ID=3 -- Really the 1 of 76 queries i'm running
Here is the dynaminic query I need help with. I tried adding the parameters and commas but keept getting errors.
Update mytable set @FieldToUpdate = @QtrCnt where id = @ID
I read Sunl7 FAQ but it doesn't cover multiple params.
Thanks
MikeD