creating variables in a Stored procedure
I would like to know if I can create new variables using existing variables in a stored procedure.
To be clear, in the SP I use, I pass table name. But I need the results from 2 other tables as well.
The tables are named 1996, 1997, 1998.......2007.
If I pass 2005 to SP, I need results from 2005, 2004 & 2003. How do I assign or get 2 new table names (variables) for 2004 & 2003 ??
Part of code:
ALTER Procedure [dbo].[XX](
when I pass 2005 to SP, I need
@TblName1 = 2005
@TblName2 = 2004
@TblName3 = 2003
How can assign 2004 & 2003 to variables TblName2 & Tblname3 ??
I really appreciate any help.