- 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
Database professionals can be divided into a few roles, such as administration, design and development, Business Intelligence and so on. Even within these disciplines, such as administration, there are professionals that deal more with hardware than software, those that focus on replication and network, security and so on. And of course most of our day-to-day work doesn't fit neatly within a single area anyway — we jump from writing a Stored Procedure to setting up a SQL Agent Job for maintenance to adding a user to setting up a database design for a project. This diversity is one of the most challenging and most enjoyable aspects of our job.
But there can be conflict on a team when methodologies collide. Hardware specialists deal in electrical and mechanical terms, developers think in Classes and Objects (more on that in a moment), and Architects deal in design. Since the data professional deals with all of these, we often need to switch our thinking patterns to fit the audience we're talking with.
This article does not cover the process of creating an Object-Role Modeling (ORM) document, since as a data professional that's not always the best tool for you to use to create a database. Instead, I'll describe what an ORM model is, how other technical professionals use it, and what you need to be aware of as a data professional.
What It Is
Object-Role Modeling is the process of taking a programming Object (more on this in a moment) and describing its data and actions between each other. It's a bit like the Entity Relationship Diagram (ERD) process I've explained elsewhere, but with business logic and actions thrown in. That's a broad definition, but it works for now.
I'll explore ORM in more detail in other articles as well, but at a high level, the ORM model looks similar to an ERD, but in fact it describes more than just data, and in fact doesn't always include details that a Data Professional needs such as data types, cardinality and so on. But it is something that lends itself more to the Classes and Objects I'll describe in a moment.
Here's an example of an ORM Document — you can open this up to have as a discussion point throughout this article: http://upload.wikimedia.org/wikipedia/commons/b/b3/Object-Role_Model_Overview.jpg
The immediate distinction you'll see in that diagram from an ERD diagram is that not only is there less data detail, but that programming constructs are included within the relationships between entities and their data. For the Data Professional, it's easy to get a little confused with this diagram, since it seems to mix these two concepts together a great deal. And that's where I need to do a little more explanation between how a developer sees a system and how the Data Professional sees one.
Be aware that ORM is not only a documentation method — it's a development paradigm as well. An ORM tool does create a document, but it also can create the coding objects a developer needs.
In the .NET environment, two ORM tools are built right in to the Visual Studio development tool — Language Integrated Query (LINQ) and the newer Entity Framework (EF) modeling tools. Developers draw what they want in those tools, and Visual Studio writes the code the developer wants from the diagram. This is a completely normal task for the developer, hence the reason I'm covering this for the data professional.
A Brief and Most Assuredly Incomplete Description of a Class
Since an ORM tool normally creates "Classes" for the developer, I'll briefly explain what a programming Class is, although this isn't an article on development — but the idea of a Class is essential to why ORM is important. If you're already a developer, feel free to post comments on this article to add detail or refer readers to a good description on Object-Oriented Programming Books and articles.
Data Professionals mostly deal in "entities", which relate back to a physical or conceptual object somewhere in the real world. For instance, we think of a Purchase Order as an entity. But because of the relationship of parts of the entity — such as a particular line-item on a Purchase Order — we break the entity apart into multiple "parent" entities and "children" entities that belong to them. We then relate those back to each other using Key values and then join them together using the SQL language.
Developers also think this way, at least in some respects. Developers use the term "Class" to refer not to an actual Purchase Order, but its description — what we would consider the structure of a table. For each Row in our table, which might make up the data in a Purchase Order, the developer thinks of an "Object" or "Instantiation" of a Class.
At the risk of being a little technically inaccurate, you can think of a Class like a template used for a word processing document. It doesn't contain any data; it's just used to make the structure for data that will come later. When the developer writes code to "call" the Class to make a new Purchase Order, the Purchase Order is now called an "Object".
A class holds this data in something called a "Property", which you can think of a little like a column in a database table. But this is where the Class is separate in conceptual terms than a column — a class can contain actions performed on it, called "Methods".
So for instance you can create a Purchase Order Class and then make a Method called "Create" and perhaps another called "Destroy". Programmers can create a Purchase Order Object simply by using the appropriate Method, and the data structure is contained within the Class. So you can see that what we accomplish in the T-SQL Language combined with a SQL Server engine is done all in one place, in code.
There's an important distinction here that will help you understand LINQ or any program-oriented query language. Classes don't necessarily have built-in relationships to each other, except in one interesting way. A Class can "inherit" behavior from another one. For instance, perhaps you have a corporate standard for all Purchase Orders. Other departments might have similar requirements, but also have additional information or actions they want to perform on a Purchase Order.
In this case, the developer could create a "Purchase Order" Class and then another class called "Department PO Class". The second class can derive the data descriptions (Properties) and actions (Methods) from the first class.
There are far better descriptions (and more technically complete and therefore more accurate) available the book Sams Teach Yourself Object Oriented Programming in 21 Days
Why This Makes a Difference to the Data Professional
Working with an RDBMS often leads the developers to consider the data professional only as a caretaker of data, and not necessarily part of the design process for an application — which they often view as the center of the project. The data professional, on the other hand, often views the program as a way of manipulating data, which is the center of the project. This causes miscommunication, disconnected design problems, and disjointed systems of code and data.
This confusion is logical, since the developer may start out in an ORM tool such as those found in Visual Studio, which handles the Class design work. For data, the Classes are tied back to a data layer somewhere, and that's often where SQL Server comes in.
In Visual Studio, another development tool, or even just in code, the Classes are mapped back to some sort of a data layer. An RDBMS like SQL Server might be used, but in many cases other data engines might be used, or even multiple engines, even just memory. So for the developer, having to learn Transact-SQL (or any version of the SQL language) is only one of the things they need to care about.
Remember, the developer is thinking in terms of Classes and Objects, with their associated Properties and Methods. They don't often think in set-based logic, and that's where the rub comes in between the data teams and the programming teams. Developers may have to deal with multiple data sources, and many ORM constructs provide a single language for them to work with.
In the .NET environment, two such languages work with the ORM tools in Visual Studio quite well — one called Language Integrated Query (LINQ) and the other called the Entity Framework (EF). LINQ is smaller, fast, and simple to understand. EF is more complete, and is actively being added to. As of this writing, both are still supported by Microsoft.
There are some real advantages for the developer to use ORM languages:
- A single query language structure to learn and use
- Design-time development
- The languages and frameworks are extensible
- Can use key-less joins
- Can combine multiple data sets from multiple sources in a single query
- Data Layer is almost immaterial from their standpoint
If you want to learn more about Entity Framework, there's a good reference here. For LINQ, there's a good work here, and I also use a program called LINQpad. LINQpad has a free version, and right within the tool there are dozens of lessons and tutorials. You can learn to use LINQ with the Northwind sample database and LINQpad.
So your developers will use this methodology, almost assuredly. You need to understand that when a developer gets a specification, they may not consult you before designing the data structures, and then you'll live with the results.
So what is a data professional to do? Well, I've explained why it's attractive to developers — so you should be aware that they will be comfortable with that development paradigm. You should also be aware of the dangers in ORM as it applies to an RDBMS, and work with the developers to mitigate these issues.
Considerations
The primary issue with many ORM implementations is that they may rely too heavily on Dynamic SQL for their database access. Dynamic SQL means that T-SQL statements are sent to SQL Server rather than calling Server-side code like Stored Procedures and Functions. ORM programming like LINQ and EF can in fact use Stored Procedures, Functions and so on; it's just more difficult to do so.
It's not that the T-SQL sent from the tools is that bad. Many times it's well-formed, and you can use the LINQpad tool I mentioned to see what would be sent. The problem is that in addition to not using Stored Procedures and other server-side code, isolation levels and other engine-hinting technologies aren't used.
Another important issue is that in some cases I've seen ORM queries operate by opening a row, working on it and then closing the row — for each row, one at a time! This can completely destroy performance, and since everything is operating as designed, it's hard to track down. It just looks like a lot of activity on the server to the DBA.
There are other articles that detail these specific problems. I'll call your attention to an excellent article by Erland Sommerskog, a friend and SQL Server MVP on Dynamic SQL, and another (although older) article on LINQ in specific. Note that in both cases the ORM tools are updated to address at least part of these issues, but they will give you more detail to know what you are looking for.
There are other issues as well. Schemas within the database need to be mapped to Class Namespaces — something that takes time and effort on the developer's part.
Because of the row-by-row issue, some large Insert/Delete and Update operations can really suffer. Temporary tables, other special SQL Server features are not always recognized, understood or supported in ORM tools and languages.
Above all, try and work with the development teams to be brought into the design process as early as possible. This will ensure the issues are dealt with before they become a problem.