- SQL Server Reference Guide
- Introduction
- SQL Server Reference Guide Overview
- Table of Contents
- Microsoft SQL Server Defined
- SQL Server Editions
- SQL Server Access
- Informit Articles and Sample Chapters
- Online Resources
- Microsoft SQL Server Features
- SQL Server Books Online
- Clustering Services
- Data Transformation Services (DTS) Overview
- Replication Services
- Database Mirroring
- Natural Language Processing (NLP)
- Analysis Services
- Microsot SQL Server Reporting Services
- XML Overview
- Notification Services for the DBA
- Full-Text Search
- SQL Server 2005 - Service Broker
- Using SQL Server as a Web Service
- SQL Server Encryption Options Overview
- SQL Server 2008 Overview
- SQL Server 2008 R2 Overview
- SQL Azure
- The Utility Control Point and Data Application Component, Part 1
- The Utility Control Point and Data Application Component, Part 2
- Microsoft SQL Server Administration
- The DBA Survival Guide: The 10 Minute SQL Server Overview
- Preparing (or Tuning) a Windows System for SQL Server, Part 1
- Preparing (or Tuning) a Windows System for SQL Server, Part 2
- Installing SQL Server
- Upgrading SQL Server
- SQL Server 2000 Management Tools
- SQL Server 2005 Management Tools
- SQL Server 2008 Management Tools
- SQL Azure Tools
- Automating Tasks with SQL Server Agent
- Run Operating System Commands in SQL Agent using PowerShell
- Automating Tasks Without SQL Server Agent
- Storage – SQL Server I/O
- Service Packs, Hotfixes and Cumulative Upgrades
- Tracking SQL Server Information with Error and Event Logs
- Change Management
- SQL Server Metadata, Part One
- SQL Server Meta-Data, Part Two
- Monitoring - SQL Server 2005 Dynamic Views and Functions
- Monitoring - Performance Monitor
- Unattended Performance Monitoring for SQL Server
- Monitoring - User-Defined Performance Counters
- Monitoring: SQL Server Activity Monitor
- SQL Server Instances
- DBCC Commands
- SQL Server and Mail
- Database Maintenance Checklist
- The Maintenance Wizard: SQL Server 2000 and Earlier
- The Maintenance Wizard: SQL Server 2005 (SP2) and Later
- The Web Assistant Wizard
- Creating Web Pages from SQL Server
- SQL Server Security
- Securing the SQL Server Platform, Part 1
- Securing the SQL Server Platform, Part 2
- SQL Server Security: Users and other Principals
- SQL Server Security – Roles
- SQL Server Security: Objects (Securables)
- Security: Using the Command Line
- SQL Server Security - Encrypting Connections
- SQL Server Security: Encrypting Data
- SQL Server Security Audit
- High Availability - SQL Server Clustering
- SQL Server Configuration, Part 1
- SQL Server Configuration, Part 2
- Database Configuration Options
- 32- vs 64-bit Computing for SQL Server
- SQL Server and Memory
- Performance Tuning: Introduction to Indexes
- Statistical Indexes
- Backup and Recovery
- Backup and Recovery Examples, Part One
- Backup and Recovery Examples, Part Two: Transferring Databases to Another System (Even Without Backups)
- SQL Profiler - Reverse Engineering An Application
- SQL Trace
- SQL Server Alerts
- Files and Filegroups
- Partitioning
- Full-Text Indexes
- Read-Only Data
- SQL Server Locks
- Monitoring Locking and Deadlocking
- Controlling Locks in SQL Server
- SQL Server Policy-Based Management, Part One
- SQL Server Policy-Based Management, Part Two
- SQL Server Policy-Based Management, Part Three
- Microsoft SQL Server Programming
- An Outline for Development
- Database
- Database Services
- Database Objects: Databases
- Database Objects: Tables
- Database Objects: Table Relationships
- Database Objects: Keys
- Database Objects: Constraints
- Database Objects: Data Types
- Database Objects: Views
- Database Objects: Stored Procedures
- Database Objects: Indexes
- Database Objects: User Defined Functions
- Database Objects: Triggers
- Database Design: Requirements, Entities, and Attributes
- Business Process Model Notation (BPMN) and the Data Professional
- Business Questions for Database Design, Part One
- Business Questions for Database Design, Part Two
- Database Design: Finalizing Requirements and Defining Relationships
- Database Design: Creating an Entity Relationship Diagram
- Database Design: The Logical ERD
- Database Design: Adjusting The Model
- Database Design: Normalizing the Model
- Creating The Physical Model
- Database Design: Changing Attributes to Columns
- Database Design: Creating The Physical Database
- Database Design Example: Curriculum Vitae
- NULLs
- The SQL Server Sample Databases
- The SQL Server Sample Databases: pubs
- The SQL Server Sample Databases: NorthWind
- The SQL Server Sample Databases: AdventureWorks
- The SQL Server Sample Databases: Adventureworks Derivatives
- UniversalDB: The Demo and Testing Database, Part 1
- UniversalDB: The Demo and Testing Database, Part 2
- UniversalDB: The Demo and Testing Database, Part 3
- UniversalDB: The Demo and Testing Database, Part 4
- Getting Started with Transact-SQL
- Transact-SQL: Data Definition Language (DDL) Basics
- Transact-SQL: Limiting Results
- Transact-SQL: More Operators
- Transact-SQL: Ordering and Aggregating Data
- Transact-SQL: Subqueries
- Transact-SQL: Joins
- Transact-SQL: Complex Joins - Building a View with Multiple JOINs
- Transact-SQL: Inserts, Updates, and Deletes
- An Introduction to the CLR in SQL Server 2005
- Design Elements Part 1: Programming Flow Overview, Code Format and Commenting your Code
- Design Elements Part 2: Controlling SQL's Scope
- Design Elements Part 3: Error Handling
- Design Elements Part 4: Variables
- Design Elements Part 5: Where Does The Code Live?
- Design Elements Part 6: Math Operators and Functions
- Design Elements Part 7: Statistical Functions
- Design Elements Part 8: Summarization Statistical Algorithms
- Design Elements Part 9:Representing Data with Statistical Algorithms
- Design Elements Part 10: Interpreting the Data—Regression
- Design Elements Part 11: String Manipulation
- Design Elements Part 12: Loops
- Design Elements Part 13: Recursion
- Design Elements Part 14: Arrays
- Design Elements Part 15: Event-Driven Programming Vs. Scheduled Processes
- Design Elements Part 16: Event-Driven Programming
- Design Elements Part 17: Program Flow
- Forming Queries Part 1: Design
- Forming Queries Part 2: Query Basics
- Forming Queries Part 3: Query Optimization
- Forming Queries Part 4: SET Options
- Forming Queries Part 5: Table Optimization Hints
- Using SQL Server Templates
- Transact-SQL Unit Testing
- Index Tuning Wizard
- Unicode and SQL Server
- SQL Server Development Tools
- The SQL Server Transact-SQL Debugger
- The Transact-SQL Debugger, Part 2
- Basic Troubleshooting for Transact-SQL Code
- An Introduction to Spatial Data in SQL Server 2008
- Performance Tuning
- Performance Tuning SQL Server: Tools and Processes
- Performance Tuning SQL Server: Tools Overview
- Creating a Performance Tuning Audit - Defining Components
- Creating a Performance Tuning Audit - Evaluation Part One
- Creating a Performance Tuning Audit - Evaluation Part Two
- Creating a Performance Tuning Audit - Interpretation
- Creating a Performance Tuning Audit - Developing an Action Plan
- Understanding SQL Server Query Plans
- Performance Tuning: Implementing Indexes
- Performance Monitoring Tools: Windows 2008 (and Higher) Server Utilities, Part 1
- Performance Monitoring Tools: Windows 2008 (and Higher) Server Utilities, Part 2
- Performance Monitoring Tools: Windows System Monitor
- Performance Monitoring Tools: Logging with System Monitor
- Performance Monitoring Tools: User Defined Counters
- General Transact-SQL (T-SQL) Performance Tuning, Part 1
- General Transact-SQL (T-SQL) Performance Tuning, Part 2
- General Transact-SQL (T-SQL) Performance Tuning, Part 3
- Performance Monitoring Tools: An Introduction to SQL Profiler
- Performance Tuning: Introduction to Indexes
- Performance Monitoring Tools: SQL Server 2000 Index Tuning Wizard
- Performance Monitoring Tools: SQL Server 2005 Database Tuning Advisor
- Performance Monitoring Tools: SQL Server Management Studio Reports
- Performance Monitoring Tools: SQL Server 2008 Activity Monitor
- The SQL Server 2008 Management Data Warehouse and Data Collector
- Performance Monitoring Tools: Evaluating Wait States with PowerShell and Excel
- Practical Applications
- Choosing the Back End
- The DBA's Toolbox, Part 1
- The DBA's Toolbox, Part 2
- Scripting Solutions for SQL Server
- Building a SQL Server Lab
- Using Graphics Files with SQL Server
- Enterprise Resource Planning
- Customer Relationship Management (CRM)
- Building a Reporting Data Server
- Building a Database Documenter, Part 1
- Building a Database Documenter, Part 2
- Data Management Objects
- Data Management Objects: The Server Object
- Data Management Objects: Server Object Methods
- Data Management Objects: Collections and the Database Object
- Data Management Objects: Database Information
- Data Management Objects: Database Control
- Data Management Objects: Database Maintenance
- Data Management Objects: Logging the Process
- Data Management Objects: Running SQL Statements
- Data Management Objects: Multiple Row Returns
- Data Management Objects: Other Database Objects
- Data Management Objects: Security
- Data Management Objects: Scripting
- Powershell and SQL Server - Overview
- PowerShell and SQL Server - Objects and Providers
- Powershell and SQL Server - A Script Framework
- Powershell and SQL Server - Logging the Process
- Powershell and SQL Server - Reading a Control File
- Powershell and SQL Server - SQL Server Access
- Powershell and SQL Server - Web Pages from a SQL Query
- Powershell and SQL Server - Scrubbing the Event Logs
- SQL Server 2008 PowerShell Provider
- SQL Server I/O: Importing and Exporting Data
- SQL Server I/O: XML in Database Terms
- SQL Server I/O: Creating XML Output
- SQL Server I/O: Reading XML Documents
- SQL Server I/O: Using XML Control Mechanisms
- SQL Server I/O: Creating Hierarchies
- SQL Server I/O: Using HTTP with SQL Server XML
- SQL Server I/O: Using HTTP with SQL Server XML Templates
- SQL Server I/O: Remote Queries
- SQL Server I/O: Working with Text Files
- Using Microsoft SQL Server on Handheld Devices
- Front-Ends 101: Microsoft Access
- Comparing Two SQL Server Databases
- English Query - Part 1
- English Query - Part 2
- English Query - Part 3
- English Query - Part 4
- English Query - Part 5
- RSS Feeds from SQL Server
- Using SQL Server Agent to Monitor Backups
- Reporting Services - Creating a Maintenance Report
- SQL Server Chargeback Strategies, Part 1
- SQL Server Chargeback Strategies, Part 2
- SQL Server Replication Example
- Creating a Master Agent and Alert Server
- The SQL Server Central Management System: Definition
- The SQL Server Central Management System: Base Tables
- The SQL Server Central Management System: Execution of Server Information (Part 1)
- The SQL Server Central Management System: Execution of Server Information (Part 2)
- The SQL Server Central Management System: Collecting Performance Metrics
- The SQL Server Central Management System: Centralizing Agent Jobs, Events and Scripts
- The SQL Server Central Management System: Reporting the Data and Project Summary
- Time Tracking for SQL Server Operations
- Migrating Departmental Data Stores to SQL Server
- Migrating Departmental Data Stores to SQL Server: Model the System
- Migrating Departmental Data Stores to SQL Server: Model the System, Continued
- Migrating Departmental Data Stores to SQL Server: Decide on the Destination
- Migrating Departmental Data Stores to SQL Server: Design the ETL
- Migrating Departmental Data Stores to SQL Server: Design the ETL, Continued
- Migrating Departmental Data Stores to SQL Server: Attach the Front End, Test, and Monitor
- Tracking SQL Server Timed Events, Part 1
- Tracking SQL Server Timed Events, Part 2
- Patterns and Practices for the Data Professional
- Managing Vendor Databases
- Consolidation Options
- Connecting to a SQL Azure Database from Microsoft Access
- SharePoint 2007 and SQL Server, Part One
- SharePoint 2007 and SQL Server, Part Two
- SharePoint 2007 and SQL Server, Part Three
- Querying Multiple Data Sources from a Single Location (Distributed Queries)
- Importing and Exporting Data for SQL Azure
- Working on Distributed Teams
- Professional Development
- Becoming a DBA
- Certification
- DBA Levels
- Becoming a Data Professional
- SQL Server Professional Development Plan, Part 1
- SQL Server Professional Development Plan, Part 2
- SQL Server Professional Development Plan, Part 3
- Evaluating Technical Options
- System Sizing
- Creating a Disaster Recovery Plan
- Anatomy of a Disaster (Response Plan)
- Database Troubleshooting
- Conducting an Effective Code Review
- Developing an Exit Strategy
- Data Retention Strategy
- Keeping Your DBA/Developer Job in Troubled Times
- The SQL Server Runbook
- Creating and Maintaining a SQL Server Configuration History, Part 1
- Creating and Maintaining a SQL Server Configuration History, Part 2
- Creating an Application Profile, Part 1
- Creating an Application Profile, Part 2
- How to Attend a Technical Conference
- Tips for Maximizing Your IT Budget This Year
- The Importance of Blue-Sky Planning
- Application Architecture Assessments
- Transact-SQL Code Reviews, Part One
- Transact-SQL Code Reviews, Part Two
- Cloud Computing (Distributed Computing) Paradigms
- NoSQL for the SQL Server Professional, Part One
- NoSQL for the SQL Server Professional, Part Two
- Object-Role Modeling (ORM) for the Database Professional
- Business Intelligence
- BI Explained
- Developing a Data Dictionary
- BI Security
- Gathering BI Requirements
- Source System Extracts and Transforms
- ETL Mechanisms
- Business Intelligence Landscapes
- Business Intelligence Layouts and the Build or Buy Decision
- A Single Version of the Truth
- The Operational Data Store (ODS)
- Data Marts – Combining and Transforming Data
- Designing Data Elements
- The Enterprise Data Warehouse — Aggregations and the Star Schema
- On-Line Analytical Processing (OLAP)
- Data Mining
- Key Performance Indicators
- BI Presentation - Client Tools
- BI Presentation - Portals
- Implementing ETL - Introduction to SQL Server 2005 Integration Services
- Building a Business Intelligence Solution, Part 1
- Building a Business Intelligence Solution, Part 2
- Building a Business Intelligence Solution, Part 3
- Tips and Troubleshooting
- SQL Server and Microsoft Excel Integration
- Tips for the SQL Server Tools: SQL Server 2000
- Tips for the SQL Server Tools – SQL Server 2005
- Transaction Log Troubles
- SQL Server Connection Problems
- Orphaned Database Users
- Additional Resources
- Tools and Downloads
- Utilities (Free)
- Tool Review (Free): DBDesignerFork
- Aqua Data Studio
- Microsoft SQL Server Best Practices Analyzer
- Utilities (Cost)
- Quest Software's TOAD for SQL Server
- Quest Software's Spotlight on SQL Server
- SQL Server on Microsoft's Virtual PC
- Red Gate SQL Bundle
- Microsoft's Visio for Database Folks
- Quest Capacity Manager
- SQL Server Help
- Visual Studio Team Edition for Database Professionals
- Microsoft Assessment and Planning Solution Accelerator
- Aggregating Server Data from the MAPS Tool
SQL Azure is an Edition of SQL Server "in the cloud." It's actually a "database as a service," which I probably need to explain a little. The concept of a database as a service is fairly simple — when you need to access a database, you simply connect to it and run your queries. There's nothing to install, nothing to patch, and nothing to manage — sort of.
A database is an interesting service to provide. On the one hand, it's just as I mentioned — a database ready when you need it. For SQL Azure, The installation is handled, the upgrades and patches are handled, the system balances its own load, and High Availability is helped with a three-copy-commit built right in. But it's not simply a matter of a developer writing code against a database. There are still tasks for the database designer and the database administrator. Databases must be properly designed and created, server-side code needs to be written, backups need to be considered, and there are sizing (and thus cost) considerations, as well as proper security design and so on.
To do all of those things you need a way to access the system and control it. That's done through the use of various Microsoft and 3rd-party tools. In this overview I'll cover your available options, and how you can leverage those in your current environment.
General List of Tool Options
I'll start with the general list of tools you can use. This isn't meant to be an exhaustive list, since you can do most any task in Transact-SQL (T-SQL) that you can graphically, so any program you write that sends T-SQL is a management and development tool for SQL Azure:
- The Windows Azure Portal — Sets up subscriptions, create databases and objects, simple T-SQL Editor
- SQL Server Management Studio — Connect to database, runs T-SQL, create database objects graphically
- Command-Line Tools — SQLCMD and PowerShell (but not the PowerShell provider as of this writing) can be used, along with various solutions that can send commands using the SMO 10.5 model
- Visual Studio 2010 and Higher — Data structure design and creation, object browsing and selection
- Third Party Tools
I'll dig into each of these further in a moment.
I won't cover the list of tools you can use to import and export data from SQL Azure, since that's a specific task and warrants its own article. You do have a lot of options, however, and I'll cover those more fully in another article, along with scenarios where you can use each. Here's a partial list of your options:
- SQL Server bcp (Bulk Copy Program)
- SQL Server Integration Services
- Microsoft Data Sync
- 3rd party tools
- SQL Azure Export in SQL Azure Labs
The Windows Azure Portal
Probably the most up-to-date tool to use is the Windows Azure Portal, where you're able to access all of your subscription information, work with your billing, and get an overall view of the system. It's also available anywhere you have an Internet connection, on any system that can run a Silverlight plugin, including PC's, Macs and Unix systems. What it lacks in features for development it makes up for in access.
You connect to the portal by going to http://windowsazure.com and selecting the "Log in to Portal" link at the top of the page. From there, you can see your subscriptions.
From here you can create an entire new "Server," which is actually just a logical construct to aid in bundling the billing and security areas. Clicking on the "Databases" icon on the left brings up the management window specific to SQL Azure.
Here you can see the name of your server and administrator login (hidden in this case for my screenshot), the number of databases you have and their "edition" (which equates to size), and the region of the world your databases are hosted in. You can control the firewall rules here, since by default no one can connect until you allow them a connection in to the system. When you do that, you can also see the IP address on the system where you're hitting the portal from — which is a nice touch.
You can also create new databases and drop old ones here, and change the password for the administrator of the account.
Clicking the "Manage" button at the top brings you to the SQL Azure Database Manager — what used to be called "Project Houston."
After you enter your login credentials — and note that you enter a specific database name, not just the server name — you're brought to the object explorer portion of the tool. You can see the tables, views and stored procedures associated with the database, and the graphic in the middle rotates to show some basic information.
Clicking the "New Query" button brings up a panel where you can enter T-SQL code.
There's no color-coding here, Intellisense or code-correction, just a simple text box. You can save and load queries from here as well.
Back in the main tab of the SQL Azure Database Manager, you can create and design a new table in a graphical way.
Other than billing and subscription information, I tend not to use the portal for SQL Azure very often. I normally choose either SQL Server Management Studio (SSMS) or more often command-line tools.
SQL Server Management Studio
In SSMS version 2008 R2 (even the Express Edition), you can connect to and work with a SQL Azure database.
There are a couple of things to keep in mind here. The first is that you will need to specify the full name of the SQL Azure system, as it is shown in the Windows Azure Portal. For the login, use the format username@servername.
You'll need SQL Server Authentication, and the system you're connecting from will need to have a Firewall rule opened. You can do this through the Portal or use T-SQL commands.
You'll also need to specify the database to connect to. I use the system database master, since I have access to that database, and the nice thing about SSMS is that it will show all of the databases you have access to in one window.
Once inside, you'll find a familiar environment. There are, however, a few things that don't quite work the same. You won't find a "Properties" page anywhere, there are no Standard Reports, and in a Query Window you won't see advanced features like Intellisense enabled.
Even with these limitations, this is the tool most database administrators will use. You can right-click the various objects to see more of what does and does not work, but for the most part you can think of this as a good editing and visualization tool. It's a great place to work with both on-premise and SQL Azure databases, but you'll need to bone up on your T-SQL syntax to do more of the management tasks that you are used to doing graphically.
Command-Line Tools
I like to use the command-line tools because I can get information without having to open a graphical user interface. Using this blog entry, for instance, I can get the daily average and monthly billing — something that is very important to track. You have two main options for working with SQL Azure from the command line.
First, you can use PowerShell. I've explained PowerShell in other articles, and from those you'll recall that there are actually two ways of using PowerShell with SQL Server. The first is that you can invoke the PowerShell Provider for SQL Server, or include the Server Management Object (SMO) libraries in a PowerShell script.
For the SQL Server Provider for PowerShell, you'll notice that you don't have the ability to right-click the database name in SSMS and "Start PowerShell Here." You can, however, cheat a little and use the SQLPS command in the operating system and then use the invoke-Sqlcmd command-let. This allows you to run a query against SQL Azure:
Invoke-Sqlcmd -Query "SELECT * FROM sys.databases;" -ServerInstance "MySQLAzureServerName.database.windows.net" -Username "YouUserNameIncludeTheQuotes" -Password " YourPasswordncludeTheQuotes "
But to me this seems a little "heavy." I would rather just use native PowerShell and invoke the SMO model 10.5 — which of course must be installed (comes with the client tools for SQL Server 2008R2), or as I've done here with the SQL Native Client ADO call and then treat it like any database query:
# Connect and run a command using SQL Native Client, Returns a recordset # Create and open a database connection $sqlConnection = new-object System.Data.SqlClient.SqlConnection "Server=tcp:YourServerName.database.windows.net;Database=master;User ID=YourUserName;Password=YourPasswordName;Trusted_Connection=False;" $sqlConnection.Open() # Create a command object $sqlCommand = $sqlConnection.CreateCommand() $sqlCommand.CommandText = "SELECT @@VERSION" # Execute the Command $sqlReader = $sqlCommand.ExecuteReader() # Parse the records while ($sqlReader.Read()) { write-host $sqlReader[0] $intRow = $intRow + 1 } # Close the database connection $sqlConnection.Close()
Or any number of ways to query a SQL Server database using the Native Client.
Of course, if you have the client tools installed, you can use SQLCMD, which is what I use quite often as well — just treat the server and database like any other server, with the exception of the server and login name:
sqlcmd -S YourServerName.database.windows.net -U YourUserName@YourServerName.database.windows.net -d master
This prompts for a password and drops you in the interactive mode of SQLCMD. You can also run queries from a file, pipe output files and more. Remember, you need to specify the database name on the connection — SQL Azure does not currently support the USE DATABASE construct.
Visual Studio 2010 and Higher
If you're a developer, you can use Visual Studio 2010 and higher to design datasets that hit a SQL Azure database.
Those classes can be bound to SQL Azure, and you can send queries using the Query window in the Tools menu.
Third-party Tools
Many companies are making toolsets for SQL Azure connections, monitoring and management. I've tested a few of them out here.
Cerebrata has graphical tools for Windows Azure, and their Powershell command-lets can connect to and work with a SQL Azure system as well. You can find them here: https://www.cerebrata.com/Products/AzureManagementCmdlets/Details.aspx?t1=0&t2=5
Redgate makes software for on-premise SQL Server, and they are supporting SQL Azure with their data compare and other tools. : http://www.red-gate.com/products/cloud/ The one I've been using lately is including QueryAnywhere - http://www.queryanywhere.com/ which is a little better than the management Portal for querying the databases.
Quest Software also makes tools for on-premise SQL Server and many other databases as well. They have the popular TOAD product, and although I've tested it with Windows Azure Table storage I have not tried the SQL Azure connections yet. They are also making more and more tools for Azure. http://www.quest.com/toad-for-cloud-databases/
Although not specifically for managing SQL Azure, there are a couple of other tools I want to mention here. The first is the Microsoft Assessment and Planning (MAP) Toolkit. I've written about this tool before, and it's really worth investigating if you want to evaluate a database to see how much work it will be to bring it to SQL Azure. It's been upgraded so that it is Azure-Aware. http://technet.microsoft.com/en-us/solutionaccelerators/gg581074
There's also an interesting CodePlex (Microsoft's Open-Source-like site) free tool that you can use to migrate databases, called the SQL Azure Migration Wizard: http://sqlazuremw.codeplex.com/
If SQL Azure is in the mix for your planning, check out these tools to see which fits best in your day to day routine.