I have two tables
studentTable
Id | Studentname | Adress
teacherTable
TID | TeacherName | Adress
In studentTable table I have columns Id and in teacherTable I have a column TID, while using dynamic query how do I select the entries regardless of column name.
select ID or PID from @Tablename
does not work, how can I do it, any idea?
The query which I tried:
SELECT + '''' + @TABLE_NAME + '''' + ',' + '''' + @COLUMN_NAME + '''' + ',' + 'ID +
' FROM [' + @TABLE_NAME