Querying SQL Server

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.

Ad-Hoc Queries

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 ...

Get Developing and Implementing Windows®-Based Applications with Visual C#™ .NET and Visual Studio® .NET Exam Cram™ 2 (Exam 70-316) now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.