Hi all,
I have created the sp below and for some reason it will not allow me to create the SP because it says that i have a syntax error near @UsedToCal.
I am relatively new at stored procedures and i can't seem to figure out why this is happening, any ideas?
The code is as follows:
Create Procedure......
@PersonID int,
@UsedToCal int,
@OldestDate DateTime,
@Average decimal output
AS
SELECT @Average = avg(HD) FROM (SELECT TOP @UsedToCal HD FROM Mytable Where PersonID = @PersonID and Date>= @OldestDate) B
GO
thanks in advance for any help.
mtl77
I have created the sp below and for some reason it will not allow me to create the SP because it says that i have a syntax error near @UsedToCal.
I am relatively new at stored procedures and i can't seem to figure out why this is happening, any ideas?
The code is as follows:
Create Procedure......
@PersonID int,
@UsedToCal int,
@OldestDate DateTime,
@Average decimal output
AS
SELECT @Average = avg(HD) FROM (SELECT TOP @UsedToCal HD FROM Mytable Where PersonID = @PersonID and Date>= @OldestDate) B
GO
thanks in advance for any help.
mtl77