Monday, June 2, 2008

DB Snapshot

A database snapshot is a read-only, static view of a database, called the source database. In Microsoft SQL Server 2005, you use SQL Server 2005 statements for creating, reverting to, and deleting a database snapshot. However, you can use SQL Server Management Studio to view existing database snapshots.

Example
CREATE DATABASE DAT_SS ON
( NAME = DAT, FILENAME =
'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DAT_SS.ss' )
AS SNAPSHOT OF DAT;

Connecting to a named instance by using SQLCMD command prompt in Windows Authentication and specifying input and output files

Connecting to a named instance by using SQLCMD command prompt in Windows Authentication and specifying input and output files:

sqlcmd -S \ -i -o

we can execute following command

sqlcmd -S 2282-h9-ing\RAj_LOCAL_SERVER -i SQLQuery1.sql -o result.rpt

where result.rpt , SQLQuery1.sql , SQLCMD utility all are at following location

C:\Program Files\Microsoft SQL Server\90\Tools\Binn

Following link is useful
http://msdn.microsoft.com/en-us/library/ms180944.aspx