Title: 1'1 SQL Server 2005
11.1 SQL Server 2005 ?????????
2Overview
- Using SQL Server Management Studio
- Using SQL Configuration Manager
- Using the sqlcmd Utility
3Lesson Using SQL Server Management Studio
- What Is SQL Server Management Studio?
- How to Register a Server
- What Is Object Explorer?
- How to Execute Transact-SQL Queries
- Demonstration Using Transact-SQL in SQL Server
Management Studio - What Is a SQL Server Management Studio Solution?
- How to Create a SQL Server Management Studio
Solution - Demonstration Creating a Solution with Solution
Explorer
4Lesson Using SQL Configuration Manager
- What Is SQL Configuration Manager?
- Demonstration Using SQL Configuration Manager
- How to Control Services
- How to View and Change Service Properties
- How to Manage Server Network Connectivity
- How to Manage Client Network Connectivity
5Lesson Using the sqlcmd Utility
- What Is the sqlcmd Utility?
- sqlcmd Command-Line Switches
- How to Use the sqlcmd Utility Interactively
- How to Execute Scripts Using the sqlcmd Utility
- How to Use Variables With the sqlcmd Utility
- Demonstration Using Variables with the sqlcmd
Utility - How to Use a Dedicated Administrator Connection
6What Is the sqlcmd Utility?
- Command-line tool for executing Transact-SQL
statements and scripts - Uses OLE DB to run Transact-SQL batches
- Replaces osql
- Enhancements over osql
- Variables
- Query server information
- Passes error information to calling environment
- Dedicated Administrator Connection
- Commands
7How to Use Variables with the sqlcmd Utility
Set sqlcmddbnameadventureworks Sqlcmd 1gtListVar
2gtQuit
Sqlcmd 1gtListVar 2gtQuit
Set colnamename Set tabnamesys.databases Sqlcmd
-i myscript.sql
SELECT (colname) FROM (tabname) GO
Sqlcmd 1gtSetvar DB adventureworksDW 2gtconnect
R20100 1gtbackup database (DB) to
diskc\backup\(DB).bak 2gtgo
8How to Use Variables with the sqlcmd Utility
SELECT (colname) FROM (tabname) GO
sqlcmd i MyScript.sql o MyScript.out v
colname"name" tabname"sys.databases"
9Demonstration Using Variables with the sqlcmd
Utility
- In this demonstration, you will see how to
- Reference variables in a script
- Instantiate variables from the command line
- Use environment variables
10How to Use a Dedicated Administrator Connection
- Useful if the server hangs or is unresponsive
- DAC runs using its own private scheduler
1gt CHECKPOINT 2gt GO 1gt SHUTDOWN WITH NOWAIT 2gt
GO Server shut down by request