Please help me I am trying to do this:
DECLARE @QUERY NVARCHAR(500) = ' declare @col as nvarchar(50) = ''RoleID''
select @col from tblRole '
EXEC sp_executesql @QUERY
Here RoleID is a column name in tblRole but I am getting result like this:
RoleID
RoleID
RoleID
RoleID
RoleID
RoleID
RoleID
How to read proper data from sql table in this way?