SQL Server - select into from statement? -
i have query in sql server:
select column table_53;
now, want 53 table, want this:
select column table_(select id table2);
is there way in sql server?
you need dynamic sql query here.
declare @sqlquery = 'select column table_('; set @sqlquery = @sqlquery + 'select id table2)'; exec (@sqlquery)
note :- 1 of cons of using dynamic sql query sql injection. suggest have better table structure or try used parameterized query.
Comments
Post a Comment