I want to make a variable of table in stored procedure to call the data from 3 diffrent tables like
i have the city name in textbox and a dropdown list with the values of tablenames,
I already make a stored procedure:
[dbo].[sp_Search]
@City nvarchar(50) = null
AS
SELECT * FROM PropertyForSale_TBL WHERE (City = @City OR @City IS NULL)
here this is the SP of only for the textbox not for the dropdownlist.
i want a procedure to make the tablename as a variable so when i select the dropdown it calls the data from that table. like as i imagined its works like this maybe....
[dbo].[sp_Search]
@City nvarchar(50) = null,
@Tablename Table (maybe or maybe not i dont know it is not working)
AS
SELECT * FROM @Tablename WHERE (City = @City OR @City IS NULL)
how can i do this?????