How to run if procedure parameter is also parameter

Viewed 26

How to run if procedure parameter is also a parameter

I declare August as @aug like this

DECLARE @aug AS Date
SET @aug = DATEFROMPARTS(YEAR(GETDATE()), 8, 1)

--test
PRINT @aug
PRINT(EOMONTH(@aug))

Then I run like this

EXEC [sp_get_medal] 'EP003', @aug, '08-31-2022', 'corporate','PTTU'   

--> This is working

EXEC [sp_get_medal] 'EP003', @aug, EOMONTH(@aug), 'corporate', 'PTTU'   

--> however this is not working

I got this error:

Msg 102, Level 15, State 1, Line 9
Incorrect syntax near '@aug'

0 Answers
Related