SQL Server SQL Server 100 Most Asked Questions: Best Practices guide to managing, mining, building and developing SQL Server databases
SQL Server 100 Success Secrets Copyright 2008 Notice of rights All rights reserved. No part of this book may be reproduced or transmitted in any form by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Notice of Liability The information in this book is distributed on an As Is basis without warranty. While every precaution has been taken in the preparation of the book, neither the author nor the publisher shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the instructions contained in this book or by the products described in it. Trademarks Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations appear as requested by the owner of the trademark. All other product names and services identified throughout this book are used in editorial fashion only and for the benefit of such companies with no intention of infringement of the trademark. No such use, or the use of any trade name, is intended to convey endorsement or other affiliation with this book.
SQL Server 100 Success Secrets There has never been a SQL Server Guide like this. 100 Success Secrets is not about the ins and outs of SQL Server. Instead, it answers the top 100 questions that we are asked and those we come across in forums, our consultancy and education programs. It tells you exactly how to deal with those questions, with tips that have never before been offered in print. This book is also not about SQL Server best practice and standards details. Instead, it introduces everything you want to know to be successful with SQL Server.
Table of Contents SQL Server Hosting Providers Abound the Market...12 The Benefits of Using SQL Server JDBC...14 SQL Server Script: Needed to Do Database Administrator Responsibility...15 SQL Server Instance; Makes Running Multiple SQL Server Versions Possible...17 SQL Server Login: As a Part of the Microsoft SQL Server...19 The Microsoft SQL Server 2000 Service Pack Installation...21 SQL Server DTS 2000...23 Analysis of SQL Server Log Files...25 SQL Server Performance Checklist...27 The Available SQL Server Reporting Services in the Market...29 The SQL Server 2005 Express Edition...31 The SQL Server Enterprise: An Introduction...33 The ODBC in Microsoft SQL Server and its Components...35 SQL Server Replication Overview...37 The SQL Server Select Statement...39 SQL Server 2003 Compared to other SQL Server Versions...40 Being a Certified SQL Server DBA...41 Better Application Performance with SQL Server Index...43 Various Helpful Functionalities from Sybase SQL Server Manager...45
The Edge of SQL Server Tables Compared to Other Ordinary Tables... 47 The Essence of Having a Correct SQL Server Client... 48 SQL Server Developer Edition Features and Requirements... 50 Some Common SQL Server Jobs for Administrators... 52 Microsoft SQL Server Standard Edition and its Features... 54 XML SQL Server: Fusion of Two Useful Concepts in Data Management and Delivery... 56 Microsoft SQL Server: Go for Efficiency and Security... 58 SQL Server 2005: Something to Experience... 59 SQL Server Database: Kinds of Database... 60 SQL Server: Best in its Time... 61 SQL Server 2008: A Major Database to Boast Off... 62 Editions of Microsoft SQL Server 2005... 64 Date/Time Columns on the SQL Server... 66 Insert Statement on the SQL Server... 68 Preparing Reports Using SQL Server Reporting Services... 69 Stored Procedures within the SQL Server... 71 Types of Backups Available Under SQL Server... 73 Free Download and Evaluation of the SQL Server 2008... 74 Query Data with SQL Server... 76 Add-On Services within the SQL Server... 77 Features of the SQL Server Management Studio... 79 About SQL Server 2005 Reporting... 81
Using SQL Service Export and Import...83 An Overview of SQL Server Report...84 The History of SQL Server Software...86 Utilizing SQL Server Triggers...88 Understanding How SQL Server Agent Works...90 Making Decisions on SQL Server Memory...91 Information on SQL Server Restore...93 SQL Server System and its Services...95 The Many Facets of SQL Server View...97 Seize the Benefits Brought by MS SQL Server...99 Facts About SQL Server Management...100 A Better Understanding of SQL Server Services...101 Ways to Deal with SQL Server Express Errors...103 VBR to Install SQL Server Net-Based Treasury System...105 Choosing the Best Microsoft SQL Server Database Applications...107 SQL Server 2000 Replication: Publishing and Subscription of Database Made Easier...109 SQL Server 2005 Developer Edition offers High-end database solutions....111 SQL Server 2005 Express Edition: The Lightweight Application that Packs a Solid Punch...113 Knowledge is within your Reach with SQL Server Books Online...115
Some Issues on SQL Server Development... 116 SQL Server Integration Services: Providing Meaning to Data to Improve the Business Process... 117 SQL Server Monitor: A Very Useful Tool for Monitoring Database Traffic... 119 The Benefits of SQL Server Transaction Log... 121 SQL Server 2000 Developer: Serving the Growing Need of Companies for Better Information Management... 122 SQL Server 2000 Standard: Ideal for Less Demanding Database Needs... 124 New Features of SQL Server 2005 Developer Edition for Improving Security and Web Services... 126 Useful New Features of SQL Server 2005 Replication Tool... 128 Understanding Different SQL Server Data Types... 130 SQL Server has Email Capabilities Too... 132 Devising an Effective SQL Server Maintenance Plan... 133 Techniques for Optimized SQL Server Queries... 134 SQL Server 2000 Enterprise: Powerful Solution That Can Run on Less Powerful Systems... 135 SQL Server 2000 Standard Edition: Affordable Solution for Profitable Results... 137 The New SQL Server 2005 DTS: Introducing the Server Integration Services as the New Transformation Tool... 139
SQL Server Analysis Services: Creating Intelligent Companies...141 SQL Server Developer Edition: Making the Life of Administrators Easier...143 The Advantages of Using SQL Server Enterprise Edition...145 Using SQL Server Migration Assistant: Minimizing the Risk of Database Migration...147 Prevent Server Problems with SQL Server Tool...149 Things to Remember when downloading the SQL Server 2005...151 MS SQL Server 2005: Codenamed Yukon...152 The SQL Server 2005 and its Reporting Service...153 How to Effectively Cluster your SQL Server...154 The Emerging SQL Server Enterprise Manager...155 The SQL Server Installation Process...157 Study the SQL Server Replication Services via Online...159 Defining the SQL Server Security...160 The SQL Server Setup Versions...161 Understanding the SQL Server Syntax...162 The Components of MS SQL Server 2000...163 The Evolution of the SQL Server 7...165 SQL Server Books that can help you...166 Working Effectively with Databases using the SQL Server...167 The Dynamic Functions of the SQL Server...168
Obtaining a Licensed SQL Server... 169 Data Recovery using the SQL Server... 170 The All New MS SQL Server 2008 Service Pack... 171 The Advantages of the SQL Server Stored Procedures... 172 Undergoing Effective SQL Server Training... 173
11
12 SQL Server Hosting Providers Abound the Market Microsoft SQL Server is Microsoft s relational database management system offering. Primarily, it utilizes Transact-SQL as its query language. Its architecture is divided into three separate components. It needs SQLOS as its base component in the architecture. SQL Server has special requirements so SQLOS does what normally an ordinary OS would do. It does its own memory management, thread scheduling and buffer pool management. It also functions to manage its own I/O, synchronization primitives and locking, deadlock detection and its resources. Since SQLOS manages its memory requirement, it is basically concerned with reducing disc I/O. The Relational engine, on the other hand, executes the functionalities of the SQLOS. It works to implement the data type and it defines what types of data will be stored in the tables. It also identifies various types of data that it is able to store. The Relational engine also includes a storage engine which implements how data is to be stored in the persistent storage devices. It also provides a means for faster data access. And finally, the protocol layer would do its part by implementing the outer layer of the interface. All operations possible for SQL Server are communicated to it using the Tabular Data Stream. For companies who require SQL Server to be hosted, they will have many options because there are quite many SQL Server hosting providers. There are providers who actually offer their
13 services at competitive prices. Of course, the better SQL Server hosting provider would be the one who can manage the company databases well. It is also important that systems are always up and there are minimal downtimes.
14 The Benefits of Using SQL Server JDBC SQL Server is implemented as a relational database management system. This means that this Microsoft offering works according to a relational model wherein data are stored in table form and their relationships are stored in tables as well. Data is retrieved based on a query that describes what data is needed. And this query would typically be expressed in SQL specifically the T-SQL. Companies utilize SQL Server in their database management. However, many of these companies use Java to run their applications as well. This is where the use of JDBC comes in. SQL Server JDBC is the API that implements a standard means of accessing data through applications running on Java. And because JDBC is the standard, there is no need to write a separate application to gain access from other database systems. Using the JDBS actually results to the need for only one application because JDBC allows it to send SQL statements to various different systems. JDBC defines a set of Java interfaces that covers all major functionalities of a database. And since Java is used to write JDBC any platform will allow the applications to work. It also provides a natural Java interface for handling SQL. In terms of user authentication, a good SQL Server JDBC would be one that will allow both Microsoft SQL Server and Windows authentication. This way SQL Server will be able to share the Windows authentication and users will not need a separate login. This is beneficial in so much that Windows authentication actually provides a more secure way to log into the Microsoft SQL Server.
15 SQL Server Script: Needed to Do Database Administrator Responsibility The relational database management system offering of Microsoft is known as the SQL Server. This works based on a relational model that typically stores all data and its relationships in table form. A new database administrator assigned to handle the SQL Server or someone who manages SQL Server as a component of their systems would need to know some basic SQL Server scripts to do their responsibilities better. Being an SQL Server administrator, it is one s most concern to ensure efficient performance, constant availability and tight security of their SQL Server systems. Fortunately, there are quite countless of free SQL Server scripts available in the internet. An SQL Server administrator would have countless of resources available to him. If he wants to fine tune and master his SQL Server script skills he can get guides and even trainings to better his skills. An example of a SQL Server script is one used for making backups and for restoring databases. This is quite an important SQL Server script for the administrator to ensure that he can cope up with system failures. With a back up for the databases one can easily restore the system should it fail at one time. It is, however, important for the administrator to change the location of the backup files. A separate SQL Server script is also needed for transferring logins from a single server to different server. To prevent other people from copying the output, the database administra-
16 tor should always delete the original procedure from the previous database. These are just some basic examples of the types of SQL Server scripts a database administrator would need in his job. A separate SQL Server script is typically needed for every different responsibility he needs to perform.
17 SQL Server Instance; Makes Running Multiple SQL Server Versions Possible SQL Server is the Microsoft relational database management system. Being such, it is a system that manages data according to a relational model. In such a system, data is stored in tables. The relationship between data is stored within the tables as well. It typically has three major components. The first of which is the engine. It functions in the lookup, sorting and other actions. The SQL Server also has metadata like the msdb and the system databases. And then there are also the user databases which typically store the data. When SQL Server is installed, the system will only acquire one set of scheduling information, security credentials, temporary files and other metadata. However, there are cases when it would be useful to install more than one SQL Server. Running multiple copies of SQL Server using instances is possible. Instances would generally share only a few files such as those that deal with client tools. Using them would permit having two system administrators. It also enables the system to have more than one security settings for the system. Another advantage an SQL Server instance would bring is the ability to use more than one version of SQL Server. For example, an instance of SQL 6.5 can function with more instances of other SQL Server versions. One can actually install instances after the SQL Server is installed. One can utilize instances to install many versions of SQL Server on the same system as well.
18 For SQL 2000 and 2005, the maximum number of instances allowed is 16 while the 2005 Enterprise Editions allow 50. However, while such number is allowed one should bear in mind that he is sharing the server resources among them. He should therefore expect deterioration in performance especially if more than one instance is doing heavy work.