You want to execute more than one SQL statement without requiring multiple trips to the server.
Use a batch query, and separate your commands with a semicolon.
Most ADO.NET providers support batch queries, which allow you to execute more than one SQL statement. To create a batch query, you simply separate the SQL statements using a semicolon, as shown here:
SELECT * FROM Products;SELECT * FROM Categories
In this example, both SQL statements are queries. If you to execute this statement using Command.ExecuteReader, you’ll first retrieve the results from the first query (the list of products). Once you have read these results, you’ll need to use the DataReader.NextResult method to move ...