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

Popular posts from this blog

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -