Simple question about SQL Server 2808.
View1:
Select name from sys.tables where name like 'ab%'
Result:
Name
----
ab01
ab02
abxyz etc...
Now I want to query over those tables.
Select * from view1
Of course I get ab01, ab02, abxyz. What I want is to query over the content
select * from ab01, ab02, abxyz
best of all would by to use union over the view1 query
Something like
Union view1
would be something like
Select * from ab01
union
select * from ab02
....
any ideas?
Greets
Use a cursor.
Create a temporary table.
Loop through the cursor and add the results to the temporary table.
Select all from temporary table.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.