SQL Book

SQL Server at SQL Book

SQL Server Command Line utilities

This section demonstrates some useful command line utilities that come with SQL Server that enable powerful queries, statistics and commands to be run without using Enterprise manager or SSMS.

Using the tablediff command line utility in SQL Server
The tablediff command line utitlity provides us with the ability to compare the content of two tables in a database and can tell us which rows and columns are different.

Using the SQLCMD command line utility for SQL SERVER
sqlcmd gives us the functionality (and more) of the osql and isql command line utitlities that were present in SQL 2000 but have now been deprecated. It can also connect to previous versions of SQL Server such as SQL Server 2000.


Miscellaneous

Useful articles that can help solve SQL Server problems.

Move a database using the ALTER DATABASE statement in SQL Server 2005
Demonstrates a new feature of SQL Server 2005 - how to move a database using the ALTER DATABASE statement. This enables the physical location of the database file and transaction log to be changed using a TSQL command.

Formatting dates in SQL Server
This article identifies issues that should be addressed when working with dates in SQL Server and gives examples of how dates can be formatted to the required format.

DDL Triggers in SQL Server - audit database objects
This article demonstrates how DDL triggers can be used to a) audit changes made to database objects using the EventData function and b) control schema changes using the ROLLBACK command.

SQL Merge - a standard SQL statement for more elegant queries
The SQL Merge statement is an official SQL standard (introduced in SQL: 2003 - the 5th version of the SQL standard) that enables UPDATE, INSERT and DELETE statements to be combined into one easy to use statement.


Writing Stored Procedures

Stored Procedures have the benefits of centralising your SQL code, providing protection from SQL Injection attacks, having pre-compiled execution plans and much more. Find out how to write Stored Procedures in this section.

SQL Script to automatically generate CRUD Stored Procedures
Speed up development by automatically generating commmon stored procedure definitions. The script provided in this article autogenerates Stored Procedure definitions for SELECT, INSERT, UPDATE and DELETE queries.

Why use Stored Procedures?
Using Stored Procedures gives us many benefits. In this article we will outline why we should be aiming to use Stored Procedures to enable our web and windows applications to interact with our SQL Server database.




Tell a friend about this page