I have created dynamic dataset, but I am not able to go forward with the parameterName comparison in the dataset.
declare @tableName varchar(100);
SELECT
[Name] as column1
,[Definition] as column2
,'View' as column3
FROM @tableName
union all
SELECT
[DayOfWeek] as column1
,[MonthName] as column2
,'common' as column3
FROM @tableName
So, this SQL works perfectly fine if I hardcode the tableName but when I pass parameter, it breaks. also, See the column3, this column actually differentiates the dataset based on the schema name, so that I can compare this schema name from a resultset(dataset) and then based on the @tableName parameter I should be able to select data for only one table.
So, I have two problems 1. Passing a dynamic tableName as parameter 2. comparing this ParameterName in the where Clause to select specific data from my dynamic dataset. Please help me.