T-SQL statements are used to manipulate the data present within an SQL Server database. These commands can be passed in an ad-hoc manner to the server or can be compiled as stored procedures on the server itself. The advantage of using stored procedures is that they are faster than ad-hoc queries. The disadvantage of stored procedures is that they are not as flexible as ad-hoc queries, which can be created within your application at runtime.
Microsoft provides several methods to allow you to execute ad-hoc queries:
Visual Studio .NET IDE— Using the Server Explorer, you can create a new view within the Views folder of a Data Connection object. When you run this query, the results are displayed.
OSQL— This command-line ...