#EDIR DATA#
DOCTYPE='BOOK' PUBLICID='-//SYBOOKS//Default DTD//EN' SYSTEMID=''DOCTYPE='book' PUBLICID='' SYSTEMID=''SQL Server Reference ManualVolume I and IISQL Server Reference ManualCommands, Functions, Topics, System Procedures and Catalog Stored ProceduresREMAP="titleBO--Body"SYBASE SQL Server Release 10.0REMAP="titleBO--Body"Document ID: 30200-00-1000-03REMAP="titleBO--Body"Change Level: 2REMAP="titleBO--Body"Last Revised: June 17, 1994Principal authorship: Server Publications GroupDocument ID: 30200-00-1000REMAP="discBO--Body"This publication pertains to SYBASE SQL Server Release 10.0 of the SYBASE database management software and to any subsequent release until otherwise indicated in new editions or technical notes. Information in this document is subject to change without notice. The software described herein is furnished under a license agreement, and it may be used or copied only in accordance with the terms of the agreement.Document OrdersREMAP="discBO--Body"Customers may purchase additional copies of any document or the right to make photocopies of documentation for their in-house use.REMAP="discBO--Body"To order additional documents or photocopy rights, U.S. and Canadian customers should call Customer Fulfillment at (800) 685-8225, fax (617) 229-9845.REMAP="discBO--Body"Customers in other countries with a U.S. license agreement may contact Customer Fulfillment via the fax number. All other international customers should contact their Sybase subsidiary or local distributor.REMAP="discBO--Body"Upgrades are provided only at regularly scheduled software release dates.REMAP="discBO--Body"© Copyright Sybase, Inc., 1989, 1994. All rights reserved.REMAP="discBO--Body"No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical or otherwise, without prior written permission of Sybase, Inc.Sybase TrademarksREMAP="discBO--Body"SYBASE, the SYBASE logo, SyBooks, APT-FORMS, Data Workbench, DBA Companion, Deft, GainMomentum, SA Companion, SQL Debug, SQL Solutions, SQR, Transact-SQL, and VQL are registered trademarks of Sybase, Inc. ADA Workbench, Adaptable Windowing Environment, Application Manager, Applications from Models, APT Workbench, APT-Build, APT-Edit, APT-Execute, APT-Translator, APT-Library, Build Momentum, Camelot, Client/Server Architecture for the Online Enterprise, Client/Server for the Real World, Configurator, DataServer, Data Workbench, Database Analyzer, DB-Library, Deft Analyst, Deft Designer, Deft Educational, Deft Professional, Deft Trial, Developers Workbench, Easy SQR, Embedded SQL, Enterprise Builder, Enterprise Client/Server, Enterprise Meta Server, Enterprise Modeler, Enterprise Momentum, Gain, GainExposure, Insight, Mainframe Access Products (MAP), Momentum, Movedb, Navigation Server, Net-Gateway, Net Library, Object Momentum, OmniSQL Gateway, Omni SQL Server, OmniSQL Access Module, Open Client, Open Gateway, Open Server, Open Solutions, PC APT-Execute, PC DB-Net, PC Net Library, Report Workbench, Report Execute, Open Server, Partnerships that Work, Replication Server, Resource Manager, RW-Display Lib, RW-Library, SA Monitor, Secure SQL Server, Secure SQL Toolset, SQL Code Checker, SQL Edit/TPU, SQL Edit, SQL Monitor, SQL Server, SQL Toolset, SQL Server/CFT, SQL Server/DBM, SQL Station, SQR Toolset, SQR Developers Kit, SQR Workbench, SYBASE Client/Server Interfaces, SYBASE Gateways, SYBASE SQL Lifecycle, Sybase Synergy Program, SYBASE Virtual Server Architecture, SYBASE User Workbench System 10, Tabular Data Stream, and The Enterprise Client/Server Company are trademarks of Sybase, Inc.REMAP="discBO--Body"All other company and product names used herein may be the trademarks or registered trademarks of their respective companies.Restricted Rights LegendREMAP="discBO--Body"Use, duplication or disclosure by the Government is subject to restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.REMAP="discBO--Body"Sybase, Inc., 6475 Christie Avenue, Emeryville, CA 94608PrefaceREMAP="BO--Body"The SQL Server Reference Manual is a two-volume guide to SYBASE SQL Servername='trade' font='symbol' code='228'  charset='fontspecific' and the Transact-SQL® language. Volume 1, Commands, Functions, and Topics contains information about Transact-SQL commands, built-in functions, and topics of general interest to Transact-SQL users. Volume 2 contains information about system procedures and catalog stored procedures.RENDERAS="SECT1"AudienceREMAP="BO--Body"This manual is intended as a reference tool for Transact-SQL users of all levels. It provides basic syntax and usage information for every command, function, system procedure, and catalog stored procedure. It does not explain how to use these elements to build an application.RENDERAS="SECT1"How to Use This BookREMAP="BO--Body"This manual consists of the following:MARK="BULL" REMAP="BU--Bullet"LINKEND="X24304"Chapter 1,  "Transact-SQL Commands,"
 contains reference information for every Transact-SQL command. Particularly complex commands, such as MOREINFO="NONE"select, are divided into subsections. For example, there are reference pages on the MOREINFO="NONE"compute clause and on the MOREINFO="NONE"group by and MOREINFO="NONE"having clauses of the MOREINFO="NONE"select command.LINKEND="X56300"Chapter 2,  "Transact-SQL Functions,"
 contains reference information for the SQL Server aggregate functions, datatype conversion functions, date functions, mathematical functions, row aggregate functions, string functions, system functions, and text/image functions. LINKEND="X56620"Chapter 3,  "Transact-SQL Topics,"
 contains information about topics of general interest. Each topic describes the commands, system procedures, and functions that provide a particular type of functionality in Transact-SQL.LINKEND="X43361"Chapter 4,  "System Procedures,"
 contains reference pages for SQL Server system procedures. LINKEND="XK43361"Chapter 5,  "Catalog Stored Procedures,"
 contains reference pages for SQL Server catalog stored procedures.LINKEND="X94212"Appendix A,  "Reserved Words"
 lists Transact-SQL, APT-SQL, and SQL2 reserved words.LINKEND="X56552"Appendix B,  "The System Tables"
 lists each system table and the definition of all columns in each table. LINKEND="X40724"Appendix C,  "The pubs2 Database"
 describes the MOREINFO="NONE"pubs2 database in detail. It also includes an entity relationship diagram of all the tables in MOREINFO="NONE"pubs2.LINKEND="X65962"Appendix D,  "SQLSTATE Codes and Messages,"
 describes the SQLSTATE codes and associated messages that are generated when a warning or exception condition is detected.RENDERAS="SECT1"Related DocumentsREMAP="BO--Body"Other manuals that you may find useful are:MARK="BULL" REMAP="BU--Bullet"What's New in SYBASE SQL Server Release 10.0, which describes the new features software and documentation features of this release.Transact-SQL User's Guide, which documents Transact-SQL, Sybase's enhanced version of the  SQL relational database language. It serves as a textbook for beginning users of the SYBASE database management system. System Administration Guide, which contains in-depth information about SQL Server system administration issues.System Administration Guide Supplement, which documents operating-system specific system administration tasksOpen Client DB-Library Reference Manual, a collection of manual pages and code samples for the  SQL Server interface library, Open Client DB-Library.The SQL Server Installation Guide, which describes the installation procedures for  SQL Server.SQL Server Utility Programs for your operating system, which describes utility programs that are invoked directly from the operating system.RENDERAS="SECT1"Conventions Used in This ManualRENDERAS="SECT2"Formatting SQL Statements REMAP="BO--Body"SQL is a free-form language: there are no rules about the number of words you can put on a line, or where you must break a line. However, for readability, all examples and syntax statements in this manual are formatted so that each clause of a statement begins on a new line. Clauses that have more than one part extend to additional lines, which are indented. ID="X97350" RENDERAS="SECT2"SQL Syntax ConventionsREMAP="BO--Body"The conventions for syntax statements in this manual are as followsTOCENTRY="1"LBL="Table 1: "Syntax Statement ConventionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"KeyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DefinitionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"commandCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command names, command option names, utility 
names, utility flags, and other keywords are in bold Courier in syntax statements, and in MOREINFO="NONE"bold Helvetica 
in paragraph text.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"variableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Variables, or words that stand for values that you fill 
in, are in italics.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"{ }COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Curly braces indicate that you choose at least one of 
the enclosed options. Do not include braces in your 
option. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"[ ]COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Brackets mean choosing one or more of the enclosed 
options is optional. Do not include brackets in your 
option. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"( )COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Parentheses are to be typed as part of the command. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"|COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The vertical bar means you may select only one of 
the options shown. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE",COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The comma means you may choose as many of the 
options shown as you like, separating your choices 
with commas to be typed as part of the command.MARK="BULL" REMAP="BU--Bullet"Syntax statements (displaying the syntax and all options for a command) are printed like this:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_dropdevice [device_name]REMAP="UN--Under"or, for a command with more options:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select column_name     from table_name     where search_conditions REMAP="UN--Under"In syntax statements, keywords (commands) are in normal font and identifiers are in lowercase: normal font for keywords, italics for user-supplied words.Examples showing the use of Transact-SQL commands are printed like this:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select * from publishersExamples of output from the computer are printed like this:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"pub_id  pub_name             city        state ------- -------------------  ----------  -----0736    New Age Books        Boston      MA 0877    Binnet & Hardley     Washington  DC 1389    Algodata Infosystems Berkeley    CA  (3 rows affected)RENDERAS="SECT3"CaseREMAP="BO--Body"You can disregard case when you type keywords: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"SELECT is the same as MOREINFO="NONE"Select is the same as MOREINFO="NONE"select REMAP="BO--Body"SQL Server's sensitivity to the case (upper or lower) of database objects, such as table names, and data depends on the sort order installed on your Server. Case sensitivity can be changed for single-byte character sets by reconfiguring SQL Server's sort order. (See the System Administration Guide for more information).RENDERAS="SECT3"Obligatory Options {You Must Choose At Least One}MARK="BULL" REMAP="BU--Bullet"Curly Braces and Vertical Bars: Choose one and only one option. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"{die_on_your_feet | live_on_your_knees |live_on_your_feet}Curly Braces and Commas: Choose one or more options. If you choose more than one, separate your choices with commas. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"{cash, check, credit}RENDERAS="SECT3"Optional Options [You Don't Have to Choose Any]   MARK="BULL" REMAP="BU--Bullet"One Item in Square Brackets: You don't have to choose it. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"[anchovies]Square Brackets and Vertical Bars:   Choose none or only one. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"[beans | rice | sweet_potatoes]Square Brackets and Commas:   Choose none, one, or more than one option. If you choose more than one, separate your choices with commas. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"[extra_cheese, avocados, sour_cream]RENDERAS="SECT3"Ellipsis: Do It Again (and Again)...   REMAP="BO--Body"An ellipsis (...) means that you can repeat the last unit as many times as you like. In this syntax statement, MOREINFO="NONE"buy is a required keyword: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"buy thing = price [cash | check | credit]     [, thing = price [cash | check | credit]]... REMAP="BO--Body"You must buy at least one thing and give its price. You may choose a method of payment: one of the items enclosed in square brackets. You may also choose to buy additional things: as many of them as you like. For each thing you buy, give its name, its price, and (optionally) a method of payment. RENDERAS="SECT3"ExpressionsREMAP="BO--Body"SQL Server syntax statements use several different types of expressions. TOCENTRY="1"LBL="Table 2: "Types of Expressions Used in Syntax StatementsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="12*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UsageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DefinitionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"expressionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can include constants, literals, functions, 
column identifiers, variables or parametersCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"logical expressionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"An expression that returns TRUE, FALSE or 
UNKNOWNCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"constant expressionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"An expression that always returns the same 
value, such as "5+3" or "ABCDE"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"float_exprCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any floating-point expression or expression 
that implicitly converts to a floating valueCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"integer_exprCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any integer expression, or an expression that 
implicitly converts to an integer valueCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numeric_exprCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any numeric expression that returns a single 
valueCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char_exprCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any expression that returns a single 
character-type valueCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binary_expressionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"An expression that returns a single binary or 
varbinary valueRENDERAS="SECT1"If You Need HelpREMAP="BO--Body"Help with your SYBASE software is available in the form of documentation and the Technical Support Center.REMAP="BO--Body"Each SYBASE installation has a designated person who may contact Technical Support. If you cannot resolve your problem using the manuals, ask the designated person at your site to contact Sybase Technical Support.REMAP="BO--Body"NUMBER="1" ID="X24304"Transact-SQL CommandsID="IN1219921"Reference informationTransact-SQL commandsREMAP="BO--Body"This chapter describes commands, clauses, and other elements used to construct a Transact-SQL statement. LINKEND="X30665"Table 1-1
ID="IN1129832"Transact-SQLcommands summary table
ID="IN189743"CommandsTransact-SQL, summary table
 lists the elements discussed in this chapter and describes the function of each element.TOCENTRY="1"LBL="Table 1-1: " ID="X30665"Transact-SQL commandsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="16*"COLNAME="C2" COLWIDTH="29*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommandCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"alter database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Increases the amount of space allocated to a database.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"alter table   COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Adds new columns and constraints, changes constraints, 
or drops constraints on an existing table.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"begin...endCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Encloses a series of SQL statements so that control-of-
flow language, such as MOREINFO="NONE"if ... else, can affect the 
performance of the whole group. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"begin transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Marks the starting point of a user-defined transaction. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"breakCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Causes an exit from a MOREINFO="NONE"while loop. MOREINFO="NONE"break is often activated 
by an MOREINFO="NONE"if test.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"checkpointCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Writes all "dirty" pages (pages that have been updated 
since they were last written) to the database device. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"closeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Deactivates a cursor.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"commitCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Marks the ending point of a user-defined transaction. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"compute clauseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Generates summary values that appear as additional 
rows in the query results. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"continueCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Causes the MOREINFO="NONE"while loop to restart. MOREINFO="NONE"continue is often 
activated by an MOREINFO="NONE"if test.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create databaseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates a new database.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create defaultCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Specifies a value to insert in a column (or in all columns 
of a user-defined datatype) if no value is explicitly 
supplied at insert time.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create indexCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates an index on one or more columns in a table. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create procedureCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates a stored procedure that can take one or more 
user-supplied parameters.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create ruleCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Specifies the domain of acceptable values for a 
particular column or for any column of a user-defined 
datatype.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create schemaCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates a new collection of tables, views and 
permissions for a database user.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create table COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates new tables and optional integrity constraints. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create triggerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates a trigger, a type of stored procedure often used 
for enforcing integrity constraints. A trigger executes 
automatically when a user attempts a specified data 
modification statement on a specified table. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create viewCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates a view, which is an alternative way of looking at 
the data in one or more tables. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dbccCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database Consistency Checker (MOREINFO="NONE"dbcc) checks the logical 
and physical consistency of a database. MOREINFO="NONE"dbcc should be 
used regularly as a periodic check, or if damage is 
suspected. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"deallocate cursorCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Makes a cursor inaccessible and releases all memory 
resources committed to that cursor.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"declareCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Declares the name and type of local variables for a batch 
or procedure. Local variables are assigned values with a 
MOREINFO="NONE"select statement.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"declare cursorCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Defines a cursor.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"delete COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes rows from a table. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk init COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Makes a physical device or file usable by . (It 
is not necessary to use MOREINFO="NONE"disk init on the master device, 
which is initialized by the MOREINFO="NONE"sybinit installation program.) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk mirror COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates a software mirror that immediately takes over 
when the primary device fails. You can mirror the 
master device, devices that store data, and devices that 
store transaction logs; you cannot mirror dump devices.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk refit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Rebuilds the master database's sysusages and sysdatabases 
system tables from information contained in sysdevices. 
Use MOREINFO="NONE"disk refit after MOREINFO="NONE"disk reinit as part of the procedure to 
restore the master database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk reinit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Rebuilds the master database's sysdevices system table. 
Use MOREINFO="NONE"disk reinit as part of the procedure to restore the 
master database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk remirrorCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reenables disk mirroring after it is stopped by failure of 
a mirrored device or temporarily disabled by the MOREINFO="NONE"disk 
MOREINFO="NONE"unmirror command. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk unmirror COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Disables either the original device or its mirror, allowing 
hardware maintenance or the changing of a hardware 
device.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes one or more databases
from a SQL Server.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop default COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes a user-defined default.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop index COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes an index from a table in the current database.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop procedure COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes user-defined stored procedures.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop rule COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes a user-defined rule.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop table COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes a table definition and all of its data, indexes, 
triggers, and permission specifications from the 
database.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop trigger COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes a trigger. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop view COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes one or more views from the current database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Makes a backup copy of the entire database, including 
the transaction log, in a form that can be read in with 
MOREINFO="NONE"load database.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Makes a copy of a transaction log and removes the 
inactive portion. 
MOREINFO="NONE"no_truncate copies the log without truncating it. Use 
when the database is inaccessible after device failure.
MOREINFO="NONE"truncate_only truncates the log without copying it. Use 
for databases without a separate log segment and 
databases for which you do not need an up-to-date 
dump. 
MOREINFO="NONE"no_log truncates a log without copying it and without 
logging the event. Use only as a last resort, when your 
usual method of dumping the transaction log fails 
because of insufficient log space. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"execute COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Runs a system procedure or a user-defined stored 
procedure. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"fetch COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a row or a set of rows from a cursor result set.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"goto label COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Branches to a user-defined label.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"grant COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Assigns permissions to users. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"group
by and MOREINFO="NONE"having clauses COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Used in MOREINFO="NONE"select statements to divide a table into groups. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"if...else COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Imposes conditions on the execution of a SQL statement. 
The statement following an MOREINFO="NONE"if keyword and its condition 
is executed if the condition is satisfied (when the logical 
expression returns "true"). The optional MOREINFO="NONE"else keyword 
introduces an alternate SQL statement that executes 
when the MOREINFO="NONE"if condition is not satisfied (when the logical 
expression returns "false"). COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"insert COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Adds new rows to a table or view.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"kill COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Kills a process. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Loads a backup copy of a user database, including its 
transaction log. The MOREINFO="NONE"listonly and MOREINFO="NONE"headeronly options 
display information about the dump files without 
loading them. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Loads a backup copy of the transaction log. The MOREINFO="NONE"listonly 
and MOREINFO="NONE"headeronly options display information about the 
dump files without loading them. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"open COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Opens a cursor for processing.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"order by clause COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns query results in the specified column(s) in 
sorted order.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"prepare transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Used by DB-Library in a two-phase commit application 
to see if a server is prepared to commit a transaction.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"print COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Prints a user-defined message on the user's screen. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"raiserror COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Prints a user-defined error message on the user's screen 
and sets a system flag to record that an error condition 
has occurred. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"readtext COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reads text and image values, starting from a specified 
offset and reading a specified number of bytes or 
characters.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"reconfigure COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sets configuration variables that control various aspects 
of 's memory allocation, performance, and 
options. Used with the system procedure MOREINFO="NONE"sp_configure. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"return COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Exits from a batch or procedure unconditionally, 
optionally providing a return status. Statements 
following MOREINFO="NONE"return are not executed. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"revoke COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Revokes permissions from users. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"rollbackCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Rolls a user-defined transaction back to the last 
savepoint inside the transaction or to the beginning of 
the transaction. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"rollback trigger COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Rolls back the work done in a trigger, including the 
update that caused the trigger to fire, and issues an 
optional MOREINFO="NONE"raiserror statement.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"save transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sets a savepoint within a transaction.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Retrieves rows from database objects. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"set COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sets  query-processing options for the 
duration of the user's work session. Can be used to set 
some options inside a trigger or stored procedure.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"setuser COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allows a Database Owner to impersonate another user. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"shutdown COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Shuts down  or a Backup Server. This 
command can only be issued by a System 
Administrator.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"truncate tableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes all rows from a table. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"union operator COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a single result set that combines the results of 
two or more queries. Duplicate rows are eliminated 
from the result set unless the all keyword is specified.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"update COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Changes data in existing rows, either by adding data or 
by modifying existing data.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"update statistics COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Updates information about the distribution of key 
values in specified indexes. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"use COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Specifies the database with which you want to work. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"waitfor COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Specifies a specific time, a time interval, or an event for 
the execution of a statement block, stored procedure, or 
transaction. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"where clause COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sets the search conditions in a MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"update, or 
MOREINFO="NONE"delete statement. (Joins and subqueries are specified in 
the search conditions: see the "Joins" and "Subqueries" 
sections for full details.)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"while COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sets a condition for the repeated execution of a 
statement or statement block. The statement(s) are 
executed repeatedly as long as the specified condition is 
true.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"writetext COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Permits non-logged, interactive updating of an existing 
MOREINFO="NONE"text or MOREINFO="NONE"image column. ID="X61977"alter databaseID="IN43109663"Extensionsdatabase storage;Databases:storage extension
ID="IN4359664"Spacedatabase storage
Increases the amount of space allocated to a database.SyntaxREMAP="SY--Syntax" FORMAT="LINESPECIFIC"alter database MOREINFO="NONE"database_name [on {default | MOREINFO="NONE"database_device } [=MOREINFO="NONE" size]    [, MOREINFO="NONE"database_device [=MOREINFO="NONE" size]]...] [log on { default | MOREINFO="NONE"database_device } [ = size ]    [ , MOREINFO="NONE"database_device [=MOREINFO="NONE" size]]...] [with override][for load]Keywords and OptionsREMAP="RI--RefIndent"database_name - is the name of the database. The database name can be a literal, a variable, or a stored procedure parameter.ID="IN431092109"on keywordalter database
MOREINFO="NONE"on - indicates that you want to specify a size and/or location for the database extension. If you have your log and data on separate device fragments, use this clause for the data device, and the MOREINFO="NONE"logMOREINFO="NONE" on clause for the log device.ID="IN4315881410"default keywordalter database
MOREINFO="NONE"default - indicates that MOREINFO="NONE"alter database can put the database extension on any default database device(s) (as shown by MOREINFO="NONE"sp_helpdevice). To specify a size for the database extension without specifying the exact location, use this command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"on default = MOREINFO="NONE"sizeREMAP="UN--Under"To change a database device's status to default, use the system procedure MOREINFO="NONE"sp_diskdefault. ID="IN4316861611"Database devicesalter database and
database_device - is the name of the database device on which you want to locate the database extension. A database can occupy more than one database device with different amounts of space on each. size - is the amount of space, in megabytes, allocated to the database extension. The minimum extension is 1 MB (512 2K pages). The default value is 1 MB. Legal values for the sizeID="IN434861612"Sizedatabase extension
 parameter range from 1 to 2048 MB.ID="IN4313822013"log on optionalter database
MOREINFO="NONE"logMOREINFO="NONE" on- indicates that you want to specify additional space for the database's transaction logs. See the information above about MOREINFO="NONE"default, database_device, and size. The MOREINFO="NONE"logMOREINFO="NONE" on clause uses the same defaults as the MOREINFO="NONE"on clause.ID="IN4320782414"with override optionalter database
MOREINFO="NONE"with override - forces SQL Server to accept your device specifications, even if they mix data and transaction logs on the same device, thereby endangering up-to-the-minute recoverability for your database. If you attempt to mix log and data on the same device without this clause, the MOREINFO="NONE"alterMOREINFO="NONE" database command fails. If you mix log and data, and use MOREINFO="NONE"with overrideID="IN4334732915"Override. See with override option
, you are warned, but the command succeeds. ID="IN4315693316"for load optionalter databaseMOREINFO="NONE"for load - is used only after MOREINFO="NONE"create database for load, when you must recreate the space allocations and segment usage of the database being loaded from a dump.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"alter database mydbREMAP="UN--Under"Adds 1 Mb to the database mydb on a default database device.alter database pubs2 on newdata = 3 REMAP="UN--Under"Adds 3 Mb to the space allocated for the pubs2 database on the database device named newdata.alter database production     on userdata1 = 10    log on logdev = 2REMAP="UN--Under"Adds 10 Mb of space for data on userdata1 and 2 Mb for the log on logdev.CommentsRestrictionsID="IN4315653721"master databasealter database andMARK="BULL" REMAP="BU--Bullet"You must be using the master database, or executing a stored procedure in the master database, to use MOREINFO="NONE"alter database. If SQL Server cannot allocate the requested space, it comes as close as possible per device and prints a message telling how much space has been allocated on each database device. You can only expand the master database on the master device, d_master. An attempt to use MOREINFO="NONE"alter database to expand the master database to any other database device results in an error message. Here is an example of the correct statement for modifying the masterID="IN4313653722"Master device
 database on the master device:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"alter database master on d_master = 1ID="IN4316653723"Device fragmentsnumber of;Number (quantity of):device fragmentsThe maximum number of device fragments for any database is 128. Each time you allocate space on a database device with MOREINFO="NONE"create database or MOREINFO="NONE"alter database, that allocation represents a device fragment, and the allocation is entered as a row in sysusages. If you use MOREINFO="NONE"alterMOREINFO="NONE" database on a database that is in the process of being dumped, the MOREINFO="NONE"alterMOREINFO="NONE" databaseID="IN4313653724"In-memory map
 command cannot complete until the dump finishes. SQL Server locks the in-memory map of database space use during a dump. If you issue an MOREINFO="NONE"alterMOREINFO="NONE" database command while this in-memory map is locked, SQL Server updates the map from the disk after the dump completes. If you interrupt MOREINFO="NONE"alterMOREINFO="NONE" database, you are instructed to run MOREINFO="NONE"sp_dbremap. If you fail to run MOREINFO="NONE"sp_dbremap, the space you added will not become available to SQL Server until the next reboot.Backing Up master After Allocating More SpaceID="IN437633925"Backupsmaster databaseMARK="BULL" REMAP="BU--Bullet"Back up the master database with the MOREINFO="NONE"dump MOREINFO="NONE"database command after each use of MOREINFO="NONE"alter database. This makes recovery easier and safer in case master becomes damaged. (If you use MOREINFO="NONE"alter database and fail to back up master, you may be able to recover the changes with MOREINFO="NONE"disk refit.) Placing the Log on a Separate DeviceMARK="BULL" REMAP="BU--Bullet"To increase the amount of storage space allocated for the transaction log when you have used the MOREINFO="NONE"log MOREINFO="NONE"on extension to MOREINFO="NONE"create database, give the name of the log's device in the MOREINFO="NONE"log on clause when you issue the MOREINFO="NONE"alter database command. If you did not use the MOREINFO="NONE"logMOREINFO="NONE" on extension of MOREINFO="NONE"create database to place your logs on a separate device, you may not be able to recover fully in case of a hard disk crash. However, you can extend your logs in this case by using MOREINFO="NONE"alter database with the MOREINFO="NONE"log on clause, and then MOREINFO="NONE"sp_logdevice. Getting Help on Space UsageMARK="BULL" REMAP="BU--Bullet"To see the names, sizes, and usage of device fragments already in use by a database, execute MOREINFO="NONE"sp_helpdb dbname. To see how much space the current database is using, execute MOREINFO="NONE"sp_spaceused.The System and Default SegmentsID="IN4314594326"system segmentalter databaseMARK="BULL" REMAP="BU--Bullet"The systemID="IN4315554727"default segmentalter database
 and defaultID="IN437554728"Mappingsystem and default segments
 segments are mapped to each new database device included in the MOREINFO="NONE"on clause of an MOREINFO="NONE"alter database command. To unmap these segments, use MOREINFO="NONE"sp_dropsegment.When you use MOREINFO="NONE"alter database (without MOREINFO="NONE"override) ID="IN438554729"Segmentsmapping to a new device
to extend a database on a device already in use by that database, the segments mapped to that device are also extended. If you use the MOREINFO="NONE"override clause, all device fragments named in the MOREINFO="NONE"on clause become system/default segments, and all device fragments named in the MOREINFO="NONE"logMOREINFO="NONE" on clause become log segments.Using MOREINFO="NONE"alterMOREINFO="NONE" database to Awaken Sleeping ProcessesID="INA4316554730"Transaction logsspace extensionMARK="BULL" REMAP="BU--Bullet"If user processes are suspended due to reaching a last-chance threshold on a log segment, adding space to the log segment awakens the processes.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"alter database permission defaults to the Database Owner. System Administrators can also alter databases.See AlsoCommands     LINKEND="X75308"create database
, LINKEND="X72692"drop database
,LINKEND="X28090"load databaseSystem procedures     LINKEND="X62957"sp_addsegment
, LINKEND="X92302"sp_diskdefault
, LINKEND="X10014"sp_dropsegment
, LINKEND="X90458"sp_helpdb
, LINKEND="X36403"sp_helpsegment
, LINKEND="X21496"sp_logdevice
, LINKEND="X99854"sp_renamedb
, LINKEND="X50477"sp_spaceused
ID="IN4322515136"alter database command
ID="IN4319475537"alter table commandID="X68185"alter table   ID="IN446475639"Addingcolumns to a table;Columns:adding to tables
ID="IN4411475640"Constraintschanging table
Adds new columns and constraints, changes constraints, or drops constraints on an existing table.SyntaxREMAP="SY--Syntax" FORMAT="LINESPECIFIC"alter table
[MOREINFO="NONE"database.[MOREINFO="NONE"owner].]MOREINFO="NONE"table_name
{add MOREINFO="NONE"column_name
MOREINFO="NONE"datatype    [default
{MOREINFO="NONE"constant_expression | user | null}]
{[{identity | null}]    | [[constraint
MOREINFO="NONE"constraint_name]        {{unique | primary
key}            [clustered | nonclustered]            [with
fillfactor = x] [on segment_name]        | references
[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"ref_table
           [(MOREINFO="NONE"ref_column)]        |
check (MOREINFO="NONE"search_condition)}]}...    {[,
MOREINFO="NONE"next_column]}... | add {[constraint MOREINFO="NONE"constraint_name]    {unique | primary key}        [clustered | nonclustered]        (column_name [{, column_name}...])        [with fillfactor = x] [on segment_name]    | foreign key (MOREINFO="NONE"column_name [{,MOREINFO="NONE" column_name}...])        references [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"ref_table            [(MOREINFO="NONE"ref_column [{, MOREINFO="NONE"ref_column}...])]    | check (MOREINFO="NONE"search_condition)} | drop constraint MOREINFO="NONE"constraint_name | replace MOREINFO="NONE"column_name    default {MOREINFO="NONE"constant_expression | user | null}}Keywords and OptionsREMAP="RI--RefIndent"table_name - is the name of the table you want to change. ID="IN4424436045"add keyword, alter table
MOREINFO="NONE"add - specifies the name of the column or constraint you want to add to the table.column_name - is the name of a column in that table.datatype - is any of the system datatypes except bit, or any user-defined datatype except those based on bit. ID="IN4415396446"default keywordalter table
MOREINFO="NONE"default - specifies a default value for a column. If you have declared a default and the user does not provide a value for this column when inserting data, SQL Server inserts this value. The default can be a constant_expression, MOREINFO="NONE"user (to insert the name of the user who is performing the insert), or MOREINFO="NONE"null (to insert the null value).ID="IN448396447"Defaultscolumn values
constant_expression - is a constant expression to use as a default value for a column. It cannot include the name of any columns or other database objects, but you can include built-in functions that do not reference database objects. This default value must be compatible with the datatype of the column.ID="IN4412356848"user keywordalter table
MOREINFO="NONE"user ID="IN4412317249"null keywordalter table
| MOREINFO="NONE"null - specifies that SQL Server should insert the user name or the null value as the default if the user does not supply a value. For user, the datatype of the column must be either char(30) or varchar(30). For MOREINFO="NONE"null, the column must allow null values.ID="IN4416277650"identity keywordalter table
MOREINFO="NONE"identity - indicates that the column has the IDENTITY property. Each table in a database can have one IDENTITY column of type numeric and scale zero. IDENTITY columns are not updatable and do not allow nulls.REMAP="UN--Under"IDENTITY columns are used to store sequential numbers, such as invoice numbers or employee numbers, that are generated automatically by SQL Server. The value of the IDENTITY column uniquely identifies each row in a table. ID="IN4412238051"null keywordalter table
MOREINFO="NONE"nullID="IN4411238052"Null valuesnew column
 - specifies that SQL Server assigns a null value if a user does not provide a value during an insertion and no default exists.ID="IN4418198453"constraint keywordalter table
MOREINFO="NONE"constraint - introduces the name of an integrity constraint. This keyword and the constraint_name are optional.constraint_name - is the name of the constraint. It must conform to the rules for identifiers and be unique in the database. If you do not specify the name for a table-level constraint, SQL Server generates a name as follows:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    tabname_colname_objectidREMAP="UN--Under"where tabname is the first 10 characters of the table name, colname is the first 5 characters of the column name, and objectid is the object ID number for the constraint. If you do not specify the name for a unique or primary key constraint, SQL Server generates a name as follows:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"     tabname_colname_tabindidREMAP="UN--Under"where tabindid is a string concatenation of the table ID and index ID.ID="IN4414158854"unique keywordalter table
MOREINFO="NONE"unique - constrains the values in the indicated column or columns so that no two rows can have the same non-null value. This constraint creates a unique index that can only be dropped if the constraint is dropped. You cannot use this option along with the null option described above.ID="IN4422119255"primary key constraintalter table
MOREINFO="NONE"primary key - constrains the values in the indicated column or columns so that no two rows can have the same value, and so that the value cannot be NULL. This constraint creates a unique index that can only be dropped if the constraint is dropped.ID="IN442079656"clustered constraintalter table
MOREINFO="NONE"clustered ID="IN4423310057"nonclustered constraintalter table
| MOREINFO="NONE"nonclustered - specifies that the index created by a MOREINFO="NONE"unique or MOREINFO="NONE"primary key constraint is a clustered or nonclustered index. MOREINFO="NONE"clustered is the default (unless a clustered index already exists for the table) for primary key constraints, nonclustered is the default for unique constraints. There can be only one clustered index per table. See "LINKEND="X58868"create index
" for more information.ID="IN4417-110458"fillfactor optionalter table
MOREINFO="NONE"fillfactor - specifies how full SQL Server will make each page when it is creating a new index on existing data. The MOREINFO="NONE"fillfactor percentage is relevant only at the time the index is created. As the data changes, the pages are not maintained at any particular level of fullness. ID="IN4411-310659"Index pagesfillfactor values forREMAP="UN--Under"The default for MOREINFO="NONE"fillfactor is 0; this is used when you do not include MOREINFO="NONE"with fillfactor in the MOREINFO="NONE"create index statement (unless the value has been changed with MOREINFO="NONE"sp_configure). When specifying a MOREINFO="NONE"fillfactor, legal values are between 1 and 100. ID="IN445-310660"SpaceSpacefor index pagesindex pagesREMAP="UN--Under"A MOREINFO="NONE"fillfactorID="IN4422-310661"Leaf levels of indexesclustered index;Index pages:leaf level
 of 0 creates clustered indexes with completely full pages and nonclustered indexes with completely full leaf pages. It leaves a comfortable amount of space within the index B-tree in both the clustered and nonclustered cases. There is seldom a reason to change the MOREINFO="NONE"fillfactor. REMAP="UN--Under"If the MOREINFO="NONE"fillfactor is set to 100, SQL Server creates both clustered and nonclustered indexes with each page 100% full. A MOREINFO="NONE"fillfactor of 100 only makes sense for read-only tables-tables to which no additional data will ever be added. REMAP="UN--Under"MOREINFO="NONE"fillfactor values smaller than 100 (except 0, which is a special case) cause SQL Server to create new indexes with pages that are not completely full. A MOREINFO="NONE"fillfactor of 10 might be a reasonable choice if you are creating an index on a table that will eventually hold a great deal more data, but small MOREINFO="NONE"fillfactor values cause each index (or index and data) to take more storage space. ID="IN445-310662"SpaceSpacedatabase storage;Space:for a clustered indexclustered indexCreating a clustered index with a MOREINFO="NONE"fillfactor affects the amount of storage space your data occupies, since SQL Server redistributes the data as it creates the clustered index. ID="IN4411-711063"on  keywordalter table;Segments:creating indexes on
ID="IN445-711064"Namessegment;Segments:names of
MOREINFO="NONE" on MOREINFO="NONE"segment_name - specifies that the index is to be created on the named segment. Before the MOREINFO="NONE"on segment_name option can be used, the device must be initialized with MOREINFO="NONE"disk init, and the segment must be added to the database with the MOREINFO="NONE"sp_addsegment system procedure. See your System Administrator or use MOREINFO="NONE"sp_helpsegment for a list of the segment names available in your database.REMAP="UN--Under"If you specify MOREINFO="NONE"clustered and use the MOREINFO="NONE"on segment_name option, the entire table migrates to the segment you specify, since the leaf level of the index contains the actual data pages.ID="IN4421-1111465"references constraintalter table
MOREINFO="NONE"references - specifies a column list for a referential integrity constraint. You can specify only one column value for a column-constraint. By including this constraint with a table that references another table, any data inserted into the "referencing" table must already exist in the "referenced" table.REMAP="UN--Under"To use this constraint, you must have MOREINFO="NONE"references permission on the referenced table. The specified columns in the referenced table must be constrained by a unique index (created by either a MOREINFO="NONE"unique constraint or a MOREINFO="NONE"createMOREINFO="NONE" index statement). If no columns are specified, there must be a MOREINFO="NONE"primary key constraint on the appropriate columns in the referenced table. Also, the datatypes of the referencing table columns must exactly match the datatype of the referenced table columns.ID="IN4422-1511866"foreign key constraintalter table
MOREINFO="NONE"foreign key - specifies that the listed column(s) are foreign keys in this table whose matching primary keys are the columns listed in the MOREINFO="NONE"references clause.ref_table - is the name of the table that contains the referenced columns. You can reference tables in another database.ref_column - is the name of the column or columns in the referenced table.ID="IN4412-1912267"check optionalter table
MOREINFO="NONE"check - specifies a search_condition constraint which SQL Server enforces for all the rows in the table.search_condition - is a boolean expression that defines the MOREINFO="NONE"check constraint on the column values. These constraints can include:ID="IN4410-2312668"in keywordalter table andMARK="DASH" REMAP="BS--BulletSub"a list of constant expressions introduced with MOREINFO="NONE"in.a set of conditions, which may contain wildcard characters, introduced with ID="IN4412-2713069"like keywordalter table and
MOREINFO="NONE"like.REMAP="UN--Under"An expression can include arithmetic operations and Transact-SQL functions. The search_condition cannot contain subqueries, aggregate functions, parameters, or host variables.MOREINFO="NONE"next_column - indicates that you can include additional column definitions (separated by commas) using the same syntax described for a column definition.ID="IN4425-3113470"drop keyword, alter table
MOREINFO="NONE"drop - specifies the name of the constraint you want to drop from the table.ID="IN4428-3513871"replace keyword, alter table
MOREINFO="NONE"replace - specifies the column whose default value you want to change with the new value specified by a following MOREINFO="NONE"default clause.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"alter table publishers add manager_name varchar(40) nullREMAP="UN--Under"Adds a column to a table. For each existing row in the table, SQL Server assigns a NULL column value.alter table sales_dailyadd ord_num numeric(5,0) identityREMAP="UN--Under"Adds an IDENTITY column to a table. For each existing row in the table, SQL Server assigns a unique, sequential column value. Note that the IDENTITY column has type numeric, and scale zero. The precision determines the maximum value (10 5 - 1, or 99,999) that can be inserted into the column.alter table authorsadd constraint au_identificationprimary key (au_lname, au_fname, address)REMAP="UN--Under"Adds a primary key constraint to the authors table. If there is an existing primary key or unique constraint on the table, the existing constraint must be dropped first. See Example 4.alter table titles drop constraint au_identificationREMAP="UN--Under"Drops the au_identification constraint. alter table authorsreplace phone default nullREMAP="UN--Under"Changes the default constraint on the phone column in the authors tables to insert the value NULL if the user does not enter a value.CommentsRestrictionsMARK="BULL" REMAP="BU--Bullet"You cannot add a column of datatype bit to an existing table. ID="IN4417-3513876"Number of columnsper table;Columns:per table;Size:columns in table
ID="IN445-3513877"Bytesper row;Number (quantity of):bytes per row;Size:rowThe number of columns in a table cannot exceed 250. The maximum number of bytes per row is 1962.ID="IN448-3513878"Droppingcolumns from a tableYou cannot delete columns from a table. Use MOREINFO="NONE"selectMOREINFO="NONE" into to create a new table with a different column structure or sort order.ID="IN4417-3714079"Stored proceduresalter table and
ID="IN4419-3914280"select into commandcolumn changes
A column added with MOREINFO="NONE"alterMOREINFO="NONE" table is not visible to stored procedures that MOREINFO="NONE"select * from that table. To reference the new column, drop the procedures and recreate them.Getting Information About TablesMARK="BULL" REMAP="BU--Bullet"For information on a table and its columns, use MOREINFO="NONE"sp_help. To rename a table, execute the system procedure MOREINFO="NONE"sp_rename (do not rename the system tables). For information about integrity constraints (MOREINFO="NONE"unique, MOREINFO="NONE"primaryMOREINFO="NONE" key, MOREINFO="NONE"references, andMOREINFO="NONE" check) or the MOREINFO="NONE"default clause, see LINKEND="X80969"create table
 in this chapter.Using Cross-Database Referential Integrity ConstraintsMARK="BULL" REMAP="BU--Bullet"When you create a cross-database constraint, SQL Server stores the following information in the sysreferences system table of each database:TOCENTRY="1"LBL="Table 1-2: "Information stored about referential integrity constraintsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="10*"COLNAME="C3" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Information 
Stored in 
sysreferencesCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Columns with Information about theCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Referenced TableCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Referencing TableVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Key Column IDsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"refkey1 through refkey16COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fokey1 through fokey16COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table IDCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"reftabidCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tableidCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database NameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pmrydbname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"frgndbnameYou can drop the referencing table or its database without problems. SQL Server automatically removes the foreign key information from the referenced database.Because the referencing table depends on information from the referenced table, SQL Server does not allow you to:MARK="DASH" REMAP="BS--BulletSub"Drop the referenced table,Drop the external database that contains it, orRename either database with MOREINFO="NONE"sp_renamedbREMAP="UN--Under"You must first remove the cross-database constraint with MOREINFO="NONE"alterMOREINFO="NONE" table.Each time you add or remove a cross-database constraint, or drop a table that contains a cross-database constraint, dump both of the affected databases. Loading earlier dumps of these databases could cause database corruption.The sysreferences system table stores the name-not the ID number-of the external database. SQL Server cannot guarantee referential integrity if you use MOREINFO="NONE"loadMOREINFO="NONE" database to change the database name or to load it onto a different server.Before dumping a database in order to load it with a different name or move it to another SQL Server, use alter table to drop all external referential integrity constraints.Adding IDENTITY ColumnsMARK="BULL" REMAP="BU--Bullet"When adding an IDENTITY column to a table, make sure the column precision is large enough to accommodate the number of existing rows. If the number of rows exceeds 10 precision - 1, SQL Server generates an error when adding the column.When you add an IDENTITY column to a table, SQL Server:MARK="DASH" REMAP="BS--BulletSub"Locks the table until all the IDENTITY column values have been generated. If a table contains a large number of rows, this process may be time consuming.Assigns each existing row a unique, sequential IDENTITY column value, beginning with the value 1. Logs each insert operation into the table. Use MOREINFO="NONE"dumpMOREINFO="NONE" transaction to clear the database's transaction log before adding an IDENTITY column to a table with a large number of rows. ID="IN4416-4314681"IDENTITY columnsinserting with alter tableEach time you insert a row into the table, SQL Server generates an IDENTITY column value one higher than the last. This value takes precedence over any defaults declared for the column in the MOREINFO="NONE"alter MOREINFO="NONE"table statement or bound to it with MOREINFO="NONE"sp_bindefault.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"See "Datatypes" for datatype 
compliance information.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PermissionsREMAP="BO--Body"MOREINFO="NONE"alter table permission defaults to the table owner; it cannot be transferred except to the Database Owner, who can impersonate the table owner by running the MOREINFO="NONE"setuser command. System Administrators can also alter users' tables. See AlsoCommands          LINKEND="X80969"create table
, LINKEND="X58548"drop tableTopics     LINKEND="X01073"IDENTITY ColumnsSystem procedures     LINKEND="X91431"sp_help
, LINKEND="X37949"sp_rename
ID="IN4419-4715086"alter table command
ID="IN4420-5115487"begin...end commandsID="X55146"begin...end
Encloses a series of SQL statements so that control-of-flow language, such as MOREINFO="NONE"if ... elseID="IN4524-5315789"Control-of-flow languagebegin...end and
, can affect the performance of the whole group. FORMAT="LINESPECIFIC"begin
MOREINFO="NONE"statement MOREINFO="NONE"block
endKeywords and OptionsREMAP="RI--RefIndent"statement block - a series of statements enclosed by MOREINFO="NONE"begin and MOREINFO="NONE"end. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"if (select avg(price) from titles) < $15 begin   update titles   set price = price * $2  select title, price   from titles   where price > $28 endREMAP="UN--Under"Without MOREINFO="NONE"begin and MOREINFO="NONE"end, the MOREINFO="NONE"if condition would cause execution of only one SQL statement. create trigger deltitle on titles for delete as if   (select count(*) from deleted, salesdetail   where salesdetail.title_id = deleted.title_id) > 0   begin     rollback transaction     print "You can't delete a title with sales."   end else   print "Deletion successful--no sales for this      title." CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"begin...MOREINFO="NONE"end blocks can nest within other MOREINFO="NONE"begin...endID="IN457-5515994"Nestingbegin...end blocks
 blocks. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoTopics     LINKEND="X12929"Control-of-Flow Language
ID="IN4520-5916398"begin...end commands
ID="IN4525-6316799"begin transaction commandID="X53982"begin transactionID="IN4625-65170101"User-defined transactionsbegin transaction
ID="IN4625-68173102"User-defined transactionsUser-defined transactionsSee also Transactions!see also
Marks the starting point of a user-defined transaction. FORMAT="LINESPECIFIC"begin {transaction | tran } [MOREINFO="NONE"transaction_name]Keywords and OptionsREMAP="RI--RefIndent"transaction_name - is the name assigned to this transaction. It must conform to the rules for identifiers. Use transaction names only on the outermost pair of nested MOREINFO="NONE"begin/MOREINFO="NONE"commit or MOREINFO="NONE"begin/MOREINFO="NONE"rollback statements.CommentsMARK="BULL" REMAP="BU--Bullet"See "LINKEND="X19352"Transactions
ID="IN4612-70175106"Transactionsbegin
" in this chapter for full information on using transaction statements. Define a transaction by enclosing SQL statements and/or system procedures within the phrases MOREINFO="NONE"begin transaction and MOREINFO="NONE"commit. If you set chained transaction mode, SQL Server implicitly invokes a MOREINFO="NONE"begin transaction before the following statements: MOREINFO="NONE"delete, MOREINFO="NONE"insert, MOREINFO="NONE"open, MOREINFO="NONE"fetch, MOREINFO="NONE"select, and MOREINFO="NONE"update. You must still explicitly close the transaction with a MOREINFO="NONE"commitID="IN4614-74179107"commit commandbegin transaction and
.To cancel all or part of a transaction, use the MOREINFO="NONE"rollback command. The MOREINFO="NONE"rollback ID="IN4616-78183108"rollback commandbegin transaction and
command must appear within a transaction: you cannot roll back a transaction after it is committed. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"begin transaction permission defaults to all users. No permission is required to use it. See AlsoCommands     LINKEND="X89531"commit
, LINKEND="X91510"rollback
, LINKEND="X69417"save transactionTopics     LINKEND="X19352"Transactions
ID="IN4625-82187113"begin transaction command
ID="IN4613-86191114"break commandID="X41626"break
Causes an exit from a MOREINFO="NONE"while loop. MOREINFO="NONE"break is often activated by an MOREINFO="NONE"if test. FORMAT="LINESPECIFIC"while MOREINFO="NONE"logical_expression MOREINFO="NONE"    statement break MOREINFO="NONE"    statementcontinue Keywords and OptionsREMAP="RI--RefIndent"logical_expression - is an expression (a column name, constant, any combination of column names and constants connected by arithmetic or bitwise operators, or a subquery) that returns TRUE, FALSE or NULL. If the logical expression contains a MOREINFO="NONE"selectID="IN4719-86192118"Logical expressionssyntax
ID="IN479-89195119"ArgumentsArgumentsSee also Logical expressions!see also Logical expressions
 statement, it must be enclosed in parentheses. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"while (select avg(price) from titles) < $30  begin   update titles   set price = price * 2   select max(price) from titles   if (select max(price) from titles) > $50      break   else      continue  end  begin   print "Too much for the market to bear" end REMAP="UN--Under"If the average price is less than $30, double the prices. Then select the maximum price. If it is less than or equal to $50, restart the MOREINFO="NONE"while loop and double the prices again. If the maximum price is more than $50, exit the MOREINFO="NONE"while loop and print a message. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"break causes an exit from a MOREINFO="NONE"while loop. Statements that appear after the keyword MOREINFO="NONE"endID="IN475-95201122"Loopswhile;while loop:exit with break
, which marks the end of the loop, are then executed. ID="IN4713-99205123"break commandwhile loopIf two or more MOREINFO="NONE"while loops are nested, the inner MOREINFO="NONE"breakID="IN477-103209124"Nestingwhile loops, break and
 exits to the next outermost loop. First all the statements after the end of the inner loop run, and then the next outermost loop restarts. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X69990"continue
MOREINFO="NONE", LINKEND="X37548"whileTopics     LINKEND="X12929"Control-of-Flow Language
, LINKEND="X20204"Expressions
ID="IN4713-107213128"break command
ID="IN4718-112218129"Checkpoint processID="X68400"checkpointID="IN4811-114221131"Dirty pagesUpdatingupdating;Updating:Ò dirtyÓ  pagesdirty pages
ID="IN4810-117224132"SavepointsSavepointsSee also Checkpoint process!see also Checkpoint process
Writes all "dirty" pages (pages that have been updated since they were last written) to the database device. FORMAT="LINESPECIFIC"checkpointExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"checkpoint REMAP="UN--Under"All "dirty" pages in the current database have been written to the database device, regardless of the system checkpoint schedule. CommentsAutomatic CheckpointsMARK="BULL" REMAP="BU--Bullet"Checkpoints causedby the MOREINFO="NONE"checkpointID="IN4820-117224136"Automatic operationscheckpointsID="IN486-120227137"TimingTimingSee also Time interval!see also Time intervalID="IN4813-123230138"Time intervalTime intervalSee also Timing!see also TimingID="IN488-125232139"Recoverytime and checkpoint command supplement automatic checkpoints, which occur at intervals calculated by SQL Server on the basis of the configurable value for maximum acceptable recovery time.The MOREINFO="NONE"checkpoint shortens the automatic recovery process by identifying a point at which all completed transactions are guaranteed to have been written to the database device. A typical MOREINFO="NONE"checkpoint takes about one second, though this figure varies depending on the amount of activity on SQL Server. ID="IN4830-125232140"Interval, automatic checkpointautomatic checkpointThe automatic MOREINFO="NONE"checkpoint interval is calculated by SQL Server on the basis of system activity and the recovery interval value in the system table syscurconfigs. The recovery interval determines MOREINFO="NONE"checkpointID="IN486-125232141"Timingautomatic checkpoint
 frequency by specifying the amount of time it should take the system to recover. Reset this value by executing the system procedure MOREINFO="NONE"sp_configure and the MOREINFO="NONE"reconfigure command. For more information, see the System Administration Guide. Manual CheckpointsMARK="BULL" REMAP="BU--Bullet"Use MOREINFO="NONE"checkpoint only as a precautionary measure in special circumstances. For example, you are instructed to issue the MOREINFO="NONE"checkpoint command after resettingID="IN4819-129236142"select into commandcheckpoint and
MOREINFO="NONE" select into/bulk copy. ID="IN4819-131238143"Roll back processescheckpoint andUse MOREINFO="NONE"checkpointID="IN4828-133240144"sp_dboption system procedurecheckpoints and
 each time you change a database option with the system procedure MOREINFO="NONE"sp_dboption. If you use MOREINFO="NONE"sp_dboption inside a user-defined transaction, and then roll back that transaction, you must issue another MOREINFO="NONE"checkpoint command in order to make the rollback take effect on the option change. REMAP="UN--Under"For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"begin tran use master go
  sp_dboption "pubs2", "single", "true" go use
pubs2 go checkpoint go   rollback tran go REMAP="UN--Under"If the following checkpoint is not issued, the MOREINFO="NONE"pubs2 database remains single-user. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"checkpoint goStandards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"checkpoint permission defaults to the Database Owner. It cannot be transferred. See AlsoCommands     LINKEND="X18140"reconfigureSystem procedures     LINKEND="X29657"sp_dboption
ID="IN4818-138245149"Checkpoint process
ID="IN4811-140247150"Dirty pagesUpdatingupdating;Updating:Ò dirtyÓ  pagesdirty pages
ID="IN4813-144251151"close commandID="X78688"closeID="IN497-144252153"Cursorsclosing;Closing cursors
Deactivates a cursor.FORMAT="LINESPECIFIC"close cursor_nameParametersREMAP="RI--RefIndent"cursor_name - is the name of the cursor to close.ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"close authors_crsrREMAP="UN--Under"Closes the cursor named authors_crsr.CommentsMARK="BULL" REMAP="BU--Bullet"SQL Server returns an error message if the cursor is already closed or does not exist.The MOREINFO="NONE"close command essentially removes the cursor's result set. The cursor position within the result set is undefined for a closed cursor.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantSee AlsoCommands     LINKEND="X15455"deallocate cursor
, LINKEND="X11816"declare cursor
, LINKEND="X18078"fetch
, LINKEND="X29776"openTopics     LINKEND="X80039"Cursors
ID="IN4913-148256161"close command
ID="IN4914-152260162"commit commandID="X89531"commitID="IN5039-158267164"commit work command. See commit command
ID="IN5025-160269165"User-defined transactionsending with commit
ID="IN5012-162271166"Transactionsending with commit
Marks the ending point of a user-defined transaction. FORMAT="LINESPECIFIC"commit [transaction | tran | work] [MOREINFO="NONE"transaction_name] Keywords and OptionsREMAP="RI--RefIndent"transaction_name - is the name assigned to the transaction. It must conform to the rules for identifiers. Use transaction names only on the outermost pair of nested MOREINFO="NONE"begin/MOREINFO="NONE"commit or MOREINFO="NONE"begin/MOREINFO="NONE"rollback statements. CommentsMARK="BULL" REMAP="BU--Bullet"See LINKEND="X19352""Transactions"
 in Chapter 3 for full information on using transaction statements. ID="IN5025-170279170"begin transaction commandcommit and;commit command:begin transaction andDefine a transaction by enclosing SQL statements and/or system procedures with the phrases MOREINFO="NONE"begin transaction and MOREINFO="NONE"commitID="IN5024-172281171"Chained transaction modecommit and;Transactions:chained
. If you set the chained transaction mode, SQL Server implicitly invokes a MOREINFO="NONE"begin transaction before the following statements: MOREINFO="NONE"delete, MOREINFO="NONE"insert, MOREINFO="NONE"open, MOREINFO="NONE"fetch, MOREINFO="NONE"select, and MOREINFO="NONE"update. You must still explicitly enclose the transaction with a MOREINFO="NONE"commit.ID="IN5014-180289172"commit commandrollback and;rollback command:commit andTo cancel all or part of an entire transaction, use the MOREINFO="NONE"rollback command. The MOREINFO="NONE"rollback command must appear within a transaction; you cannot roll back a transaction after the MOREINFO="NONE"commit has been entered. If no transaction is currently active, the MOREINFO="NONE"commit or MOREINFO="NONE"rollback statement has no effect on SQL Server.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The MOREINFO="NONE"commit transaction and 
MOREINFO="NONE"commit tran forms of the 
statement are Transact-SQL 
extensions.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PermissionsREMAP="BO--Body"MOREINFO="NONE"commit permission defaults to all users. See AlsoCommands     LINKEND="X53982"begin transaction
, LINKEND="X91510"rollback
, LINKEND="X69417"save transactionTopics     LINKEND="X19352"Transactions
ID="IN5014-184293177"commit command
ID="IN5014-188297178"compute clauseID="X48334"compute ClauseID="IN5114-190300180"Row aggregatescompute and
ID="IN5114-192302181"Summary valuesgeneration with compute
ID="IN5129-192302182"Subgroups, summary values for
Generates summary values that appear as additional rows in the query results. This allows you to see the detail and summary rows in one set of results. You can calculate summary values for subgroups, and you can calculate more than one aggregate for the same group. FORMAT="LINESPECIFIC"Start of MOREINFO="NONE"select statement MOREINFO="NONE"compute MOREINFO="NONE"row_aggregate (MOREINFO="NONE"column_name)     [, MOREINFO="NONE"row_aggregate(MOREINFO="NONE"column_name)]... [by MOREINFO="NONE"column_name [, MOREINFO="NONE"column_name]...] Keywords and OptionsREMAP="RI--RefIndent"row_aggregate - is one of the following: TOCENTRY="1"LBL="Table 1-3: "Row aggregate functions used with the compute clause COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="26*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sum COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Total of values in the (numeric) column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"avg COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Average of values in the (numeric) column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"min COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Lowest value in the column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"max COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Highest value in the column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"count COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of values in the column column_name - is the name of a column. It must be enclosed in parentheses. Only numeric columns can be used with MOREINFO="NONE"sum and MOREINFO="NONE"avg. REMAP="UN--Under"One MOREINFO="NONE"compute clause can apply several aggregate functions to the same set of grouping columns (see examples 2 and 3). To create more than one group, use more than one MOREINFO="NONE"compute clause (see example 5). ID="IN5125-194304185"by row aggregate subgroup
MOREINFO="NONE"by - indicates that row aggregate values are to be calculated for subgroups. Whenever the value of the MOREINFO="NONE"by item changes, row aggregate values are generated. If you use MOREINFO="NONE"by, you must use MOREINFO="NONE"order by. REMAP="UN--Under"Listing more than one item after MOREINFO="NONE"by breaks a group into subgroups and applies a function at each level of grouping. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select type, price from titles where price > $12 and type like "%cook" order by type, price compute sum(price) by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type       price 
---------  ------------ 
mod_cook          19.99 
           sum 
           ------------ 
                  19.99 
type       price 
---------  ------------ 
trad_cook         14.99 
trad_cook         20.95 
           sum 
           ------------ 
                  35.94 
(5 rows affected)REMAP="UN--Under"Calculates the sum of the prices of each type of cooking book that costs more than $12. select type, price, advance from titles where price > $12 and type like "%cook" order by type, price compute sum(price), sum(advance) by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type       price      advance ---------  ---------  ------------ mod_cook       19.99          0.00           sum         sum            ---------  ------------                19.99          0.00REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type       price      advance ---------  ---------  ------------ trad_cook      14.99      8,000.00 trad_cook      20.95      7,000.00            sum        sum            ---------  ------------                35.94     15,000.00 (5 rows affected)REMAP="UN--Under"Calculates the sum of the prices and advances for each type of cooking book costing over $12. select type, price, advance from titles where price > $12 and type like "%cook" order by type, price compute sum(price), max(advance) by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type      price     advance --------- --------- ------------- mod_cook      19.99         0.00           sum           ---------               19.99                     max                     -------------                              0.00 REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type      price     advance --------- --------- ------------- trad_cook     14.99      8,000.00 trad_cook     20.95      7,000.00           sum           ---------               35.94                      max                      -------------                           8,000.00 (5 rows affected) REMAP="UN--Under"Calculates the sum of the prices and maximum advance of each type of cooking book costing over $12. select type, pub_id, price from titles where price > $10 and type = "psychology" order by type, pub_id, price compute  sum(price) by type, pub_id REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type         pub_id    price ------------ --------- ----------- psychology   0736          10.95 psychology   0736          19.99                         sum                         ---------                            30.94 REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type         pub_id    price ------------ --------- --------- psychology   0877          21.59                        sum                        ---------                            21.59(5 rows affected) REMAP="UN--Under"Breaks on type and pub_id and calculates the sum of the prices of psychology books by type-publisher ID combination. select type, pub_id, price from titles where price > $10 and type = "psychology" order by type, pub_id, price compute  sum(price) by type, pub_id compute  sum(price) by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type         pub_id    price ------------ --------- --------- psychology   0736          10.95 psychology   0736          19.99                        sum                        ---------                            30.94REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type         pub_id    price ------------ --------- --------- psychology   0877          21.59                        sum                        ---------                            21.59                        sum                        ---------                            52.53 (6 rows affected)REMAP="UN--Under"Calculates the grand total of the prices of psychology books that cost more than $10 in addition to sums by type and pub_id. select type, price, advance from titles where price > $10 and type like "%cook" compute sum(price), sum(advance)REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type       price        advance ---------  -----------  -------------- mod_cook         19.99            0.00 trad_cook        20.95        8,000.00 trad_cook        11.95        4,000.00 trad_cook        14.99        7,000.00             sum         sum            -----------  --------------                  67.88       19,000.00 (5 rows affected) REMAP="UN--Under"Calculates the grand totals of the prices and advances of cooking books that cost more than $10. select type, price, price*2 from titles where type like "%cook" compute sum(price), sum(price*2) REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type         price                                  ------------ --------------  ------------  mod_cook              19.99         39.98  mod_cook               2.99          5.98  trad_cook             20.95         41.90  trad_cook             11.95         23.90  trad_cook             14.99         29.98               sum             sum                        =============   ============                      70.87        141.74 REMAP="UN--Under"Calculates the sum of the price of cooking books, and the sum of the price used in an expression. CommentsRestrictionsID="IN517-196306188"Cursorscompute clause andMARK="BULL" REMAP="BU--Bullet"You cannot use a MOREINFO="NONE"compute clause in a cursor declaration. ID="IN5111-196306189"Expressionssummary values forSummary values can be computed for expressions as well as for columns. Any expression or column that appears in the MOREINFO="NONE"compute clause must appear in the MOREINFO="NONE"select list. ID="IN517-198308190"Aliasescompute clauses allowingAliases for column names are not allowed as arguments to the row aggregate in a MOREINFO="NONE"compute clause, although they can be used in the MOREINFO="NONE"select list, the MOREINFO="NONE"order by clause, and the MOREINFO="NONE"by clause of MOREINFO="NONE"compute. ID="IN5119-202312191"select into commandnot allowed with computeYou cannot use MOREINFO="NONE"select MOREINFO="NONE"into in the same statement as a MOREINFO="NONE"compute clause, because statements that include MOREINFO="NONE"compute do not generate normal tables. ID="IN5115-206316192"order by clausecompute by andIf you use MOREINFO="NONE"compute by, you must also use an MOREINFO="NONE"order by clause. The columns listed after MOREINFO="NONE"compute by must be identical to or a subset of those listed after MOREINFO="NONE"order by, and must be in the same left-to-right order, start with the same expression, and not skip any expressions. For example, if the MOREINFO="NONE"order by clause is: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"order by a, b, cREMAP="UN--Under"the MOREINFO="NONE"compute by clause can be any (or all) of these: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"compute by a, b, c compute by a, b compute by a ID="IN5114-210320193"compute clausewithout byThe MOREINFO="NONE"compute keyword can be used without MOREINFO="NONE"byID="IN5112-212322194"Grand totalscompute
 to generate grand totals, grand counts, and so on. MOREINFO="NONE"order by is optional if you use the MOREINFO="NONE"compute keyword without MOREINFO="NONE"by. See Example 6. In a MOREINFO="NONE"select statement with a MOREINFO="NONE"compute clause, the order of columns in the select list overrides the order of the aggregates in the MOREINFO="NONE"compute clause. DB-Library programmers must be aware of this in order to put the aggregate results in the right place. See LINKEND="X24911""Row Aggregate Functions"
ID="IN515-212322195"Ordercolumns and row aggregates
 for an example. MOREINFO="NONE"compute Results Appear as a New RowMARK="BULL" REMAP="BU--Bullet"The aggregate functions ordinarily produce a single value for all the selected rows in the table or for each group, and these summary values are shown as new columns. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select type, sum(price), sum(advance) from titles where type like "%cook" group by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type -------------  ---------  ---------- mod_cook           22.98  15,000.00 trad_cook          47.89  19,000.00 (2 rows affected)The compute clause makes it possible to retrieve detail and summary rows with one command. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select type, price, advancefrom titles where type like "%cook" order by type compute sum(price), sum(advance) by typeREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type       price      advance ---------  ---------  -------------- mod_cook        2.99       15,000.00 mod_cook       19.99            0.00            sum        sum            ---------  --------------                22.98       15,000.00  type       price      advance ---------  ---------  -------------- trad_cook      11.95        4,000.00 trad_cook      14.99        8,000.00 trad_cook      20.95        7,000.00            sum        sum            ---------  --------------                47.89       19,000.00  (7 rows affected) Case SensitivityID="IN5116-214324196"Case sensitivitycompute andMARK="BULL" REMAP="BU--Bullet"If your server has a case-insensitive sort order installed, MOREINFO="NONE"compute ignores the case of the data in the columns you specify. For example, given this data:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select * from groupdemoREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"lname      amount ---------- ------------------ Smith                  10.00 smith                   5.00 SMITH                   7.00 Levi                    9.00 Lévi                   20.00REMAP="UN--Under"Using MOREINFO="NONE"compute MOREINFO="NONE"by on lname produces these results: REMAP="UI--UserInput" FORMAT="LINESPECIFIC" select lname, amount from groupdemo order by lname compute sum(amount) by lnameREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC" lname      amount                    ---------- ------------------------  Levi                           9.00             sum                                  ------------------------                                 9.00   lname      amount                    ---------- ------------------------  Lévi                          20.00             sum                                  ------------------------                                20.00   lname      amount                    ---------- ------------------------  smith                          5.00  SMITH                          7.00  Smith                         10.00             sum                                  ------------------------                                22.00ID="IN5118-216326197"Accent sensitivitycompute andREMAP="UN--Under"The same query on a case- and accent insensitive server produces these results:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC" lname      amount                    ---------- ------------------------  Levi                           9.00  Lévi                          20.00             sum                                  ------------------------                                29.00  lname      amount                    ---------- ------------------------  smith                          5.00  SMITH                          7.00  Smith                         10.00             sum                                  ------------------------                                22.00 Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance levelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X96182"group by and having Clauses
, LINKEND="X35229"selectFunctions     LINKEND="X79130"Aggregate Functions
, LINKEND="X24911"Row Aggregate Functions
ID="IN5114-220330201"compute clause
ID="IN5116-224334202"continue commandID="X69990"continueID="IN5210-228339204"while loopcontinue
Causes the MOREINFO="NONE"while loop to restart. MOREINFO="NONE"continueID="IN5220-232343205"if...else conditionscontinue and
 is often activated by an MOREINFO="NONE"if test. FORMAT="LINESPECIFIC"while MOREINFO="NONE"boolean_expression MOREINFO="NONE"    statement break MOREINFO="NONE"    statement continue ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"while (select avg(price) from titles) < $30 begin   update titles   set price = price * 2   select max(price) from titles    if (select max(price) from titles) > $50       break   else       continue end  begin print "Too much for the market to bear" end REMAP="BO--Body"If the average price is less than $30, double the prices. Then select the maximum price. If it is less than or equal to $50, restart the MOREINFO="NONE"while loop and double the prices again. If the maximum price is more than $50, exit the MOREINFO="NONE"while loop and print a message. CommentsMARK="BULL" REMAP="BU--Bullet"ID="IN525-236347209"Loopswhile, continue and
MOREINFO="NONE"continue causes the MOREINFO="NONE"whileID="IN5222-238349210"Restarting while loops
 loop to restart, skipping any statements after MOREINFO="NONE"continue. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X41626"break
, LINKEND="X37548"whileTopics     LINKEND="X12929"Control-of-Flow Language
, LINKEND="X20204"Expressions
ID="IN5216-242353214"continue commandREMAP="BO--Body"ID="X75308"create databaseID="IN43239662"create database command
ID="IN43229664"New database, creating
ID="IN4379395"Copyingwith create database
Creates a new database. Use MOREINFO="NONE"create database from the masterID="IN431588146"tempdb databasetempdb databaseSee also Databases!see also Databases
 database. FORMAT="LINESPECIFIC"create database MOREINFO="NONE"database_name [on {default | MOREINFO="NONE"database_device} [= MOREINFO="NONE"size]      [, MOREINFO="NONE"database_device [= MOREINFO="NONE"size]]...] [log on MOREINFO="NONE"database_device [= MOREINFO="NONE"size]     [, MOREINFO="NONE"database_device [= MOREINFO="NONE"size]]...][with override][for load]Keywords and OptionsREMAP="RI--RefIndent"database_name - is the name of the new database. It must conform to the rules for identifiers. MOREINFO="NONE"on - is a keyword indicating that you want to specify a location and (optionally) a size for the database. ID="IN4324881410"Location of new database
MOREINFO="NONE"default - indicates that MOREINFO="NONE"create database can put the new database on any default database device(s) (as shown in sysdevices.status). To specify a size for the database without specifying a location, use this command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"on default = MOREINFO="NONE"size REMAP="UN--Under"To change a database device's status to default, use the system procedure MOREINFO="NONE"sp_diskdefault. ID="IN4316881411"Database devicesnew database;Logical device name:new database
database_device - is the logical name of the device on which you want to locate the database. A database can occupy different amounts of space on each of several database devices. ID="IN435851712"BytesBytesSee also Size!see also Size
ID="IN434851713"Sizenew database;Space:new database
size ID="IN4316831914"Restarts, Serverbefore using create database
- is the amount of space allocated to the database in megabytes. SQL Server-supplied default size is 2 MB. System Administrators can increase the default size by using MOREINFO="NONE"sp_configure, issuing the MOREINFO="NONE"reconfigure command, and restarting SQL Server. The default size must be at least as large as the MOREINFO="NONE"model database. If you increase the size of the MOREINFO="NONE"model database, the default size must also be increased. The legal values for database size range from 2 to 2048 MB. REMAP="UN--Under"If SQL Server cannot give you as much space as you want where you have requested it, it comes as close as possible on a per-device basis, and prints a message telling how much space was allocated where. ID="IN4323752715"create database commandlog on option;log on option:create database
MOREINFO="NONE"log MOREINFO="NONE"on - specifies the logical name of the device that will be used to store the database logs. You can specify more than one device in the MOREINFO="NONE"log MOREINFO="NONE"on clause.ID="IN4320673516"with override optionfor load and;for load option:with override
MOREINFO="NONE"with override- allows you to specify the same device name in the MOREINFO="NONE"on and MOREINFO="NONE"log on clauses, even if this creates a device fragment with data and a device fragment with log on the same device. You can still use MOREINFO="NONE"dump transaction on the log segment, but if the device fails, you cannot use the MOREINFO="NONE"with no_truncate option to recover changes made since your last dump. If you attempt to mix log and data on the same device without this clause, the MOREINFO="NONE"create database command fails. If you mix log and data, and use MOREINFO="NONE"with override, you are warned, but the command succeeds.ID="IN4315633917"for load optioncreate database
MOREINFO="NONE"for load - invokes a streamlined version of MOREINFO="NONE"create database that can only be used for loading a database dump. Use this option for recovery from media failure or for moving a database from one machine to another. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create database pubscreate database pubs on default = 4 create database pubs on datadev = 3, moredatadev = 2 create database pubs on datadev = 3 log on logdev = 1 CommentsRestrictionsID="IN439633921"Databasesnumber of Server;Number (quantity of):databases Server can manage;Servers:capacity for databasesMARK="BULL" REMAP="BU--Bullet"SQL Server can manage up to 32,767 databases. ID="IN4314594322"model databaseCopyingcopying the;Copying:the model databasemodel database
ID="IN4339594323"Collision of database creation requestsOnly one database can be created at a time. If two database creation requests collide, one user will get this message:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"model database in use: cannot create new databaseID="IN4316594324"Device fragmentsnumber of;Number (quantity of):device fragmentsThe maximum number of device fragments for any database is 128. Each time you allocate space on a database device with MOREINFO="NONE"create database or MOREINFO="NONE"alter database, that allocation represents a device fragment, and the allocation is entered as a row in sysusages. ID="IN4320594325"Number (quantity of)named segments;Segments:number of namedThe maximum number of named segments for any database is 32. Segments are named subsets of database devices available to a particular SQL Server. For more information on segments, see the System Administration GuideID="IN438564626"SegmentsSegmentsSee also Database devices; Log segment; Space allocation!see also
. ID="IN4336525027"database size configuration variabledatabase size configuration variablein sysconfiguressysconfiguresIf you do not specify a location and size for a database, the default location is any default database device(s) indicated in master..sysdevices. The default size is the larger of the size of the MOREINFO="NONE"model database or the MOREINFO="NONE"database sizeID="IN4319485428"sysconfigures tabledatabase size parameter
 parameter in sysconfigures. New Databases Are Created from MOREINFO="NONE"model MARK="BULL" REMAP="BU--Bullet"SQL Server creates a new database by copying the MOREINFO="NONE"model database. You can customize model by adding tables, stored procedures, user-defined datatypes, and other objects and by changing database option settings. New databases inherit these objects and settings from model.ID="IN4314465629"Speed (Server)Speed (Server)of create database for loadcreate database for loadTo guarantee recoverability, the MOREINFO="NONE"create database command must clear every page that was not initialized when the model database was copied. This may take several minutes, depending on the size of the database and the speed of your system.REMAP="UN--Under"If you are creating a database in order to load a database dump into it, you can use the MOREINFO="NONE"for load option to skip the page clearing step. This makes database creation considerably faster.Ensuring Database RecoverabilityID="IN4327426030"Recovery of master databaseafter using create databaseMARK="BULL" REMAP="BU--Bullet"Back up the MOREINFO="NONE"master database each time you create a enw database.. This makes recovery easier and safer in case master is damaged. If you create a database and fail to back up masterID="IN4318386431"disk refit commandcreate database and
, you may be able to recover the changes with MOREINFO="NONE"disk refit. ID="IN4321346832"dump database commandafter using create databaseThe MOREINFO="NONE"withMOREINFO="NONE" override clause allows you to mix log and data segments on a single device. However, for full recoverability, the device or devices specified in MOREINFO="NONE"log MOREINFO="NONE"on should be different than the physical device that stores the data. In the event of a hard disk crash, the database can be recovered from database dumps and the transaction logs. A small database can be created on a single device, and the transaction log stored together with the rest of the database, but you must rely on theMOREINFO="NONE" dump database command for backups. ID="IN435317133"SpaceSpaceSee also Size; Space allocation!see also Size; Space allocation
ID="IN434317134"Sizetransaction log device;Space allocation:log device
ID="IN4310317135"Log devicespace allocationThe size of the device required for the transaction log varies according to the amount of update activity and the frequency of transaction log dumps. As a rule of thumb, allocate to the log device 10% to 25% of the space you allocate to the database itself. It is best to start small, since space allocated to a transaction log device cannot be reclaimed and cannot be used for storage of data. ID="IN4315277536"for load optioncreate database
ID="IN4314277537"Dump, databaseloading;Load, database:new databaseIf you create a database using the MOREINFO="NONE"for load option, you can run only the following commands in the new database before loading a database dump: MARK="DASH" REMAP="BS--BulletSub"MOREINFO="NONE"alterMOREINFO="NONE" databaseMOREINFO="NONE" forMOREINFO="NONE" load MOREINFO="NONE"dropMOREINFO="NONE" database MOREINFO="NONE"load database REMAP="UN--Under"Use MOREINFO="NONE"alter database for load to create the new database in the image of the database from which the database dump to be loaded was made. See the System Administration Guide for a discussion of duplicating space allocation when loading a dump into a new database.ID="IN4311277538"DuplicationDuplicationof space for a new databasespace for a new databaseREMAP="UN--Under"After you load the database dump into the new database, there are no restrictions on the commands you can use.Getting Information About DatabasesMARK="BULL" REMAP="BU--Bullet"To get a report on a database, execute the system procedure MOREINFO="NONE"sp_helpdb. For a report on the space used in a database, use MOREINFO="NONE"sp_spaceusedID="IN437247839"Copyingwith create database
. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"create database permission defaults to System Administrators, who can transfer it to users who are listed in the sysusers table of the current database. However, MOREINFO="NONE"create database permission is often centralized in order to maintain control over database storage allocation. See the System Administration Guide for details. REMAP="BO--Body"MOREINFO="NONE"create database permission is not included in the MOREINFO="NONE"grant MOREINFO="NONE"all command. See AlsoCommands     LINKEND="X61977"alter database
MOREINFO="NONE", LINKEND="X72692"drop database
MOREINFO="NONE", LINKEND="X68345"dump database
MOREINFO="NONE", LINKEND="X28090"load databaseSystem procedures     LINKEND="X78355"sp_changedbowner
MOREINFO="NONE", LINKEND="X92302"sp_diskdefault
MOREINFO="NONE", LINKEND="X90458"sp_helpdb
MOREINFO="NONE", LINKEND="X21496"sp_logdevice
MOREINFO="NONE", LINKEND="X99854"sp_renamedb
MOREINFO="NONE", LINKEND="X50477"sp_spaceused
ID="IN4323208244"create database command
ID="IN4322129045"create default commandcreate default commandID="X81463"create defaultID="IN44899447"Defaultsdefinitions and create default
ID="IN44789548"Columnsdefaults for
Specifies a value to insert in a column (or in all columns of a user-defined datatype) if no value is explicitly supplied at insert time. FORMAT="LINESPECIFIC"create default [MOREINFO="NONE"owner.]MOREINFO="NONE"default_name as MOREINFO="NONE"constant_MOREINFO="NONE"expressionKeywords and OptionsREMAP="RI--RefIndent"default_name - is the name of the default. It must conform to the rules for identifiers. constant_expression ID="IN441689551"Binary datatypesBinary datatypesÒ 0xÓ  prefix;Hexadecimal numbers, Ò 0xÓ  prefix for0x prefix
- is an expression that does not include the names of any columns or other database objects. You can include built-in functions that do not reference database objects. Enclose character and date constants in quotes and precede binary constants with 0x. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create default phonedflt as "UNKNOWN" REMAP="UN--Under"Defines a default value. Now you need to bind it to the appropriate column or user-defined datatype with the MOREINFO="NONE"sp_bindefault system stored procedure. sp_bindefault phonedflt, "authors.phone" REMAP="UN--Under"The default takes effect only if there is no entry in the phone column of the authorsID="IN441449953"insert commandcreate default and
ID="IN4420210154"isql utility commanddefaults and
 table. "No entry" is different than entering a null value. To get the default using MOREINFO="NONE"isql, you must issue an MOREINFO="NONE"insert command with a column list that does not include the column that has the default.create default todays_date as getdate()REMAP="UN--Under"Creates a default value, todays_date, that inserts the current date into columns to which it is bound.CommentsID="IN447110256"BindingdefaultsRestrictionsMARK="BULL" REMAP="BU--Bullet"You can only create a default in the current database. ID="IN4430-310657"sp_bindefault system procedurecreate default andBind a default to a column or user-defined datatype-but not a SQL ServerMOREINFO="NONE"-supplied datatype- with MOREINFO="NONE"sp_bindefault. ID="IN4422-711058"create default commandbatches and;Batch processing:create default command
MOREINFO="NONE"create default statements cannot be combined with other statements in a single batch. You must MOREINFO="NONE"drop a default before you MOREINFO="NONE"create a new one of the same name, and you must unbind a default (with the system procedure MOREINFO="NONE"sp_unbindefault) before you MOREINFO="NONE"drop it. You can bind a new default to a column or datatype without unbinding the old one: the new default overrides and automatically unbinds the old one. ID="IN448-711059"Droppinguser-defined default
ID="IN4410-711060"Precedencedefault bindingYou can bind one default to a user-defined datatype, and another default to a column of that datatype. The default most recently bound takes precedence. Datatype CompatibilityID="IN4419-911261"Compatibility, datacreate default and;Datatypes:compatibility of column and defaultMARK="BULL" REMAP="BU--Bullet"SQL Server generates an error message when it tries to insert a default value that is not compatible with the column's datatype. For example, if you bind the default "N/A" to an integer column, any MOREINFO="NONE"insertthat does not specify the column value will fail. If a default value is too long for a character column, SQL Server either truncates the string or generates an exception, depending on the setting of the string_rtruncation option. For more information, see the LINKEND="X64136"set
ID="IN447-1011362"Bindingdefaults
 command.ID="IN4417-1211563"syscomments tabledefault definitions inGetting Information About DefaultsMARK="BULL" REMAP="BU--Bullet"Default definitions are stored in syscommentsID="IN4413-1211564"System tablesdefault definitions in
. After a default is bound to a particular column  its object ID is stored in syscolumns. After a default is bound to a user-defined datatype,  its object ID is stored in systypes. To display definitions and binding information, execute the system procedure MOREINFO="NONE"sp_help with the default name as the parameter. To rename a default, use MOREINFO="NONE"sp_rename. For a report on the text of a default, use MOREINFO="NONE"sp_helptext. ID="IN448-1211565"Droppingdefault after unbinding it;Unbinding:defaults
ID="IN445-1211566"Rulesdefault violation of;Defaults:conflictions with rulesDefaults and RulesMARK="BULL" REMAP="BU--Bullet"If a column has both a default and a rule associated with it, the default value must not violate the rule. A default that conflicts with a rule will never be inserted. SQL Server will generate an error message each time it attempts to insert such a default. Defaults and NullsID="IN447-1211567"Columnsnull values and default;Null values:column defaults and
ID="IN4415-1211568"Not null valuesdefiningMARK="BULL" REMAP="BU--Bullet"If you specify NOT NULL when you create a column and do not create a default for it, an error message will display whenever a user fails to make an entry in that column. ID="IN4411-1211569"Null valuesdefining;Null values:new column;Null values:null defaults andThe following table illustrates the relationship between the existence of a default and the definition of a column as NULL or NOT NULL. The entries in the table show the result: TOCENTRY="1"LBL="Table 1-4: "Relationship between nulls and column defaultsCOLS="5" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="5*"COLNAME="C4" COLWIDTH="5*"COLNAME="C5" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"No Entry, No DefaultCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"No Entry, 
DefaultCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enter NULL, 
No DefaultCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enter NULL, 
DefaultVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nullCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"defaultCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nullCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nullCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULLCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"errorCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"defaultCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"errorCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"errorSpecifying a Default Value in MOREINFO="NONE"create tableMARK="BULL" REMAP="BU--Bullet"You can also define column defaults using the MOREINFO="NONE"default clause of the MOREINFO="NONE"createMOREINFO="NONE" table statement as an alternative to using MOREINFO="NONE"createMOREINFO="NONE" default. However, these column defaults are specific for that table; you cannot bind them to other tables. See "LINKEND="X80969"create table
" and "LINKEND="X68185"alter table
ID="IN447-1311670"Columnsdefaults for
ID="IN448-1611971"Defaultsdefinitions and create default
" for information about integrity constraints.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Use the MOREINFO="NONE"default clause of the 
MOREINFO="NONE"create table statement to create 
defaults that are SQL 89 and 
SQL92 compliant.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PermissionsREMAP="BO--Body"MOREINFO="NONE"create default permission defaults to the Database Owner, who can transfer it to other users. See AlsoCommands     LINKEND="X68185"alter table
MOREINFO="NONE",LINKEND="X43186"create rule
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X97463"drop default
MOREINFO="NONE", LINKEND="X62555"drop ruleTopics      LINKEND="X25196"Batch QueriesSystem procedures     LINKEND="X84736"sp_bindefault
MOREINFO="NONE", LINKEND="X91431"sp_help
MOREINFO="NONE",LINKEND="X25756"sp_helptext
MOREINFO="NONE", LINKEND="X37949"sp_rename
MOREINFO="NONE", LINKEND="X87638"sp_unbindefault
ID="IN4422-2412775"create default commandcreate default command
ID="IN4420-2813176"create index commandID="X58868"create indexID="IN457-3213678"Indexescreate index;Columns:creating indexes on
ID="IN4517-3513979"Clustered indexesClustered indexesSee also Indexes!see also Indexes
ID="IN4512-3814280"Pages (data)Pages (data)See also Index pages; Table pages!see also Index pages; Table pages
Creates an index on one or more columns in a table. FORMAT="LINESPECIFIC"create [unique] [clustered | nonclustered]    index MOREINFO="NONE"index_name on [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name (MOREINFO="NONE"column_name    [, MOREINFO="NONE"column_name]...) [with {fillfactor = x, ignore_dup_key, sorted_data,    [ignore_dup_row | allow_dup_row]}] [on MOREINFO="NONE"segment_name]Keywords and OptionsREMAP="RI--RefIndent"ID="IN4514-4214683"unique keywordcreate index
MOREINFO="NONE"unique - prohibits duplicate index (also called key) values. The system checks for duplicate key values when the index is created (if data already exists), and checks each time data is added with an MOREINFO="NONE"insert or MOREINFO="NONE"update. If there is a duplicate key value or if more than one row contains a null value, the command is aborted and an error message giving the duplicate is printed. ID="IN4511-4414884"Rows, tablecreate index and duplication of
ID="IN4511-4615085"Duplicationavoidance and create indexSQL Server does not detect duplicate rows if a table
contains any non-null MOREINFO="NONE"text or MOREINFO="NONE"image columns.REMAP="UN--Under"MOREINFO="NONE"update or MOREINFO="NONE"insert commands that generate duplicate key values are canceled, unless the index was created with MOREINFO="NONE"ignore_dup_row or MOREINFO="NONE"ignore_dup_key. ID="IN4517-4615086"Composite indexesREMAP="UN--Under"Composite indexes (indexes in which the key value is composed of more than one column) can also be unique. REMAP="UN--Under"The default is non-unique.ID="IN457-4715187"Indexestypes of
ID="IN459-5215688"Structureclustered and nonclustered index
ID="IN4517-5515989"Clustered indexescreate index clustered option for
MOREINFO="NONE"clusteredID="IN4522-5515990"Leaf levels of indexesclustered index;Index pages:leaf level
ID="IN4520-5515991"Number (quantity of)clustered indexes
 -means the physical order of rows on this database device is the same as the indexed order of the rows. The bottom or leaf level of the clustered index contains the actual data pages. A clustered index almost always retrieves data faster than a nonclustered index. Only one clustered index is permitted per table. REMAP="UN--Under"The clustered index is often created on the table's primary key-the column or columns that uniquely identify the row. The primary key can be recorded in the database (for use by front end programs and the system procedure MOREINFO="NONE"sp_depends) with the system procedure MOREINFO="NONE"sp_primarykey. If MOREINFO="NONE"clustered is not specified, MOREINFO="NONE"nonclusteredID="IN4517-5816292"Clustered indexescreate index clustered option for
ID="IN459-6316793"Structureclustered and nonclustered indexID="IN457-6416894"Indexestypes of is assumed. ID="IN457-6416895"Indexesnon-clustered;Non-clustered indexes
MOREINFO="NONE"nonclusteredID="IN4544-6416896"Indirection between index structure and data
ID="IN4520-6416897"Number (quantity of)nonclustered indexes
 - means that there is a level of indirection between the index structure and the data itself. You can have up to 249 nonclustered indexes per table. ID="IN457-6416898"Indexesnaming;Naming:indexes
index_name - is the name of the index. Index names must be unique within a table, but need not be unique within a database. table_name - is the name of the table in which the indexed column or columns are located. column_name ID="IN454-6416899"Sizecomposite index
ID="IN4517-64168100"Composite indexes
- is the column or columns to which the index applies. Composite indexes are based on the combined values of up to 16 columns. The sum of the maximum lengths of all the columns used in a composite index cannot exceed 256 bytes. List the columns to be included in the composite index (in sort-priority order) inside the parentheses after table_name. ID="IN4517-68172101"fillfactor optioncreate index
MOREINFO="NONE"fillfactor - specifies how full SQL Server will make each page when it is creating a new index on existing data. The MOREINFO="NONE"fillfactor percentage is relevant only at the time the index is created. As the data changes, the pages are not maintained at any particular level of fullness. ID="IN4511-70174102"Index pagesfillfactor values forREMAP="UN--Under"The default for MOREINFO="NONE"fillfactor is 0; this is used when you do not include MOREINFO="NONE"with fillfactor in the MOREINFO="NONE"create index statement (unless the value has been changed with MOREINFO="NONE"sp_configure). When specifying a MOREINFO="NONE"fillfactor, legal values are between 1 and 100. ID="IN455-71175103"SpaceSpacefor index pagesindex pagesREMAP="UN--Under"A MOREINFO="NONE"fillfactorID="IN4522-71175104"Leaf levels of indexesclustered index;Index pages:leaf level
 of 0 creates clustered indexes with completely full pages and nonclustered indexes with completely full leaf pages. It leaves a comfortable amount of space within the index B-tree in both the clustered and nonclustered cases. There is seldom a reason to change the MOREINFO="NONE"fillfactor. REMAP="UN--Under"If the MOREINFO="NONE"fillfactor is set to 100, SQL Server creates both clustered and nonclustered indexes with each page 100% full. A MOREINFO="NONE"fillfactor of 100 only makes sense for read-only tables-tables to which no additional data will ever be added. REMAP="UN--Under"MOREINFO="NONE"fillfactor values smaller than 100 (except 0, which is a special case) cause SQL Server to create new indexes with pages that are not completely full. A MOREINFO="NONE"fillfactor of 10 might be a reasonable choice if you are creating an index on a table that will eventually hold a great deal more data, but small MOREINFO="NONE"fillfactor values cause each index (or index and data) to take more storage space. ID="IN455-71175105"SpaceSpacedatabase storage;Space:for a clustered indexclustered indexCreating a clustered index with a MOREINFO="NONE"fillfactorID="IN455-72176106"SpaceSpacefor index pagesindex pages
 affects the amount of storage space your data occupies, since SQL Server redistributes the data as it creates the clustered index. ID="IN4511-74178107"Rows, tablecreate index and duplication of
ID="IN4511-76180108"Duplicationavoidance and create index
ID="IN4535-80184109"ignore_dup_key option, create index
MOREINFO="NONE"ignore_dup_key - responds to a duplicate key entry into a table that has a unique index (clustered or nonclustered). An attemptedMOREINFO="NONE" insert of a duplicate key is ignored, and the MOREINFO="NONE"insert is canceled with an informational message. REMAP="UN--Under"If MOREINFO="NONE"ignore_dup_key is in effect, a transaction that contains duplicate keys will proceed to completion, and informational messages about the presence of duplicate keys will appear. ID="IN4519-80184110"Canceling an updateWhen MOREINFO="NONE"ignore_dup_keyID="IN4514-86190111"update commandignore_dup_key and;Updating:ignore_dup_key and
 is in effect, an attempted update that creates a duplicate key causes that MOREINFO="NONE"update to be canceled. After the cancellation, any transaction that may have been active at the time may continue as though the MOREINFO="NONE"update had never taken place. REMAP="UN--Under"You cannot create a unique index on a column that includes duplicate values or more than one null value, whether or not MOREINFO="NONE"ignore_dup_key is set. If you attempt to do so, SQL Server prints an error message that gives the first of the duplicate values. You must eliminate duplicates before you create a unique index on the column. ID="IN4535-90194112"ignore_dup_row option, create indexMOREINFO="NONE"ignore_dup_row andID="IN4534-94198113"allow_dup_row option, create index
 MOREINFO="NONE"allow_dup_row - are options for creating a non-unique, clustered index. These options are not relevant when creating a non-unique, nonclustered index. (Since a SQL Server nonclustered index attaches a unique row identification number internally, it never worries about duplicate rows-even for identical data values.) REMAP="UN--Under"MOREINFO="NONE"ignore_dup_row and MOREINFO="NONE"allow_dup_row are mutually exclusive. REMAP="UN--Under"Including the MOREINFO="NONE"allow_dup_row option allows you to create a new, non-unique, clustered index on a table that includes duplicate rows. If a table has a nonunique clustered index that was created without the MOREINFO="NONE"allow_dup_row option, you cannot create new duplicate rows using the MOREINFO="NONE"insert or MOREINFO="NONE"update command.REMAP="UN--Under"If any index in the table is unique, the requirement for uniqueness takes precedence over the MOREINFO="NONE"allow_dup_row option. You cannot create an index with MOREINFO="NONE"allow_dup_row if a unique index exists on any column in the table. REMAP="UN--Under"The MOREINFO="NONE"ignore_dup_row option is also used with a non-unique, clustered index. The MOREINFO="NONE"ignore_dup_rowID="IN4514-98202114"update commandignore_dup_row and
 option is used to eliminate duplicates from a batch of data. MOREINFO="NONE"ignore_dup_row cancels any MOREINFO="NONE"insert or MOREINFO="NONE"update that would create a duplicate row, but does not roll back the entire transaction.REMAP="UN--Under"The MOREINFO="NONE"ignore_dup_row option is not allowed if a unique index exists on any column in the table. REMAP="UN--Under"This table illustrates how MOREINFO="NONE"allow_dup_row and MOREINFO="NONE"ignore_dup_row affect attempts to create a non-unique clustered index on a table that includes duplicate rows, and to enter duplicate rows into a table.TOCENTRY="1"LBL="Table 1-5: "Duplicate row optionsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="11*"COLNAME="C2" COLWIDTH="14*"COLNAME="C3" COLWIDTH="14*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"create index
(table has duplicate rows) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Insert duplicate rows VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Neither option setCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command fails.COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command fails. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"allow_dup_row setCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command completes.COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command completes. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ignore_dup_row setCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Index created but 
duplicate rows thrown 
out; error message.COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"All rows accepted 
except duplicates; 
error message. See 
warning.ID="IN457-98202115"Indexestypes ofREMAP="UN--Under"The following table shows how index options can be used: TOCENTRY="1"LBL="Table 1-6: "Index optionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="9*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Index TypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Options VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"clusteredCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ignore_dup_row | MOREINFO="NONE"allow_dup_row COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"unique clusteredCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ignore_dup_key COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nonclusteredCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"none COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"unique nonclusteredCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ignore_dup_key, MOREINFO="NONE"ignore_dup_rowID="IN4532-102206116"sorted_data option, create index
MOREINFO="NONE"sorted_data - speeds creation of an index when the data in the table is already in sorted order (for example, when you have used MOREINFO="NONE"bcp to copy data that has already been sorted into an empty table). The speed increase becomes significant on large tables and increases to several times faster in tables larger than a gigabyte. This option can be used in conjunction with any other MOREINFO="NONE"create index options with no effect on their operation. REMAP="UN--Under"If MOREINFO="NONE"sorted_data is specified but data is not in sorted order, an error message displays and the command is aborted. ID="IN4514-106210117"Speed (Server)Speed (Server)of create index with sorted_datacreate index with sorted_dataREMAP="UN--Under"This option speeds indexing only for clustered indexes or unique nonclustered indexes. Creating a non-unique nonclustered index succeeds unless there are rows with duplicate keys. If there are rows with duplicate keys, an error message displays and the command is aborted. ID="IN4511-110214118"on keywordcreate index;Segments:creating indexes onID="IN455-110214119"Namessegment;Segments:names ofMOREINFO="NONE"onMOREINFO="NONE"segment_name - specifies that the index is to be created on the named segment. Before the MOREINFO="NONE"on segment_name option can be used, the device must be initialized with MOREINFO="NONE"disk init, and the segment must be added to the database with the MOREINFO="NONE"sp_addsegment system procedure. See your System Administrator or use MOREINFO="NONE"sp_helpsegment for a list of the segment names available in your database.REMAP="UN--Under"If you specify MOREINFO="NONE"clustered and use the MOREINFO="NONE"on segment_name option, the entire table migrates to the segment you specify, since the leaf level of the index contains the actual data pages.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create index au_id_ind on authors (au_id)create unique clustered index au_id_ind on authors(au_id) create index ind1 on titleauthor (au_id, title_id)create nonclustered index zip_ind on authors(zip) with fillfactor = 25CommentsRestrictionsMARK="BULL" REMAP="BU--Bullet"You cannot create an index on a column with a datatype of bit, text, or image. ID="IN4520-110214122"Number (quantity of)nonclustered indexesA table can have a maximum of 249 nonclustered indexes.A table can have a maximum of one clustered index.ID="IN4516-110214123"Temporary tablesindexes onYou can create an index on a temporary table. It disappears when the table disappears. You can create an index on a table in another database, as long as you are the owner of that table. ID="IN457-110214124"Indexesviews andYou cannot create an index on a view. MOREINFO="NONE"createMOREINFO="NONE" index runs more slowly while a MOREINFO="NONE"dumpMOREINFO="NONE" database is taking place.Creating Indexes EfficientlyID="IN458-110214125"SegmentsSeparation, physicalseparation of table and index;Separation, physical:of table and index segmentstable and index segmentsMARK="BULL" REMAP="BU--Bullet"Indexes speed data retrieval but can slow data update. Performance improvements can be realized by creating a table on one segment, and its nonclustered indexes on another segment, when these segments are on separate physical devices. ID="IN456-113217126"MemoryMemorySee also Space!see also Space
ID="IN455-113217127"SpaceNumber of pagesextents;Extents;Number of pages:in an extentextent
ID="IN457-113217128"IndexesIndexeson joined columnsjoined columnsBy default, SQL Server reads and writes single data pages while creating indexes. A System Administrator can allocate buffers that allow MOREINFO="NONE"createMOREINFO="NONE" index to read and write 8 data pages (called an extent) at a time. This increases performance if you need to create indexes on large tables. See LINKEND="X60334"sp_configure
 in Volume 2 for more information.ID="IN455-113217129"OrderOrderof creating indexescreating indexes
ID="IN4510-113217130"Rebuildingautomatic, of nonclustered index
ID="IN456-113217131"Tablesmigration to a clustered index;Clustered indexes:migration of tables toCreate a clustered index before creating any nonclustered indexes, since nonclustered indexes are automatically rebuilt when a clustered index is created. Index all columns that are regularly used in joins. SQL Server runs MOREINFO="NONE"update statistics each time an index is created on existing data. You should run MOREINFO="NONE"updateMOREINFO="NONE" statistics periodically if you add data to the table that changes the distribution of keys in the index. The query optimizer uses the information created by MOREINFO="NONE"updateMOREINFO="NONE" statistics to select the best plan for running queries on the table.Space Requirements for IndexesID="IN4512-113217132"Pages (data)Pages (data)in an extentextentMARK="BULL" REMAP="BU--Bullet"Space is
allocated to tables and indexes in increments of one extent, or 8 pages, at a time. Each time an extent is filled, another extent is allocated. (Use the system procedure LINKEND="X50477"sp_spaceused to display the amount of space allocated and used by an index.) ID="IN4510-117221133"on keywordcreate indexA table "follows" its clustered index. When you create a table and then use the MOREINFO="NONE"onID="IN455-117221134"Namessegment;Segments:names of
 segment_name extension to MOREINFO="NONE"create MOREINFO="NONE"clustered MOREINFO="NONE"indexID="IN459-117221135"MigrationMigrationof tables to clustered indexestables to clustered indexes
ID="IN4530-120224136"Pointers, device. See Segments
, the table migrates to the segment where the index is created. ID="IN455-120224137"SpaceSpacefor a clustered indexclustered indexTo create a clustered index, SQL Server duplicates the
existing data; the server deletes the original data when the index is complete. Before creating a clustered index. use LINKEND="X50477"sp_spaceused to make sure that the database has at least 120% of the size of the table available as free space.The MOREINFO="NONE"sorted_data option does notID="IN455-120224138"Spacedatabase storage
 reduce the amount of space required to create an index.Getting Information About Tables and IndexesID="IN4517-120224139"Composite indexes
ID="IN4516-122226140"sysindexes tablecomposite indexes andMARK="BULL" REMAP="BU--Bullet"Each index-including  composite indexes- is represented by one row in sysindexes. ID="IN4520-122226141"Information (Server)space usageFor information on the order of the data retrieved through indexes, and the effects of a SQL Server's installed sort order, see the LINKEND="X14000"order by clause
.For information about a table's indexes, execute the system procedure MOREINFO="NONE"sp_helpindex.Using Unique Constraints in Place of IndexesMARK="BULL" REMAP="BU--Bullet"As an alternative to MOREINFO="NONE"createMOREINFO="NONE" index, you can implicitly create unique indexes by specifying a unique constraint with the MOREINFO="NONE"createMOREINFO="NONE" table or MOREINFO="NONE"alterMOREINFO="NONE" table statements. The unique constraint creates a clustered or non-clustered unique index on the columns of a table. These "implicit" indexes are named after the constraint and they follow the same rules for indexes created using MOREINFO="NONE"createMOREINFO="NONE" index.You cannot drop indexes supporting unique constraints using the MOREINFO="NONE"dropMOREINFO="NONE" index statement. Instead, they are dropped when the constraints are dropped through an MOREINFO="NONE"alterMOREINFO="NONE" table statement or when the table is dropped. See LINKEND="X80969"create table
 for more information about unique constraints.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"create index permission defaults to the table owner, and is not transferable. See AlsoCommands     LINKEND="X68185"alter table
MOREINFO="NONE",LINKEND="X80969"create table
MOREINFO="NONE",LINKEND="X93093"drop index
MOREINFO="NONE",LINKEND="X91835"insert
MOREINFO="NONE",LINKEND="X14000"order by clause
MOREINFO="NONE", LINKEND="X18140"reconfigure
MOREINFO="NONE",LINKEND="X64136"set
MOREINFO="NONE",LINKEND="X54355"update
MOREINFO="NONE", LINKEND="X42677"update statisticsSystem procedures     LINKEND="X62957"sp_addsegment
MOREINFO="NONE", LINKEND="X87980"sp_helpindex
MOREINFO="NONE", LINKEND="X36403"sp_helpsegment
MOREINFO="NONE", LINKEND="X50477"sp_spaceused
ID="IN4520-126230146"create index command
ID="IN457-130234147"Indexescreate index;Columns:creating indexes on
ID="IN4524-134238148"create procedure commandID="X52197"create procedureID="IN4617-135240150"Stored procedurescreating
ID="IN4617-138243151"System procedurescreate procedure and
ID="IN4617-145250152"System proceduresSystem proceduresSee also create procedure command; Stored procedures; individual procedure names!see also
ID="IN4624-150255153"create procedure commandcreate procedure commandSee also Stored procedures!see also Stored procedures
ID="IN4656-153258154"Procedures. See Stored procedures; System procedures
ID="IN4681-158263155"Messages, system procedure. See System procedures; individual procedure names
Creates a stored procedure that can take one or more user-supplied parameters.FORMAT="LINESPECIFIC"create procedure [MOREINFO="NONE"owner.]MOREINFO="NONE"procedure_name[;MOREINFO="NONE"number][[(]@MOREINFO="NONE"parameter_name MOREINFO="NONE"    datatype [(length) | (precision [, scale])    [= MOREINFO="NONE"default][output][, @MOREINFO="NONE"parameter_name MOREINFO="NONE"    datatype [(length) | (precision [, scale])    [=MOREINFO="NONE" default][output]]...[)]][with recompile] as MOREINFO="NONE"SQL_statements Keywords and OptionsREMAP="RI--RefIndent"procedure_name - is the name of the procedure. It must conform to the rules for identifiers. ID="IN467-158263159"Numberssame name group procedure
;number ID="IN468-158263160"Groupingprocedures of the same name;Procedure groups;Stored procedures:grouping
ID="IN4617-158263161"Stored proceduresdropping;Dropping:grouped procedures
- is an optional integer used to group procedures of the same name so that they can be dropped together with a single MOREINFO="NONE"drop procedure statement. Procedures used in the same application are often grouped this way. For example, if the procedures used with the application orders are named orderproc;1, orderproc;2, and so on, the statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC" drop proc orderproc REMAP="UN--Under"drops the entire group. REMAP="UN--Under"Once procedures have been grouped, individual procedures within the group cannot be dropped. For example, the statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC" drop procedure orderproc;2 REMAP="UN--Under"is not allowed. ID="IN465-160265162"Namesparameter, in create procedure
ID="IN4628-163268163"Parameters, create procedurenames
parameter_name - is the name of an argument to the procedure. The value of each parameter is supplied when the procedure is executed. (Parameter names are optional in MOREINFO="NONE"create procedure statements-a procedure need not take any arguments.) REMAP="UN--Under"Parameter names must be preceded by the "@" symbol and conform to the rules for identifiers. A parameter name, including the "@" symbol, can be a maximum of 30 characters. Parameters are local to the procedure: the same parameter names can be used in other procedures. ID="IN4622-163268164"Object names, databaseas parametersREMAP="UN--Under"If the value of a parameter contains non-alphanumeric characters, it must be enclosed in quotes. This includes object names qualified by a database name or owner name, since they include a period. If the value of a character parameter begins with a numeric character, it also must be enclosed in quotes.ID="IN4628-166271165"Parameters, create procedurenamesID="IN4628-168273166"Parameters, create proceduredatatypes
datatype [(length) | (precision [, scale])] - is the datatype of the parameter. See the LINKEND="X84316""Datatypes"
 section in LINKEND="X56620"Chapter 3,  "Transact-SQL Topics"
 for more information about datatypes. Stored procedure parameters cannot have a datatype of text or image, or a user-defined datatype whose underlying type is text or image.REMAP="UN--Under"The char, varchar, nchar, nvarchar, binary, and varbinary datatypes should include a length in parentheses. If you omit the length, SQL Server truncates the parameter value to one character.REMAP="UN--Under"The float datatype expects a binary precision in parentheses. If you omit the precision, SQL Server uses the default precision for your platform. REMAP="UN--Under"The numeric and decimal datatypes expect a precision and scale, in parentheses and separated by a comma. If you omit the precision and scale, SQL Server uses a default precision of 18 and scale of 0. ID="IN4628-170275167"Parameters, create proceduredefaults
ID="IN468-170275168"Defaultsprocedure parameter
default - defines a default parameter value for the procedure. If a default is defined, a user can execute the procedure without giving a parameter. The default must be a constant. It can include the wildcard characters (%, _, [ ], and [^]) if the procedure uses the parameter name with the keyword MOREINFO="NONE"like. (See example 2.) REMAP="UN--Under"The default can be NULL. The procedure definition can specify that some action be taken if the parameter value is NULL. (See example 3.) ID="IN4617-172277169"Return parametersoutput keyword
ID="IN4613-176281170"output optioncreate procedure
ID="IN4617-176281171"Calling procedurereturn parameter
MOREINFO="NONE"output - indicates that the parameter is a return parameter. Its value can be returned to the MOREINFO="NONE"execute command that called this procedure. Use return parameters to return information to the calling procedure. (See example 5.)REMAP="UN--Under"To return a parameter value through several
level of nested procedures, each procedure must include the MOREINFO="NONE"output option with the parameter name, including the MOREINFO="NONE"execute command that calls the highest level procedure.ID="IN4613-182287172"Recompilationcreate procedure with recompile option;with recompile option:create procedure
MOREINFO="NONE"with MOREINFO="NONE"recompileID="IN464-186291173"Plancreate procedure and;Procedure plan, create procedure and
 - means that SQL Server never saves a plan for this procedure; a new plan is created each time it is executed. Use this optional clause when you expect that the execution of the procedure won't be typical-that is, you need a new plan. ID="IN4614-188293174"SQL statementsin create procedure
SQL_statements - specify the actions the procedure is to take. Any number and kind of SQL statements can be included, with the exception of MOREINFO="NONE"create MOREINFO="NONE"view, MOREINFO="NONE"create default, MOREINFO="NONE"create rule, MOREINFO="NONE"create MOREINFO="NONE"procedure, MOREINFO="NONE"create trigger, or MOREINFO="NONE"use statements. REMAP="UN--Under"ID="IN4624-190295175"Control-of-flow languagecreate procedure and
MOREINFO="NONE"create procedure SQL statements often include control-of-flow language, including one or more of the following: MOREINFO="NONE"declare; MOREINFO="NONE"if-MOREINFO="NONE"else statement; MOREINFO="NONE"while; MOREINFO="NONE"break; MOREINFO="NONE"continue; MOREINFO="NONE"begin...end; MOREINFO="NONE"goto label; MOREINFO="NONE"return; MOREINFO="NONE"waitfor; MOREINFO="NONE"/* MOREINFO="NONE"comment MOREINFO="NONE"*/. They can also refer to parameters defined for the procedure. REMAP="UN--Under"The SQL statements can reference objects in another database, as long as they are properly qualified.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create procedure showind @tabname varchar(30) as   select sysobjects.name, sysindexes.name, indid   from sysindexes, sysobjects   where sysobjects.name = @tabname   and sysobjects.id = sysindexes.idREMAP="UN--Under"Given a table name, the procedure showind displays its name and the names and identification numbers of any indexes on any of its columns. REMAP="UN--Under"Here are the acceptable syntax forms for executing showind:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"execute showind titles REMAP="UI--UserInput" FORMAT="LINESPECIFIC"execute showind @tabname = "titles"REMAP="UN--Under"Or, if this is the first statement in a file or batch:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"showind titles create procedure showsysind @table varchar(30) = "sys%" as   select sysobjects.name, sysindexes.name, indid   from sysindexes, sysobjects   where sysobjects.name like @table   and sysobjects.id = sysindexes.idID="IN4651-193298177"System procedures results. See Information (Server)
ID="IN467-193298178"Displayprocedures for information;Information (Server):display proceduresREMAP="UN--Under"This procedure displays information about the system tables if the user does not supply a parameter. create procedure showindnew @table varchar(30) = null as   if @table is null    print "Please give a table name"   else    select sysobjects.name, sysindexes.name, indid    from sysindexes, sysobjects    where sysobjects.name = @table    and sysobjects.id = sysindexes.id REMAP="UN--Under"This procedure specifies an action to be taken if the parameter is NULL (that is, if the user does not give a parameter). create procedure mathtutor @mult1 int, @mult2 int,   @result int output as select @result = @mult1 * @mult2REMAP="UN--Under"This stored procedure multiplies two integer parameters and returns the product in the MOREINFO="NONE"output parameter @result. If the procedure is executed by passing it 3 integers, the MOREINFO="NONE"select statement performs the multiplication and assigns the values, but does not print the return parameter:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"mathtutor 5, 6, 32 REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"MOREINFO="NONE"(return status 0) declare @guess int select @guess = 32 exec mathtutor 5, 6, @result = @guess output REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"(1 row affected) (return status = 0)  Return parameters:  @result      -----------           30  REMAP="UN--Under"In this example, the procedure and the MOREINFO="NONE"execute statement both include the MOREINFO="NONE"output option with a parameter name so the procedure can return a value to the caller. Note that the MOREINFO="NONE"output parameter and any subsequent parameters in the MOREINFO="NONE"execute statement, @result, must be passed as:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"     @parameter = valueMARK="DASH" REMAP="BS--BulletSub"The value of the return parameter is always reported, whether its value has changed or not. @result does not need to be declared in the calling batch because it is the name of a parameter to be passed to mathtutor. Although the changed value of @result is returned to the caller in the variable assigned in the MOREINFO="NONE"execute statement (in this case @guess), it is displayed under its own heading (@result). declare @guess int declare @store int select @guess = 32 select @store = @guess execute mathtutor 5, 6, @result = @guess output select Your_answer = @store, Right_answer = @guess if @guess = @store     print "Right-o" else     print "Wrong, wrong, wrong!"REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"(1 row affected) (1 row affected) (return status = 0)  Return parameters:  @result      -----------           30   Your_answer Right_answer  ----------- ------------           32           30                             (1 row affected) Wrong, wrong, wrong! REMAP="UN--Under"Return parameters can be used in additional SQL statements in the batch or calling procedure. This example shows how to use the value of @guess in conditional clauses after the MOREINFO="NONE"execute statement, by storing it in another variable name, @store, during the procedure call. When return parameters are used in an MOREINFO="NONE"execute statement that is part of a SQL batch, the return values are printed with a heading before subsequent statements in the batch are executed. CommentsRestrictionsID="IN4617-193298180"Stored proceduresSpacestorage maximums;Number (quantity of):stored procedure parameters;Space:for stored proceduresstored proceduresMARK="BULL" REMAP="BU--Bullet"The maximum number of parameters that a stored procedure can have is 255. The maximum number of local and global variables in a procedure is limited only by available memory. The maximum amount of text in a stored procedure is 16 Mb.ID="IN4617-193298181"Calling procedurenesting and;Nesting:stored procedures;Stored procedures:nestingA MOREINFO="NONE"create procedure statement cannot be combined with other statements in a single batch. ID="IN4641-195300182"Objects referencing, create procedure andYou can only create a stored procedure in the current database, although the procedure can reference objects from other databases. Any objects referenced in a procedure must exist at the time you create the procedure. You can create an object within a procedure and then reference it, as long as the object is created before it is referenced. ID="IN4614-199304183"insert commandcreate procedure andYou cannot create a table and insert data into the table in the same batch, because when the MOREINFO="NONE"insert statement is compiled the table does not yet exist. ID="IN466-199304184"Namingstored procedures;Renaming:stored procedures;Stored procedures:renaming
ID="IN4624-207312185"create procedure commandselect * in;select command:create procedure andIf you use "MOREINFO="NONE"select *" in your MOREINFO="NONE"create procedureID="IN4613-209314186"Recompilationcreate procedure with recompile option
 statement, the procedure (even if you use the MOREINFO="NONE"with MOREINFO="NONE"recompile option to MOREINFO="NONE"execute) does not pick up any new columns you may have added to the table. You must MOREINFO="NONE"drop the procedure and recreate it. Within a stored procedure, you cannot create an object (including a temporary table), drop it, and then create a new object with the same name. SQL Server creates the objects defined in a stored procedure when the procedure is executed, not when it is compiled.ID="IN4613-209314187"RecompilationSpacestored procedures;Size:estimation of a compiled stored procedure;Size:recompiled stored procedures;Space:for recompiled stored proceduresrecompiled stored procedures
ID="IN464-209314188"Sizecompiled stored procedureCertain changes to databases, such as dropping and recreating indexes, can cause object IDs to change. Stored procedures recompile automatically in this case, and can grow slightly in size. You should always leave some space for this increase in size. Executing Stored ProceduresID="IN4615-213318189"execute commandcreate procedure andMARK="BULL" REMAP="BU--Bullet"Once a procedure is created, you can run it by issuing the MOREINFO="NONE"execute command along with the procedure's name and any parameters. If a procedure is the first statement in a batch, you can give its name without the keyword MOREINFO="NONE"execute. Creating New System ProceduresMARK="BULL" REMAP="BU--Bullet"System Administrators can write system procedures that can be executed from any database. These procedures must be created in the sybsystemprocs database and their names must begin with the characters MOREINFO="NONE"sp_. For more information about creating system procedures, see LINKEND="X52556" BOOK="sag""Overview of System Administration"
 in the System Administration Guide.Object IdentifiersMARK="BULL" REMAP="BU--Bullet"To rename a procedure, use MOREINFO="NONE"sp_rename. If a procedure references table names, column names, or view names that are not valid identifiers, you mustMOREINFO="NONE" setMOREINFO="NONE" quoted_identifierMOREINFO="NONE" on before the MOREINFO="NONE"createMOREINFO="NONE" procedure command and enclose each such name in double quotes. The MOREINFO="NONE"quoted_identifier option does not need to be on when you execute the procedure.ID="IN469-213318190"OwnershipOwnershipof stored proceduresstored proceduresColumn headings in MOREINFO="NONE"select statements in procedures that will be called by APT-SQL, must conform to the rules for identifiers. ID="IN4610-213318191"RecreatingproceduresYou must drop and recreate the procedure if any of the objects it references have been renamed. Inside a stored procedure, object names used with the MOREINFO="NONE"alter table, MOREINFO="NONE"create table, MOREINFO="NONE"drop table, MOREINFO="NONE"truncate MOREINFO="NONE"table, MOREINFO="NONE"create index, MOREINFO="NONE"drop index, MOREINFO="NONE"update statistics, and MOREINFO="NONE"dbcc commands must be qualified with the object owner's name if other users are to make use of the stored procedure. For example, user "mary," who owns table marytab, should qualify the name of her table inside a stored procedure (when it is used with these commands) if she wants other users to be able to execute it, like this: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"create procedure p1 as create index marytab_ind on mary.marytab(col1) ID="IN4622-213318192"Object names, databaseObject names, databasein stored proceduresstored proceduresREMAP="UN--Under"This is because the object names are resolved when the procedure is run. In the example, if user "john" tries to execute procedure p1, SQL Server looks for a table called marytab owned by the user "mary." REMAP="UN--Under"Object names used with other statements (for example, MOREINFO="NONE"select or MOREINFO="NONE"insert) inside a stored procedure need not be qualified, because the names are resolved when the procedure is compiled. Permissions on ObjectsMARK="BULL" REMAP="BU--Bullet"The owner of the stored procedure must own the tables and views used in the procedure. Not even the System Administrator can create a stored procedure to perform operations on another user's tables, if he or she has not been granted permission on those tables. ID="IN4615-213318193"Database Ownersstored procedures
ID="IN4616-215320194"Temporary tablescreate procedure and
ID="IN4615-215320195"Database Ownersstored proceduresA table or view owner can create procedures that perform operations on his or her objects. Users who execute that procedure need not have permissions to those objects directly. For example, a table or view owner can create a procedure that contains MOREINFO="NONE"select, MOREINFO="NONE"insert or MOREINFO="NONE"updateID="IN468-215320196"Securitystored procedure ownership and
 statements that other users do not have permission to run directly. This provides a security mechanism: a user can run a procedure that displays certain columns from a table, but not all of the data. ID="IN4623-217322197"@@error global variableataterror global variable;error global variable
ID="IN4616-219324198"Temporary tablescreate procedure andTemporary Tables and ProceduresMARK="BULL" REMAP="BU--Bullet"You can create a procedure to reference a temporary table if the temporary table is created in the current session. A temporary table created within a procedure disappears when the procedure exits. See LINKEND="X86056""Temporary Tables"
 for more information.System procedures such as MOREINFO="NONE"sp_help work on temporary table, but only if you use them from tempdb. Setting Options in ProceduresID="IN4611-221326199"set commandinside a stored procedureMARK="BULL" REMAP="BU--Bullet"You can use the MOREINFO="NONE"set command inside a stored procedure. The MOREINFO="NONE"set option remains in effect during the execution of the procedure, then reverts to its former setting. Getting Information About ProceduresMARK="BULL" REMAP="BU--Bullet"For a report on the objects referenced by a procedure, use MOREINFO="NONE"sp_depends. The @@error global variable is zeroed out each time a stored procedure executes successfully. ID="IN4620-221326200"Information (Server)text
ID="IN467-223328201"Displaycreate procedure statement textTo display the text of a MOREINFO="NONE"create procedure statement, use the system procedure MOREINFO="NONE"sp_helptext with the procedure name as the parameter. To display the text of a system-defined procedure, execute MOREINFO="NONE"sp_helptext from the master database. Nested ProceduresID="IN466-223328202"Levelsnesting;Nesting:levelsMARK="BULL" REMAP="BU--Bullet"Procedure nesting occurs when one stored procedure calls another. ID="IN4622-223328203"Object names, databaseObject names, databasein stored proceduresstored proceduresIf you execute a procedure that calls another procedure, the called procedure can access objects created by the calling procedure. ID="IN4620-223328204"Number (quantity of)nesting levelsThe nesting level is incremented when the called procedure begins execution and it is decremented when the called procedure completes execution. Exceeding the maximum of 16 levels of nesting causes the transaction to fail. ID="IN4627-225330205"@@nestlevel global variableatatnestlevel global variable;nestlevel global variableThe current nesting level is stored in the MOREINFO="NONE"@@nestlevel global variable. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"create procedure permission defaults to the Database Owner, who can transfer it to other users. REMAP="BO--Body"Permission to use a procedure must be granted explicitly with the MOREINFO="NONE"grant command, and may be revoked with the MOREINFO="NONE"revoke command. REMAP="BO--Body"Procedures that perform MOREINFO="NONE"select, MOREINFO="NONE"executeID="IN469-225330208"OwnershipOwnershipof stored proceduresstored procedures
ID="IN4617-228333209"System procedurescreate procedure and
, or data modification statements, grant "implicit permission" to users who have permission to execute the procedure, even if the users don't have permission to perform these operations on the referenced database objects. The procedure and the underlying objects must be owned by the same user. See AlsoCommands     LINKEND="X55146"begin...end
MOREINFO="NONE",LINKEND="X41626"break
MOREINFO="NONE", LINKEND="X69990"continue
MOREINFO="NONE",LINKEND="X40303"declare
MOREINFO="NONE",LINKEND="X21497"drop procedure
MOREINFO="NONE", LINKEND="X30305"execute
MOREINFO="NONE", LINKEND="X60287"goto Label
MOREINFO="NONE", LINKEND="X69087"grant
MOREINFO="NONE", LINKEND="X74736"if...else
MOREINFO="NONE", LINKEND="X44808"return
MOREINFO="NONE", LINKEND="X35229"select
MOREINFO="NONE", LINKEND="X56170"waitfor
MOREINFO="NONE", LINKEND="X37548"whileTopics     LINKEND="X25196"Batch Queries
, LINKEND="X31136"Comments
, LINKEND="X72999"Parameters
, LINKEND="X44102"Variables (Local and Global)
, LINKEND="X18218"Wildcard CharactersSystem procedures     LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X25756"sp_helptext
MOREINFO="NONE", LINKEND="X37949"sp_rename
ID="IN4624-232337211"create procedure command
ID="IN4617-233338212"Stored procedurescreating
ID="IN4619-237342213"create rule commandID="X43186"create ruleID="IN475-238344215"Rulescreating new
ID="IN4712-240346216"Domain rulescreate rule command
Specifies the domain of acceptable values for a particular column or for any column of a user-defined datatype. FORMAT="LINESPECIFIC"create rule [MOREINFO="NONE"owner.]MOREINFO="NONE"rule_name as MOREINFO="NONE"condition_expression Keywords and OptionsREMAP="RI--RefIndent"ID="IN475-240346219"Rulesnaming user-created
rule_name - is the name of the new rule. It must conform to the rules for identifiers. condition_expression - specifies the conditions that define the rule. It can be any expression that is valid in a MOREINFO="NONE"where clause, and can include arithmetic operators, relational operators,MOREINFO="NONE" in, MOREINFO="NONE"like, MOREINFO="NONE"between, etc. However, it cannot reference any column or other database object. Built-in functions that do not reference database objects can be included. ID="IN4713-240346220"@ (at symbol)condition expression argument;At symbol (@):condition expression argumentREMAP="UN--Under"A condition_expression takes one argument. The argument is prefixed by the "@" symbol, and refers to the value that is entered via the MOREINFO="NONE"update or MOREINFO="NONE"insert command. You can use any name or symbol to represent the value when you write the rule, but the first character must be the "@ID="IN4716-240346221"Binary datatypesBinary datatypesÒ 0xÓ  prefix;Characters:Ò 0xÓ [Characters:0x]0x prefix
" symbol. Enclose character and date constants in quotes, and precede binary constants with "0x". ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create rule limit as @advance < $1000 create rule pubid_rule as @pub_id in ('1389', '0736', '0877') create rule picture as @value like '_-%[0-9]' CommentsRestrictionsID="IN477-240346224"Bindingrules;Rules:bindingMARK="BULL" REMAP="BU--Bullet"You can only create a rule in the current database. Rules do not apply to the data already existing in the database at the time the rules are created. MOREINFO="NONE"create rule statements cannot be combined with other statements in a single batch. You cannot bind a rule to a SQL Server-supplied datatype or to a column of type text, image, or timestamp. ID="IN4730-244350225"sp_unbindrule system procedurecreate rule and
ID="IN475-244350226"OrderOrderfor unbinding a ruleunbinding a ruleYou must drop a rule before you MOREINFO="NONE"create a new one of the same name, and you must unbind a rule before you drop it. Use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_unbindrule MOREINFO="NONE"objname [, futureonly] Binding RulesID="IN4719-244350227"Compatibility, dataCompatibility, dataof rule to column datatyperule to column datatype
ID="IN4728-248354228"sp_bindrule system procedurecreate rule andMARK="BULL" REMAP="BU--Bullet"Use the system procedure MOREINFO="NONE"sp_bindrule to bind a rule to a column or user-defined datatype. Its syntax is:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_bindrule MOREINFO="NONE"rulename, MOREINFO="NONE"objname [, futureonly]A rule bound to a user-defined datatype is activated when you insert a value into, or update, a column of that type. Rules do not test values inserted into variables of that type.The rule must be compatible with the datatype of the column. For example, you cannot use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"@value like A%REMAP="UN--Under"as a rule for an exact or approximate numeric column. If the rule is not compatible with the column to which you've bound it, SQL Server generates an error message when it tries to insert a value (not when you bind it). You can bind a rule to a column or datatype without unbinding an existing rule. Rules bound to columns always take precedence over rules bound to user-defined datatypes, regardless of which was most recently bound. The following chart indicates the precedence when binding rules to columns and user-defined datatypes where rules already exist: TOCENTRY="1"LBL="Table 1-7: "Rule binding precedenceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"New Rule bound toCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Old rule bound toCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"user-defined datatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"column VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"user-defined datatypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"new rule replaces oldCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"no changeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"columnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"new rule replaces oldCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"new rule replaces oldRules and NullsID="IN477-248354229"Columnsrules conflict with definitions of;Rules:column definition conflict with
ID="IN477-248354230"Columnsnull values and default;Null values:column defaults and
ID="IN4711-248354231"Null valuesnew rules and column definition;Null values:null defaults andMARK="BULL" REMAP="BU--Bullet"Rules do not override column definitions. If a rule is bound to a column that allows null values, you can insert NULL into the column, implicitly or explicitly, even though NULL is not included in the text of the rule. For example, if you create a rule specifying "@val in (1,2,3)" or "@amount > 10000", and bind this rule to a table column which allows null values, you can still insert NULL into that column. The column definition overrides the rule.Getting Information About RulesMARK="BULL" REMAP="BU--Bullet"After a rule is bound to a particular column or user-defined datatype, its ID is stored in the syscolumns or systypes system tables. To get a report on a rule, use MOREINFO="NONE"sp_help. To display the text of a rule, which is stored in the syscomments system table, execute the system procedure MOREINFO="NONE"sp_helptext with the rule name as the parameter. ID="IN4734-251357232"Data dictionary. See System tables
ID="IN4713-251357233"System tablesrule information inTo rename a rule, use MOREINFO="NONE"sp_rename. ID="IN475-251357234"RulesOwnershipbinding;Binding:rules;Defaults:rules and;Ownership:of rulesrulesDefaults and RulesID="IN4710-251357235"Precedencerule bindingMARK="BULL" REMAP="BU--Bullet"If a column has both a default and a rule associated with it, the default must fall within the domain defined by the rule. A default that conflicts with a rule will never be inserted. SQL Server generates an error message each time it attempts to insert the default. Using Integrity Constraints in Place of RulesMARK="BULL" REMAP="BU--Bullet"You can
also define rules using MOREINFO="NONE"check integrity constraints
with the MOREINFO="NONE"create table statement. However, these constraints are specific for that table; you cannot bind them to other tables. See "LINKEND="X80969"create table
" and "LINKEND="X68185"alter table
" for information about integrity constraints.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Standard COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extension
Transact-SQL extentionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"To create rules using SQL 
compliant syntax, use the MOREINFO="NONE"check 
clause of the MOREINFO="NONE"create table 
statement. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PermissionsREMAP="BO--Body"MOREINFO="NONE"create rule permission defaults to the Database Owner, who can transfer it to other users. See AlsoCommands     LINKEND="X68185"alter table
, LINKEND="X81463"create default
, LINKEND="X80969"create table
, LINKEND="X97463"drop default
, LINKEND="X62555"drop ruleTopics     LINKEND="X25196"Batch QueriesSystem procedures     LINKEND="X38718"sp_bindrule
, LINKEND="X91431"sp_help
, LINKEND="X25756"sp_helptext
, LINKEND="X37949"sp_rename
, LINKEND="X37191"sp_unbindrule
ID="IN4719-255361239"create rule command
ID="IN475-256362240"Rulescreating new
 ID="X48762"create schemaID="IN4821-260367242"create schema command
ID="IN486-263370243"Tablescreating with create schema
ID="IN487-265372245"Schemas
ID="IN485-268375246"Viewscreating with create schema
ID="IN4811-271378247"Permissionscreating with create schema
Creates a new collection of tables, views and permissions for a database user.FORMAT="LINESPECIFIC"create schema authorization MOREINFO="NONE"authorization_namecreate_oject_statement     [ create_object_statement ... ][ permission_statement ... ]Keywords and OptionsREMAP="RI--RefIndent"authorization_name - must be the name of the current user in the database.create_object_statement-  is a MOREINFO="NONE"createMOREINFO="NONE" table or MOREINFO="NONE"createMOREINFO="NONE" view statement.permission_statement- is a MOREINFO="NONE"grant or MOREINFO="NONE"revoke command.ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"create schema authorization pogo    create table newtitles (        title_id tid not null,        title varchar(30) not null)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    create table newauthors (        au_id id not null,        au_lname varchar(40) not null,        au_fname varchar(20) not null)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    create table newtitleauthors (        au_id id not null,        title_id tid not null)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    create view tit_auth_view    as        select au_lname, au_fname            from newtitles, newauthors,                newtitleauthors        where         newtitleauthors.au_id = newauthors.au_id        and         newtitleauthors.title_id =             newtitles.title_idREMAP="UI--UserInput" FORMAT="LINESPECIFIC"    grant select on tit_auth_view to public    revoke select on tit_auth_view from churchyCommentsMARK="BULL" REMAP="BU--Bullet"Schemas can be created only in the current database.The schema authorization name must be the name of the current user.The user must have the correct command permissions (MOREINFO="NONE"createMOREINFO="NONE" table and/or MOREINFO="NONE"createMOREINFO="NONE" view). If the user creates a view on tables owned by another database user, permissions on the view are checked when a user attempts to access data through the view, not when the view is created.The MOREINFO="NONE"createMOREINFO="NONE" schema command is terminated by:MARK="DASH" REMAP="BS--BulletSub"The regular command terminator ("go" by default in MOREINFO="NONE"isql).Any statement other than MOREINFO="NONE"createMOREINFO="NONE" table, MOREINFO="NONE"createMOREINFO="NONE" view, MOREINFO="NONE"grant, or MOREINFO="NONE"revoke.If any of the statements within a MOREINFO="NONE"createMOREINFO="NONE" schema statement fail, the entire command is rolled back as a unit, and none of the commands take affect.ID="IN487-271378252"Schemaspermissions
MOREINFO="NONE"createMOREINFO="NONE" schema adds information about tables, views and permissions to the system tables. Use the appropriate drop command (MOREINFO="NONE"dropMOREINFO="NONE" table or MOREINFO="NONE"dropMOREINFO="NONE" view) to drop objects created with MOREINFO="NONE"createMOREINFO="NONE" schema. Permissions granted or revoked in a schema can be changed with the standard MOREINFO="NONE"grant and MOREINFO="NONE"revoke commands outside the schema creation statement.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantPermissionsREMAP="BO--Body"MOREINFO="NONE"create schema can be executed by any user of a database; the user must have permission to create the objects specified in the schema, that is, MOREINFO="NONE"createMOREINFO="NONE" table and/or MOREINFO="NONE"createMOREINFO="NONE" view permission. See AlsoCommands     LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X30101"create view
MOREINFO="NONE", LINKEND="X69087"grant
MOREINFO="NONE", LINKEND="X29921"revokeREMAP="BO--Body"ID="X80969"create tableID="IN4369573"Tablescreating new
ID="IN43592104"FilesFilesSee also Tables; Transaction log!see also Tables; Transaction log
ID="IN431387155"System tablesSystem tablesSee also Tables; individual table names!see also
ID="IN432384186"Base tables. See Tables
Creates new tables and optional integrity constraints. FORMAT="LINESPECIFIC" create table
[database.[owner].]table_name
(column_name datatype    [default
{constant_expression | user | null}]    {[{identity |
null | not null}]    | [[constraint
constraint_name]        {{unique | primary key}
           [clustered | nonclustered]            [with fillfactor = x] [on
segment_name]        | references
[[database.]owner.]ref_table
           [(ref_column)]        | check
(search_condition)}]}... | [constraint constraint_name]    {{unique | primary key}         [clustered | nonclustered]        (column_name [{, column_name}...])        [with fillfactor = x] [on segment_name]    | foreign key (column_name [{, column_name}...])        references [[database.]owner.]ref_table            [(ref_column [{, ref_column}...])]     | check (search_condition)} [{, {next_column | next_constraint}}...]) [on segment_name]Keywords and OptionsREMAP="RI--RefIndent"ID="IN436841810"Namingtables
table_name - is the name of the new table. It must be unique within the database and to the owner. If you haveMOREINFO="NONE" set quoted_identifier on, you can use a delimited identifier for the table. Otherwise, it must conform to the rules for identifiers. For more information about valid table names, see LINKEND="X62459""Identifiers"
.ID="IN4316841811"Temporary tablesidentifier prefix (#)
ID="IN4314841812"Pound sign (#)temporary table name prefix;# (pound sign):temporary table identifier prefix
ID="IN4316822013"Temporary tablescreate table andREMAP="UN--Under"You can create a temporary table either by preceding the table name in a MOREINFO="NONE"create table statement with a pound sign (#), or by preceding the table name with "tempdbID="IN4316822014"Temporary tablesnames of;Naming:temporary tables
ID="IN4315782415"tempdb databasesysobjects table and
..". The first 13 characters of a temporary table name which begins with a pound sign (including the pound sign) must be unique to a user, per session. Such tables can be accessed only by the current SQL Server session. They are stored in tempdb..objects by their names plus a system-supplied numeric suffix, and they disappear at the end of the current session, or when they are explicitly dropped. Temporary tables created with the "tempdb.." prefix are sharable among SQL Server sessions. They exist until they are explicitly dropped by their owner, or until SQL Server reboots. See LINKEND="X86056""Temporary Tables"
 for more information.REMAP="UN--Under"You can create a table in a different database, as long as you are listed in the sysusers table and have MOREINFO="NONE"create table permission for that database. For example, to create a table called newtable in the database otherdb:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table otherdb..newtable ...REMAP="UN--Under"or:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table otherdb.yourname.newtable ...column_name - is the name of the column in the table. It must be unique in the table. If you have MOREINFO="NONE"set quoted_identifier on, you can use a delimited identifier for the column. Otherwise, it must conform to the rules for identifiers. For more information about valid column names, see LINKEND="X62459""Identifiers"
.datatype - is the datatype of the column. System or user-defined datatypes are acceptable. Certain datatypes expect a length, n, in parentheses:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"   datatype(n)REMAP="UN--Under"Others expect a precision, p, and scale, s:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"   datatype(p,s)REMAP="UN--Under"See "LINKEND="X84316"Datatypes
" for more information.ID="IN4315742816"default keywordcreate table
MOREINFO="NONE"default - specifies a default value for a column. If you have declared a default and the user does not provide a value for this column when inserting data, SQL Server inserts this value. The default can be either a constant expression, MOREINFO="NONE"user to insert the name of the user who is performing the insert, or MOREINFO="NONE"null to insert the null value. Defaults declared for columns with the IDENTITY property have no effect on column values.constant_expression - is a constant expression to use as a default value for the column. It cannot include the name of any columns or other database objects, but you can include built-in functions that do not reference database objects. This default value must be compatible with the datatype of the column.ID="IN4312703217"user keywordcreate table
MOREINFO="NONE"user ID="IN4312663618"null keywordcreate table
| MOREINFO="NONE"null - specifies that SQL Server should insert the user name or the null value as the default if the user does not supply a value. For MOREINFO="NONE"user, the datatype of the column must be either char(30) or varchar(30). For MOREINFO="NONE"null, the column must allow null values.MOREINFO="NONE"identity - indicates that the column has the IDENTITY property. Each table in a database can have one IDENTITY column with a type of numeric and scale zero. IDENTITY columns are not updatable and do not allow nulls. REMAP="UN--Under"IDENTITY columns are used to store sequential numbers, such as invoice numbers or employee numbers, that are generated automatically by SQL Server. The value of the IDENTITY column uniquely identifies each row in a table. ID="IN4320643819"create table commandnull values and
ID="IN4312604220"null keywordcreate table
MOREINFO="NONE"nullID="IN4316564621"not null keywordcreate table
 | MOREINFO="NONE"not null - specifies that SQL Server assigns a null value if a user does not provide a value during an insertion and no default exists (for MOREINFO="NONE"null), or that a user must provide a non-null value if no default exists (for MOREINFO="NONE"not null). If you do not specify MOREINFO="NONE"null or MOREINFO="NONE"not null, SQL Server uses MOREINFO="NONE"not null by default. However, you can switch this default using MOREINFO="NONE"sp_dboption to make the default compatible with the ANSI standard.ID="IN4318525022"constraint keywordcreate table
MOREINFO="NONE"constraint - introduces the name of an integrity constraint. This keyword and the constraint_name are optional.constraint_name - is the name of the constraint. It must conform to the rules for identifiers and be unique in the database. If you do not specify the name for a referential or check constraint, SQL Server generates a name as follows:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    tabname_colname_objectidREMAP="UN--Under"where tabname is the first 10 characters of the table name, colname is the first 5 characters of the column name, and objectid is the object ID number for the constraint. If you do not specify the name for a unique or primary key constraint, SQL Server generates a name as follows:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    tabname_colname_tabindidREMAP="UN--Under"where tabindid is a string concatenation of the table ID and index ID.ID="IN4314485423"unique keywordcreate table
MOREINFO="NONE"unique - constrains the values in the indicated column or columns so that no two rows can have the same non-null value. This constraint creates a unique index that can only be dropped if the constraint is dropped using MOREINFO="NONE"alter table.ID="IN4322445824"primary key constraintcreate table
MOREINFO="NONE"primary key ID="IN4311416125"Keys, tableKeys, tableSee also Common keys; Indexes!see also Common keys; Indexes
ID="IN4311386426"Common keysCommon keysSee also Foreign keys; Joins; Primary keys!see also Foreign keys; Joins; Primary keys
ID="IN4332356727"First column parameter. See Keys
- constrains the values in the indicated column or columns so that no two rows can have the same value, and so that the value cannot be NULL. This constraint creates a unique index that can only be dropped if the constraint is dropped using MOREINFO="NONE"alter table.ID="IN4320317128"clustered constraintcreate table
MOREINFO="NONE"clustered ID="IN4323277529"nonclustered constraintcreate table
| MOREINFO="NONE"nonclustered - specifies that the index created by a MOREINFO="NONE"unique or MOREINFO="NONE"primary key constraint is a clustered or nonclustered index. MOREINFO="NONE"clustered is the default for primary key constraints, MOREINFO="NONE"nonclustered is the default for unique constraints. There can be only one clustered index per table. See "LINKEND="X58868"create index
" for more information.ID="IN4317237930"fillfactor optioncreate table
MOREINFO="NONE"fillfactor - specifies how full SQL Server will make each page when it is creating a new index on existing data. The MOREINFO="NONE"fillfactor percentage is relevant only at the time the index is created. As the data changes, the pages are not maintained at any particular level of fullness. ID="IN4311218131"Index pagesfillfactor values forREMAP="UN--Under"The default for MOREINFO="NONE"fillfactor is 0; this is used when you do not include MOREINFO="NONE"with fillfactor in the MOREINFO="NONE"create index statement (unless the value has been changed with MOREINFO="NONE"sp_configure). When specifying a MOREINFO="NONE"fillfactor, legal values are between 1 and 100. ID="IN435218132"SpaceSpacefor index pagesindex pagesREMAP="UN--Under"A MOREINFO="NONE"fillfactorID="IN4322218133"Leaf levels of indexesclustered index;Index pages:leaf level
 of 0 creates clustered indexes with completely full pages and nonclustered indexes with completely full leaf pages. It leaves a comfortable amount of space within the index B-tree in both the clustered and nonclustered cases. There is seldom a reason to change the MOREINFO="NONE"fillfactor. REMAP="UN--Under"If the MOREINFO="NONE"fillfactor is set to 100, SQL Server creates both clustered and nonclustered indexes with each page 100% full. A MOREINFO="NONE"fillfactor of 100 makes sense only for read-only tables-tables to which no additional data will ever be added. REMAP="UN--Under"MOREINFO="NONE"fillfactor values smaller than 100 (except 0, which is a special case) cause SQL Server to create new indexes with pages that are not completely full. A MOREINFO="NONE"fillfactor of 10 might be a reasonable choice if you are creating an index on a table that will eventually hold a great deal more data, but small MOREINFO="NONE"fillfactor values cause each index (or index and data) to take more storage space. ID="IN435218134"SpaceSpacedatabase storage;Space:for a clustered indexclustered indexCreating a clustered index with a MOREINFO="NONE"fillfactor affects the amount of storage space your data occupies, since SQL Server redistributes the data as it creates the clustered index. ID="IN4311178535"on  keywordcreate table;Segments:creating indexes on
ID="IN435178536"Namessegment;Segments:names of
MOREINFO="NONE" on MOREINFO="NONE"segment_name - specifies that the index is to be created on the named segment. Before the MOREINFO="NONE"on segment_name option can be used, the device must be initialized with MOREINFO="NONE"disk init, and the segment must be added to the database with the MOREINFO="NONE"sp_addsegment system procedure. See your System Administrator or use MOREINFO="NONE"sp_helpsegment for a list of the segment names available in your database.REMAP="UN--Under"If you specify MOREINFO="NONE"clustered and use the MOREINFO="NONE"on segment_name option, the entire table migrates to the segment you specify, since the leaf level of the index contains the actual data pages.ID="IN4321138937"references constraintcreate table
MOREINFO="NONE"references - specifies a column list for a referential integrity constraint. You can only specify one column value for a column-constraint. By including this constraint with a table that references another table, any data inserted into the "referencing" table must already exist in the "referenced" table.REMAP="UN--Under"To use this constraint, you must have MOREINFO="NONE"references permission on the referenced table. The specified columns in the referenced table must be constrained by a unique index (created by either a MOREINFO="NONE"unique constraint or a MOREINFO="NONE"create index statement). If no columns are specified, there must be a MOREINFO="NONE"primary key constraint on the appropriate columns in the referenced table. Also, the datatypes of the referencing table columns must exactly match the datatype of the referenced table columns.ID="IN432299338"foreign key constraintcreate table
MOREINFO="NONE"foreign key - specifies that the listed column(s) are foreign keys in this table whose target keys are the columns listed in the following MOREINFO="NONE"references clause. The foreign key syntax is permitted only for table-level constraints, not for column-level constraints.ref_table - is the name of the table that contains the referenced columns. You can reference tables in another database.ref_column - is the name of the column or columns in the referenced table.ID="IN431259739"check optioncreate table
MOREINFO="NONE"check - specifies a search_condition constraint which SQL Server enforces for all the rows in the table. You can specify MOREINFO="NONE"check constraints as table or column constraints; MOREINFO="NONE"create table allows multiple MOREINFO="NONE"check constraints in a column definition.search_condition - is the MOREINFO="NONE"check constraint on the column values. These constraints can include:MARK="DASH" REMAP="BS--BulletSub"A list of constant expressions introduced with MOREINFO="NONE"inA set of conditions introduced with MOREINFO="NONE"like which may contain wildcard charactersREMAP="UN--Under"Column check constraints can reference only the columns on whichthey are defined; they cannot reference other columns in the table. Table check constraints can reference any columns in the table.REMAP="UN--Under"An expression can include arithmetic operators and functions. The search_condition cannot contain subqueries, aggregate functions, host variables, or parameters.MOREINFO="NONE"next_column | next_constraint - indicates that you can include additional column definitions or table-constraints (separated by commas) using the same syntax described for a column definition or table constraint definition.ID="IN4310110140"on keywordcreate table
ID="IN438110141"Segmentsnames of;Names:segment
MOREINFO="NONE"on MOREINFO="NONE"segment_name - specifies the name of the segment on which to place the table. When using MOREINFO="NONE"on MOREINFO="NONE"segment_name the logical device must already be assigned to the database with MOREINFO="NONE"create database or MOREINFO="NONE"alter database, and the segment must have been created in the database with MOREINFO="NONE"sp_addsegment. See your System Administrator or use MOREINFO="NONE"sp_helpsegment for a list of segment names available in your database.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create table titles(title_id       tid              not null,title           varchar(80)      not null,type            char(12)         not null,pub_id          char(4)          null,price           money            null,advance         money            null,total_sales     int              null,notes           varchar(200)     null,pubdate         datetime         not null,contract        bitnot           null)REMAP="UN--Under"Creates the titles table.create table "compute"("max" int,"min" int, "total score" int)REMAP="UN--Under"Creates the compute table. The table name and the column names max and min are enclosed in double quotes because they are reserved words. The total score column name is enclosed in double quotes because it contains an embedded blank. Before creating this table, you mustMOREINFO="NONE" set quoted_identifier on. create table sales(stor_id         char(4)      not null,ord_num          varchar(20)  not null,date             datetime     not null,unique clustered (stor_id, ord_num))REMAP="UN--Under"Creates the sales table and a clustered index in one step with a unique constraint. (In the pubs2 database installation script, there are separate MOREINFO="NONE"create table and MOREINFO="NONE"create index statements.)create table salesdetail(stor_id    char(4)                  not null,ord_num     varchar(20)              not null,title_id     tid                     not null             references titles(title_id),qty          smallintdefault 0       not null,discount    float                    not null,  constraint salesdet_constr    foreign key (stor_id, ord_num)    references sales(stor_id, ord_num))REMAP="UN--Under"Creates the salesdetail table with two referential integrity constraints and one default value. There is a table-level referential integrity constraint named salesdet_constr, and a column-level referential integrity constraint on the title_id column without a specified name. Both constraints specify columns which have unique indexes in the referenced tables (titles and sales). The MOREINFO="NONE"default clause with the qty column specifies 0 as its default value.create table publishers
(pub_id         char(4)      not null       
check (pub_id in ("1389", "0736", "0877",
                "1622", "1756")       
 or pub_id like "99[0-9][0-9]"),
pub_name       varchar(40)   null,
city           varchar(20)   null,
state          char(2)       null)REMAP="UN--Under"Creates the table publishers with a check constraint on the pub_id column. This column-level constraint could be used in place of the pub_idrule included in the pubs2 database:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create rule pub_idruleas @pub_id in ("1389", "0736", "0877",         "1622", "1756")or @pub_id like "99[0-9][0-9]"create table sales_daily
 (stor_id         char(4)         not null,  
ord_num          numeric(10,0)   identity,  
ord_amt          money           null)REMAP="UN--Under"Specifies the ord_num column as the IDENTITY column for the sales_daily table. The first time you insert a row into the table, SQL Server assigns a value of 1 to the IDENTITY column. On each subsequent insert, the value of the column is incremented by one.CommentsID="IN4310110146"Size limittables per database;Size limit:columns allowed per table
ID="IN434110147"Sizetables;Number of columns:per table;Number (quantity of):tables per databaseRestrictionsMARK="BULL" REMAP="BU--Bullet"There can be up to 2 billion tables per database and 250 columns per table. The number of rows per table is limited only by available storage. ID="IN435110148"Bytesper row;Number (quantity of):bytes per row;Size:rowThe maximum number of bytes per row is 1962. If you create tables with varchar, nvarchar, or varbinary columns whose total defined width is greater than 1962 bytes, a warning message appears, but the table is created. If you try to insert more than 1962 bytes into such a row, or to update a row so that its total row size is greater than 1962, SQL Server produces an error message and the command fails. The table is created in the currently open database unless you specify a different database in the MOREINFO="NONE"create MOREINFO="NONE"table statement. You can create a table or index in another database if you are listed in the sysusers table and have MOREINFO="NONE"create table permission in the database. ID="IN4312110149"Primary keys
ID="IN435110150"Spaceextents;Space allocation:table
ID="IN4312110151"Pages (data)Pages (data)in an extent;Extents;Number of pages:in an extent[Number of pages:extent]extentSpace is allocated to tables and indexes in increments
of one extent, or 8 pages, at a time. Each time an extent is filled, another extent is allocated. To see the amount of space allocated and used by a table, use MOREINFO="NONE"sp_spaceused. Column DefinitionsMARK="BULL" REMAP="BU--Bullet"When you create a column from a user-defined datatype:MARK="DASH" REMAP="BS--BulletSub"You cannot change the length, precision, or scale. ID="IN4311110152"Null valuesdefiningYou can use a NULL type to create a NOT NULL column, but not to create an IDENTITY columnMOREINFO="NONE".You can use a NOT NULL type to create a NULL column, but not to create an IDENTITY columnMOREINFO="NONE".You can use an IDENTITY type to create a NOT NULL column, but the column inherits the IDENTITY property. You cannot use an IDENTITY type to create a NULL column.ID="IN4310110153"Conversionnull values and automatic;Internal datatypes of null columnsOnly columns with variable-length datatypes can store null values. When you create a NULL column with a fixed-length datatype, SQL Server automatically converts it to the corresponding variable-length datatype. SQL Server does not inform the user of the type change.REMAP="UN--Under"The following chart lists the fixed-length datatypes and the variable-length datatypes to which they are converted. Certain variable-length datatypes, such as moneyn, are reserved types; you cannot use them to create columns, variables, or parameters:TOCENTRY="1"LBL="Table 1-8: "Variable-length datatypes used to store nullsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="13*"COLNAME="C2" COLWIDTH="12*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Original Fixed-Length 
DatatypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Converted ToVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nchar COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nvarchar COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binary COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinary COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetimn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"float COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"floatn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int, smallint, and tinyint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimal COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimaln COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numeric COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numericn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"money and smallmoneyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"moneyn For a report on a table and its columns, execute the system procedure MOREINFO="NONE"sp_help. Temporary TablesID="IN4316-911157"Database objectsadding to tempdb;Temporary tables:create table andMARK="BULL" REMAP="BU--Bullet"Temporary tables are stored in the temporary database, tempdb. You can associate rules, defaults and indexes with temporary tables, but you cannot create a view on temporary tables or associate triggers with them. When you create a temporary table, you can only use a user-defined datatype if the type is in ID="IN4315-1311558"tempdb databasesystypes table and
tempdb..systypesID="IN436-1711959"Addingobjects to tempdb;tempdb database:adding objects to
. To add a user-defined datatype to tempdb for the current session only, execute MOREINFO="NONE"sp_addtype while using tempdb. To add the datatype permanently, execute MOREINFO="NONE"sp_addtype while using model and then restart SQL Server so that model is copied to tempdb. Using IndexesID="IN4317-1711960"Clustered indexesmigration of tables to;Tables:migration to a clustered index
ID="IN439-1711961"MigrationMigrationof tables to clustered indexestables to clustered indexesMARK="BULL" REMAP="BU--Bullet"A table "follows" its clustered index. If you create a table on one segment, and then create its clustered index on another segment, the table will "migrate" to the segment where the index is created. ID="IN4320-1711962"Separation, physicalSeparation, physicalof table and index segmentstable and index segments
ID="IN438-1711963"Segmentsseparation of table and indexYou can make inserts, updates, and selects faster by creating a table on one segment, and its non-clustered indexes on another segment, if these segments are on separate physical devices. See the System Administration Guide for more information.Renaming a Table or Its ColumnsMARK="BULL" REMAP="BU--Bullet"Use MOREINFO="NONE"sp_rename to rename a table or column. After renaming a table or any of its columns, use MOREINFO="NONE"sp_depends to determine which procedures, triggers, and views depend on the table and redefine these objects.If you do not redefine these dependent objects, they will no longer work after SQL Server recompiles them.ID="IN4311-1912164"Constraintscreate table;Integrity constraintsID="IN4314-2212465"Data integrityData integritySee also Referential integrity constraints!see alsoID="IN4354-2512766"Referencing, object. See Dependencies, database objectDefining Integrity ConstraintsMARK="BULL" REMAP="BU--Bullet"The MOREINFO="NONE"create table statement helps control a database's integrity through a series of integrity constraints as defined by the ANSI standard. These integrity constraint clauses restrict the data that users can insert into a table. You can also use defaults, rules, indexes, and triggers to enforce database integrity.REMAP="UN--Under"Integrity constraints offer the advantages of defining integrity controls in one step during the table creation process and of simplifying the process to create those integrity controls. However, integrity constraints are more limited in scope and less comprehensive than defaults, rules, indexes, and triggers.You must declare constraints that operate on more than one column as table-level constraints; declare constraints that operate on just one column as column-level constraints. The difference is syntactic: you place column-level constraints after the column name and datatype, before the delimiting comma (see example 4). You enter table-level constraints as separate comma-delimited clauses (see example 2). SQL Server treats table-level and column-level constraints the same way; neither way is more efficient than the other.You can create the following types of constraints at the table level or the column level:MARK="DASH" REMAP="BS--BulletSub"a MOREINFO="NONE"unique constraint requires that no two rows in a table have the same non-null values in the specified columns. In addition, a MOREINFO="NONE"primary key constraint requires that there be no null values in the column.ID="IN4333-2712967"Referential integrity constraintscreate table andreferential integrity (MOREINFO="NONE"references) constraints require that data being inserted or updated in specific columns must already have matching data in the specified table and columns.MOREINFO="NONE"check constraints limit the values of the data inserted into the columns.REMAP="UN--Under"You can also enforce data integrity by restricting the use of null values in a column (the MOREINFO="NONE"null or MOREINFO="NONE"not null keywords) and by providing default values for columns (the MOREINFO="NONE"default clause).ID="IN4321-2712968"Integrity constraintstypesYou can define primary, foreign, and common keys on a table with the system procedures MOREINFO="NONE"sp_primarykey, MOREINFO="NONE"sp_foreignkey, and MOREINFO="NONE"sp_commonkey. These procedures save information in system tables which can help clarify the relationships between tables in a database. But they do not replace the functions of the MOREINFO="NONE"primary key and MOREINFO="NONE"foreign key keywords in a MOREINFO="NONE"create table statement. For a report on the keys that have been defined, use MOREINFO="NONE"sp_helpkey. For a report on frequently used joins, execute MOREINFO="NONE"sp_helpjoins. Transact-SQL provides several mechanisms for integrity enforcement. In addition to the constraints you can declare as part of MOREINFO="NONE"create table, you can create rules, defaults, indexes, and triggers. The following table summarizes the integrity constraints and describes the other methods of integrity enforcement:TOCENTRY="1"LBL="Table 1-9: "Methods of integrity enforcementCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="17*"COLNAME="C2" COLWIDTH="20*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"In MOREINFO="NONE"create tableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Other MethodsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"unique constraintCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create unique index (on a column that 
allows null values)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"primary key constraintCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create unique index (on a column that 
does not allow null values)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"references constraintCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create trigger COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"check constraint (table level)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create triggerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"check constraint (column level)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create
trigger or MOREINFO="NONE"create rule and MOREINFO="NONE" 
sp_bindruleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"default clauseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create
default and MOREINFO="NONE"sp_bindefaultREMAP="UN--Under"Which method you choose depends on your requirements. For example, triggers provide more complex handling of referential integrity (such as referencing other columns or objects) than those declared in MOREINFO="NONE"create table. Also, the constraints defined in a MOREINFO="NONE"create table statement are specific for that table. Unlike triggers, rules, or defaults, you cannot bind them to other tables, and you can only drop or change them using MOREINFO="NONE"alter table. Constraints cannot contain subqueries or aggregate functions, even on the same table.The MOREINFO="NONE"create table command can include many constraints, with these limitations:MARK="DASH" REMAP="BS--BulletSub"The number of MOREINFO="NONE"unique constraints is limited by the number of indexes that table can have.A table can have only one MOREINFO="NONE"primary key constraint.You can include only one MOREINFO="NONE"default clause per column of a table, but you can define different constraints on the same column. REMAP="UN--Under"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table discount_titles(title_id   varchar(6)   default "PS7777" not null        unique clustered        references titles(title_id)        check (title_id like "PS%"),new_price   money)REMAP="UN--Under"Column title_id of the new table discount_titles is defined with each integrity constraint.ID="IN4311-2712969"Constraintserror messagesYou can create error messages and bind them to referential integrity and MOREINFO="NONE"check constraints. Create messages with MOREINFO="NONE"sp_addmessage, and bind them to the constraints with MOREINFO="NONE"sp_bindmsg. For more information, see LINKEND="X36529"sp_addmessage
 and LINKEND="X87441"sp_bindmsg
 in Volume 2.SQL Server always evaluates check constraints before the referential constraints are enforced. Triggers are evaluated after all the integrity constraints. If any constraint fails, SQL Server cancels the data modification statement and any associated triggers are not executed. However, a constraint violation does not roll back the current transaction.For information about any constraints defined for a table, use MOREINFO="NONE"sp_helpconstraint. MOREINFO="NONE"sp_helpconstraint is described in Volume 2.ID="IN4318-2712970"Unique constraintsuniqueUnique and Primary Key ConstraintsMARK="BULL" REMAP="BU--Bullet"You can declare MOREINFO="NONE"unique constraints at the column level or the table level. MOREINFO="NONE"unique constraints require that all non-null values in the specified columns must be unique. No two rows in the table are allowed to have the same value in the specified column.A MOREINFO="NONE"primary key constraint is a more restrictive form of MOREINFO="NONE"unique constraint. Columns with MOREINFO="NONE"primary key constraints may not contain null values.create table's unique and primary
key constraints create indexes that define unique or primary key attributes of columns. MOREINFO="NONE"sp_primarykey, sp_foreignkey, and MOREINFO="NONE"sp_commonkey define logical relationships between columns. These relationships must be enforced using indexes and triggers.Table-level MOREINFO="NONE"unique or MOREINFO="NONE"primary key constraints appear in theMOREINFO="NONE" create table statement as separate items, and must include the names of one or more columns from the table being created.MOREINFO="NONE"unique or MOREINFO="NONE"primary key constraints create a unique index on the specified columns. The MOREINFO="NONE"unique constraint in example 2, MOREINFO="NONE"unique clustered (stor_id, ord_num), creates a unique, clustered index, exactly the same as the statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create unique clustered index salesind    on sales (stor_id, ord_num)REMAP="UN--Under"The only difference is the index name, which you could set to salesind by naming the constraint.MOREINFO="NONE"unique constraints create unique nonclustered indexes by default; MOREINFO="NONE"primary key constraints create unique clustered indexes by default. There can be only one clustered index on a table, so you can specify only one MOREINFO="NONE"unique clustered or MOREINFO="NONE"primary key clustered constraint.The MOREINFO="NONE"unique or MOREINFO="NONE"primary key integrity constraints of MOREINFO="NONE"create table offer a simpler alternative to the MOREINFO="NONE"create index statement. They have the following limitations:MARK="DASH" REMAP="BS--BulletSub"You cannot create non-unique indexes. You cannot use all the options provided by MOREINFO="NONE"create index.You must drop these indexes using MOREINFO="NONE"alter table MOREINFO="NONE"drop constraint.ID="IN4333-2712971"Referential integrity constraintsreferential integrityReferential Integrity ConstraintsMARK="BULL" REMAP="BU--Bullet"Referential integrity constraints require that data inserted into a "referencing" table which defines the constraint must have matching values in a "referenced" table. A referential integrity constraint is satisfied for either of the following conditions:MARK="DASH" REMAP="BS--BulletSub"The data in the constrained column(s) of the referencing table contains a null value.The data in the constrained column(s) of the referencing table matches data values in the corresponding columns of the referenced table.REMAP="UN--Under"Using the pubs2 database as an example, a row inserted into the salesdetail table (which records the sale of books) must have a valid title_id in the titles table. salesdetail is the referencing table and titles table is the referenced table. Currently, pubs2 enforces this referential integrity using a trigger. However, the salesdetail table could include this column definition and referential integrity constraint to accomplish the same task:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"title_id tid    references titles(title_id)A table can include a referential integrity constraint on itself. You cannot delete rows or update column values from a referenced table that match values in a referencing table. You cannot drop the referenced table until the referencing table is dropped or the referential integrity constraint is removed (unless it includes only a referential integrity constraint on itself). SQL Server does not enforce referential integrity constraints for temporary tables.To create a table that references another user's table, you must have MOREINFO="NONE"references permission on the referenced table. For information about assigning MOREINFO="NONE"references permissions, see the LINKEND="X69087"grant
 command.Table-level referential integrity constraints appear in theMOREINFO="NONE" create table statement as separate items. They must include the MOREINFO="NONE"foreign key clause and a list of one or more column names. REMAP="UN--Under"Column names in the MOREINFO="NONE"references clause are optional only if the columns in the referenced table are designated as a primary key through a MOREINFO="NONE"primary key constraint.REMAP="UN--Under"The referenced columns must be constrained by a unique index in that referenced table. You can create that unique index using either the MOREINFO="NONE"unique constraint or the MOREINFO="NONE"create index statement.The datatypes of the referencing table columns must exactly match the datatypes of the referenced table columns. For example, the datatype of col1 in the referencing table (test_type) matches the datatype of pub_id in the referenced table (publishers):REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table test_type(col1 char(4) not null    references publishers(pub_id),col2 varchar(20) not null)The referenced table must exist at the time you define the referential integrity constraint. For tables that cross-reference one another, use the MOREINFO="NONE"create schema statement to define both tables "simultaneously." As an alternative, create one table without the constraint and later add it using the MOREINFO="NONE"alter table statement. See LINKEND="X48762"create schema
 or LINKEND="X68185"alter table
 in this chapter for more information.The MOREINFO="NONE"create table referential integrity constraints offer a simple way to enforce data integrity. Unlike triggers, they cannot:MARK="DASH" REMAP="BS--BulletSub""Cascade" changes through related tables in the databaseEnforce complex restrictions by referencing other columns or database objectsPerform "what-if" analysisREMAP="UN--Under"Referential integrity constraints do not roll back transactions when a data modification violates the constraint. Triggers allow you to choose whether to roll back or continue the transaction depending on how you handle referential integrity.SQL Server checks referential integrity constraints before any triggers, so a data modification statement that violates the constraint does not also fire the trigger. ID="IN4333-2712972"Referential integrity constraintscross-database;Constraints:cross-databaseUsing Cross-Database Referential Integrity ConstraintsMARK="BULL" REMAP="BU--Bullet"When you create a cross-database constraint, SQL Server stores the following information in the sysreferences system table of each database:TOCENTRY="1"LBL="Table 1-10: "Information stored about cross-database referential integrity 
constraintsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" NAMEST="C2" NAMEEND="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysreferences Column forCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"InformationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Referenced TableCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Referencing TableVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Key Column IDsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"refkey1 through refkey16COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fokey1 through fokey16COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table IDCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"reftabidCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tableidCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database NameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pmrydbname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"frgndbnameYou can drop the referencing table or its database without problems. SQL Server automatically removes the foreign key information from the referenced database.Because the referencing table depends on information from the referenced table, SQL Server does not allow you to:MARK="DASH" REMAP="BS--BulletSub"Drop the referenced table,Drop the external database that contains it, orRename either database with MOREINFO="NONE"sp_renamedbREMAP="UN--Under"You must first remove the cross-database constraint with MOREINFO="NONE"alter table.Each time you add or remove a cross-database constraint, or drop a table that contains a cross-database constraint, dump both of the affected databases. Loading earlier dumps of these databases could cause database corruption.The sysreferences system table stores the name-not the ID number-of the external database. SQL Server cannot guarantee referential integrity if you use MOREINFO="NONE"load database to change the database name or to load it onto a different server.Before dumping a database in order to load it with a different name or move it to anotherSQL Server, use alter table to drop all external referential integrity constraints.Check ConstraintsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"check constraints limit the values users can insert into a column of a table. A MOREINFO="NONE"check constraint specifies a search_condition which any value must pass before it is inserted into the table. A search_condition can include:ID="IN4312-3113373"like keywordcheck constraint usingMARK="DASH" REMAP="BS--BulletSub"A list of constant expressions introduced with MOREINFO="NONE"inID="IN4315-3513774"between keywordcheck constraint usingA range of constant expressions introduced with MOREINFO="NONE"betweenID="IN4310-3914175"in keywordcheck constraint usingA set of conditions introduced with MOREINFO="NONE"like which may contain wildcard charactersREMAP="UN--Under"An expression can include arithmetic operators and Transact-SQL built-in functions. The search_condition cannot contain subqueries, aggregate functions, or a host variable or parameter. SQL Server does not enforce MOREINFO="NONE"check constraints for temporary tables.If the check constraint is a column-level check constraint, it can only reference the column on which it is defined, it cannot reference other columns in the table. Table-level check constraints can reference any columns in the table. MOREINFO="NONE"create table allows multiple MOREINFO="NONE"check constraints in a column definition.MOREINFO="NONE"check integrity constraints offer an alternative to using rules and triggers. They are specific to the table in which they are created, and cannot be bound to columns of other tables or to user-defined datatypes.ID="IN4316-4314576"IDENTITY columnscreate table and
MOREINFO="NONE"IDENTITY ColumnsMARK="BULL" REMAP="BU--Bullet"The first time you insert a row into the table, SQL Server assigns the IDENTITY column a value of 1. Each new row gets a column value one higher than the last. This value takes precedence over any defaults declared for the column in the MOREINFO="NONE"create table statement or bound to the column with the MOREINFO="NONE"sp_bindefault system procedure. The maximum value that can be inserted into the IDENTITY column is 10 precision - 1.Only the table owner, Database Owner, or System Administrator can explicitly insert a value into an IDENTITY column after setting MOREINFO="NONE"identity_insert on for the base table. (At any given time, a user can turn the MOREINFO="NONE"identity_insert option on for a single table in a database.) REMAP="UN--Under"Inserting a value into the IDENTITY column allows you to specify a "seed" value for the column or to restore a row that was deleted in error. Unless you have created a unique index on the IDENTITY column, SQL Server does not verify the uniqueness of the value; you can insert any positive integer.You can reference an IDENTITY column using the MOREINFO="NONE"syb_identity keyword, qualified by the table name where necessary, in place of the actual column name.System Administrators can use the MOREINFO="NONE"auto identity database option to automatically include a 10-digit IDENTITY column in new tables. To turn this feature on in a database, use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_dboption database_name, "auto identity", "true"REMAP="UN--Under"Each time a user creates a table in the database without specifying either a MOREINFO="NONE"primary key, a MOREINFO="NONE"unique constraint, or an IDENTITY column, SQL Server automatically defines an IDENTITY column. This column, MOREINFO="NONE"SYB_IDENTITY_COL, is not visible when you retrieve columns with the MOREINFO="NONE"select * statement; you must explicitly include the column name in the select list.Server failures can create gaps in IDENTITY column values. The maximum size of the gap depends on the setting of the MOREINFO="NONE"identity burning set factor configuration variable. Gaps can also occur due to transaction rollbacks, the deletion of rows, or the manual insertion of data into the IDENTITY column.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The following are Transact-SQL 
extensions:

The MOREINFO="NONE"on segment_name clause 
Use of a database name to qualify a 
table or column name
IDENTITY columns
The MOREINFO="NONE"not null column default
See "Datatypes" for datatype 
compliance information.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PermissionsREMAP="BO--Body"MOREINFO="NONE"create table permission defaults to the Database Owner, who can transfer it to other users. Any user can create temporary tables. See AlsoCommands     LINKEND="X68185"alter table
MOREINFO="NONE", LINKEND="X58868"create index
MOREINFO="NONE", LINKEND="X43186"create rule
MOREINFO="NONE", LINKEND="X48762"create schema
MOREINFO="NONE", LINKEND="X30101"create view
MOREINFO="NONE", LINKEND="X93093"drop index
MOREINFO="NONE", LINKEND="X62555"drop rule
MOREINFO="NONE", LINKEND="X58548"drop tableTopics      LINKEND="X84316"Datatypes
, LINKEND="X01073"IDENTITY ColumnsSystem procedures     LINKEND="X36529"sp_addmessage
MOREINFO="NONE", LINKEND="X62957"sp_addsegment
MOREINFO="NONE", LINKEND="X32817"sp_addtype
MOREINFO="NONE", LINKEND="X87441"sp_bindmsg
MOREINFO="NONE", LINKEND="X22659"sp_commonkey
MOREINFO="NONE", LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X50021"sp_foreignkey
MOREINFO="NONE", LINKEND="X91431"sp_help
MOREINFO="NONE", LINKEND="X90336"sp_helpjoins
MOREINFO="NONE", LINKEND="X36403"sp_helpsegment
MOREINFO="NONE", LINKEND="X43109"sp_primarykey
MOREINFO="NONE", LINKEND="X37949"sp_rename
MOREINFO="NONE", LINKEND="X50477"sp_spaceused
ID="IN4320-4714981"create table command
ID="IN436-4815082"Tablescreating new
ID="IN438-5115383"Triggerscreating;Referential integrity constraints:triggers and;Creating:triggersID="X19955"create triggerID="IN4422-5515884"create trigger command
ID="IN4420-5515886"Automatic operationstriggers
ID="IN4439-5816187"Stored procedure triggers. See Triggers
Creates a trigger, a type of stored procedure often used for enforcing integrity constraints. A trigger executes automatically when a user attempts a specified data modification statement on a specified table. FORMAT="LINESPECIFIC"create trigger [owner.]trigger_name on [owner.]table_name {for {insert , update , delete} as SQL_statementsREMAP="BO--Body"Or, using the MOREINFO="NONE"if update clause:FORMAT="LINESPECIFIC"create trigger [owner.]trigger_name on [owner.]table_name for {insert , update} as     [if update (column_name)         [{and | or} update (column_name)]...]         SQL_statements    [if update (column_name)         [{and | or} update (column_name)]...         SQL_statements]...Keywords and OptionsREMAP="RI--RefIndent"ID="IN446-5816190"Namingtriggers
trigger_name - is the name of the trigger. It must conform to the rules for identifiers, and be unique in the database. MOREINFO="NONE"insert, MOREINFO="NONE"update, MOREINFO="NONE"delete - can be included in any combination. MOREINFO="NONE"delete ID="IN4432-6216591"if update clause, create trigger
cannot be used with the MOREINFO="NONE"if update clause.ID="IN4414-6416792"SQL statementscreate trigger
SQL_statements - specify trigger conditions and trigger actions. Trigger conditions determine whether the attempted MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"delete cause the trigger actions to be carried out. They often include a subquery preceded by the keyword MOREINFO="NONE"if. In Example 2, the subquery that follows the keyword MOREINFO="NONE"if is the trigger condition. REMAP="UN--Under"Trigger actions take effect when the user action (MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"deleteID="IN448-6416793"Groupingmultiple trigger actions;Multiple trigger actions
) is attempted. If multiple trigger actions are specified, they are grouped with ID="IN4420-6616994"begin...end commandstriggers and
MOREINFO="NONE"begin and MOREINFO="NONE"end. REMAP="UN--Under"See LINKEND="X39012""Triggers and Transactions"
 for a list of statements that are not allowed in a trigger definition. See LINKEND="X40661""The deleted and inserted Logical Tables"
 for information about the deleted and inserted logical tables that can be included in trigger definitions.ID="IN4432-7017395"if update clause, create trigger
MOREINFO="NONE"if MOREINFO="NONE"update is used to test if the specified column has been modified in any way. This allows specified trigger actions to be associated with updates to specified columns. See Example 3. More than one column can be specified, and you can use more than one MOREINFO="NONE"if update statement in a MOREINFO="NONE"create trigger statement.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create trigger reminder on titles for insert, update as print "Don't forget to print a report for accounting." REMAP="UN--Under"Prints a message every time anyone tries to add data or change data in the titles table. create trigger t1 on titleauthor for insert as if (select count(*)         from titles, inserted         where titles.title_id = inserted.title_id) = 0begin print "Please put the book's title_id in the         titles table first." rollback transaction end REMAP="UN--Under"Prevents insertion of a new row into titleauthor if there is no corresponding title_id in the titles table.create trigger t2 on publishers for update as if update (pub_id) and @@rowcount = 1begin     update titles     set titles.pub_id = inserted.pub_id     from titles, deleted, inserted     where deleted.pub_id = titles.pub_id end REMAP="UN--Under"If the pub_id column of the publishers table is changed, make the corresponding change in the titles table. create trigger t3 on titleauthor for delete as begin     delete titles     from titles, deleted     where deleted.title_id = titles.title_id     delete titleauthor     from titleauthor, deleted     where deleted.title_id = titleauthor.title_id    print "All references to this title have been    deleted from titles and titleauthor." end REMAP="UN--Under"If any row is deleted from titleauthor, that title is also deleted from the titles table. If the book was written by more than one author, other references to it in titleauthor are also deleted. CommentsID="IN4428-7017398"Cascading changes (triggers)Triggers and Referential IntegrityMARK="BULL" REMAP="BU--Bullet"Triggers are commonly used to enforce referential integrity (integrity rules about relationships between the primary and foreign keys of tables or views), to supply cascading deletes, and to supply cascading updates. (See Examples 2, 3, and 4, respectively.) You can also enforce referential integrity using constraints defined with the MOREINFO="NONE"create table statement as an alternative to using MOREINFO="NONE"create trigger. See LINKEND="X80969""create table"
and LINKEND="X68185""alter table"
 for information about integrity constraints.ID="X40661"The deleted and inserted Logical TablesMARK="BULL" REMAP="BU--Bullet"ID="IN4413-7217599"deleted tabletriggers and
deletedID="IN4414-74177100"inserted tabletriggers and
 and insertedID="IN4427-74177101"Conceptual (logical) tables
 are logical (conceptual) tables. They are structurally like the table for which the trigger is defined-that is, the table on which the user action is attempted-and hold the old values or new values of the rows that would be changed by the user action. deleted and inserted tables can be examined by the trigger to determine whether or how the trigger action(s) should be carried out, but cannot be altered themselves by the triggers actions. deleted tables are used with MOREINFO="NONE"delete and MOREINFO="NONE"update; inserted with MOREINFO="NONE"insert and MOREINFO="NONE"update. (An update is a delete followed by an insert: it affects the deleted table first, then the inserted table). See examples. Trigger RestrictionsMARK="BULL" REMAP="BU--Bullet"You can create a trigger only in the current database. If you use an owner name to qualify a trigger, you must explicitly qualify the table name the same way. A trigger may reference objects outside the current database.A trigger cannot apply to more than one table. However, the same trigger action can be defined for more than one user action (e.g., MOREINFO="NONE"insert and MOREINFO="NONE"update) in the same MOREINFO="NONE"create triggerID="IN4420-74177102"Number (quantity of)different triggers
ID="IN4414-76179103"insert commandtriggers and
 statement. A table can have a maximum of three different triggers-one each for MOREINFO="NONE"insertID="IN4414-78181104"update commandtriggers and
, MOREINFO="NONE"updateID="IN4414-80183105"delete commandtriggers and
, and MOREINFO="NONE"delete. ID="IN448-80183106"Messagestrigger;Overwriting triggersEach new trigger on a table or column for the same operation (MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"delete) overwrites the previous one, and no warning message is given before the overwrite occurs.You cannot create a trigger on a temporary table. You cannot create a trigger on a view. ID="IN4414-82185107"select commandtriggers andIt is recommended that a trigger not include select statements that return results to the user, since special handling for these returned results would have to be written into every application program in which modifications to the trigger table are allowed. If a trigger references table names, column names, or view names that are not valid identifiers, you mustMOREINFO="NONE" set quoted_identifier on before the MOREINFO="NONE"create trigger command and enclose each such name in double quotes. The MOREINFO="NONE"quoted_identifier option does not need to be on when the trigger fires.Getting Information about TriggersID="IN447-82185108"Displaytrigger text
ID="IN4419-84187109"sysprocedures tabletriggers inMARK="BULL" REMAP="BU--Bullet"The execution plan for a trigger is stored in sysprocedures. Each trigger is assigned an identification number, which is stored as a new row in sysobjects and as an entry in the sysobjects row for the table to which it applies. To display the text of a trigger, which is stored in syscomments, execute the system procedure MOREINFO="NONE"sp_helptext. For a report on a trigger, execute the system procedure MOREINFO="NONE"sp_help. For a report on the tables and views that are referenced by a trigger, use MOREINFO="NONE"sp_depends. Triggers and PerformanceID="IN448-84187110"Overheadtriggers;Performance:triggers and
ID="IN448-84187111"TriggersTime intervaltime interval;Time interval:for running a triggerrunning a triggerMARK="BULL" REMAP="BU--Bullet"In performance terms, trigger overhead is usually very low. The time involved in running a trigger is spent mostly in referencing other tables, which are either in memory or on the database device. ID="IN4427-84187112"Logical (conceptual) tables
ID="IN4413-86189113"deleted tabletriggers andThe deletedID="IN4414-88191114"inserted tabletriggers and
 and inserted tables often referenced by triggers are always in memory rather than on the database device, because they are logical tables. The location of other tables referenced by the trigger determines the amount of time the operation takes. Setting Options Within TriggersID="IN4411-90193115"set commandinside a triggerMARK="BULL" REMAP="BU--Bullet"You can use the MOREINFO="NONE"set command inside a trigger. The MOREINFO="NONE"set option you invoke remains in effect during the execution of the trigger, and then reverts to its former setting. In particular, the MOREINFO="NONE"self_recursion option, described above, can be used inside a trigger, so that data modifications by the trigger itself can cause the trigger to fire again.Dropping a TriggerID="IN448-90193116"Droppingtriggers;Dropping:tables with triggers
ID="IN448-90193117"Renamingtriggers;Triggers:renamingMARK="BULL" REMAP="BU--Bullet"You must drop and recreate the trigger if you rename any of the objects that the trigger references. You can rename a trigger with MOREINFO="NONE"sp_rename. When you drop a table, any triggers associated with it are also dropped. ID="IN4422-94197118"truncate table commanddelete triggers andActions That Cause Triggers to FireMARK="BULL" REMAP="BU--Bullet"A MOREINFO="NONE"truncate MOREINFO="NONE"table command is not caught by a MOREINFO="NONE"delete trigger. Although a MOREINFO="NONE"truncate MOREINFO="NONE"table statement is, in effect, like a MOREINFO="NONE"delete without a MOREINFO="NONE"where clause (it removes all rows), changes to the data rows are not logged, and so cannot "fire" a trigger. REMAP="UN--Under"Since permission for the MOREINFO="NONE"truncate MOREINFO="NONE"table command defaults to the table owner and is not transferable, only the table owner need worry about inadvertently circumventing a MOREINFO="NONE"delete trigger with a MOREINFO="NONE"truncate MOREINFO="NONE"table statement. ID="IN4417-96199119"writetext commandtriggers andThe MOREINFO="NONE"writetext command, whether logged or unlogged, does not cause a trigger to fire. ID="IN447-96199120"Queriestrigger firing perA trigger fires only once per data modification statement. A complex query containing a MOREINFO="NONE"while loop may repeat an MOREINFO="NONE"update or MOREINFO="NONE"insert many times, and the trigger is fired each time. ID="IN4414-96199121"Trigger tablesID="X39012"Triggers and TransactionsMARK="BULL" REMAP="BU--Bullet"Once a trigger is defined, the action it specifies on the table to which it applies is always implicitly part of a transaction, along with the trigger itself. Triggers are often used to roll back an entire transaction if an error is detected, or can roll back the effects of a specific data modification:ID="IN448-98201122"Triggersrollback inMARK="DASH" REMAP="BS--BulletSub"When the trigger contains the ID="IN4416-100203123"rollback commandtriggers and
MOREINFO="NONE"rollback transaction command, the rollback aborts the entire batch, and any statements in the batch following the rollback will not be executed. ID="IN448-102205124"Triggersrollback in
ID="IN4424-104207125"rollback trigger commandWhen the trigger contains the MOREINFO="NONE"rollback trigger, the rollback affects only the data modification that caused the trigger to fire. The MOREINFO="NONE"rollback trigger command can include a MOREINFO="NONE"raiserror statement. Subsequent statements in the batch are executed.Since triggers execute as part of a transaction, the following statements are not allowed in a trigger: MARK="DASH" REMAP="BS--BulletSub"All MOREINFO="NONE"create commands, including MOREINFO="NONE"create database, MOREINFO="NONE"create MOREINFO="NONE"table, MOREINFO="NONE"create index, MOREINFO="NONE"create MOREINFO="NONE"procedure, MOREINFO="NONE"create MOREINFO="NONE"default, MOREINFO="NONE"create MOREINFO="NONE"rule, MOREINFO="NONE"create MOREINFO="NONE"trigger, andMOREINFO="NONE" create MOREINFO="NONE"view All MOREINFO="NONE"drop commandsMOREINFO="NONE"alter table and MOREINFO="NONE"alter database MOREINFO="NONE"truncate MOREINFO="NONE"table MOREINFO="NONE"grant and MOREINFO="NONE"revokeMOREINFO="NONE"update MOREINFO="NONE"statisticsMOREINFO="NONE"reconfigure MOREINFO="NONE"load database and MOREINFO="NONE"load transactionMOREINFO="NONE"disk init,MOREINFO="NONE" disk mirror, MOREINFO="NONE"disk refit,MOREINFO="NONE" disk reinit,MOREINFO="NONE" disk remirror, MOREINFO="NONE"disk unmirrorMOREINFO="NONE"select MOREINFO="NONE"intoID="IN448-106209126"TriggersTriggers@@rowcount androwcount and
ID="IN4426-108211127"@@rowcount global variableatatrowcount global variabletriggers andtriggers and;rowcount global variable:triggers andIf a desired result (such as a summary value) depends on the number of rows a data modification affects, you should use @@rowcount to test for multi-row data modifications (an MOREINFO="NONE"insert, MOREINFO="NONE"delete, or MOREINFO="NONE"update based on a MOREINFO="NONE"select statement), and take appropriate actions. Any Transact-SQL statement which does not return rows (such as an MOREINFO="NONE"if statement) sets @@rowcount to zero, so the test of @@rowcount should occur at the beginning of the trigger. Update and Insert TriggersMARK="BULL" REMAP="BU--Bullet"When an MOREINFO="NONE"insert or MOREINFO="NONE"update command is executed, rows are added to the trigger table and to inserted at the same time. The rows in inserted are always duplicates of one or more rows in the trigger table. ID="IN4414-112215128"update commandtriggers and;insert command:triggers and
ID="IN4432-116219129"if update clause, create triggerAn MOREINFO="NONE"update or MOREINFO="NONE"insert trigger can use the MOREINFO="NONE"if MOREINFO="NONE"update command to determine whether the MOREINFO="NONE"update or MOREINFO="NONE"insert changed a particular column. MOREINFO="NONE"if MOREINFO="NONE"update(column_name) is true for an MOREINFO="NONE"insert statement whenever the column is assigned a value in the select list or in the MOREINFO="NONE"valuesID="IN4411-116219130"Null valuestriggers and
 clause. An explicit NULL or a default assigns a value to a column, and thus activates the trigger. An implicit NULL, however, does not. Here are some examples: NUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create table junk (a int null, b int not null) /* If update is true for either column */insert junk (a, b) values (1, 2)MOREINFO="NONE" insert junk /* if update is true for either column */values(1,2) insert junk /* explicit null *//* if update is true for either column */values(NULL,2)MOREINFO="NONE" insert junk (b)/* with a default for column a, values(2) /* if update is true for either column */insert junk (b) /* with no default for column a, values(2) /* if update is not true for column a */REMAP="UN--Under"MOREINFO="NONE"if update is never true for a MOREINFO="NONE"delete statement.ID="IN448-117220131"TriggersnestedNesting Triggers and Trigger RecursionMARK="BULL" REMAP="BU--Bullet"SQL Server allows nested triggers by default. To prevent triggers from nesting, use MOREINFO="NONE"sp_configureID="IN4438-119222132"nested triggers configuration variable
 to set the MOREINFO="NONE"nested triggers option to 0 (off), as follows: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_configure "nested triggers", 0 ID="IN446-119222133"Levelsnesting triggers;Nesting:levels of triggers;Nesting:triggers
ID="IN4420-119222134"Number (quantity of)nesting levels, for triggers
ID="IN4417-119222135"Calling procedurenesting and
ID="IN445-119222136"Loopstrigger chain infinite
ID="IN4416-121224137"rollback commandtriggers andTriggers can be nested to a depth of 16 levels. If a trigger changes a table on which there is another trigger, the second trigger will fire, and can then call a third trigger, and so forth. If any trigger in the chain sets off an infinite loop, the nesting level will be exceeded and the trigger will abort, rolling back the transaction which contains the trigger query. ID="IN4414-121224138"Error handlingtriggers and
ID="IN4414-121224139"Debugging aidstriggers andSince triggers are put into a transaction, a failure at any level of a set of nested triggers cancels the entire transaction: all data modifications are rolled back. Supply your triggers with messages and other error handling and debugging aids in order to determine where the failure occurred. ID="IN4427-123226140"@@nestlevel global variableatatnestlevel global variable;nestlevel global variableID="IN448-125228141"TriggersTriggers@@nestlevel andnestlevel andThe global variable @@nestlevel contains the nesting level of the current execution. Each time a stored procedure or trigger calls another stored procedure or trigger, the nesting level is incremented. If the maximum of 16 is exceeded, the transaction aborts.ID="IN448-125228142"Triggersstored procedures and
ID="IN4419-125228143"Recursions, limitedIf a trigger calls a stored procedure that performs actions which would cause the trigger to fire again, the trigger is only re-activated if nested triggers are enabled. Unless there are conditions within the trigger that limit the number of recursions, this causes a nesting-level overflow. ID="IN4438-127230144"nested triggers configuration variableREMAP="UN--Under"For example, if an update trigger calls a stored procedure that performs an update, the trigger and stored procedure execute exactly once if MOREINFO="NONE"nested triggers is set off. If MOREINFO="NONE"nested triggersID="IN4420-127230145"Number (quantity of)updates
 is set on, and the number of updates is not limited by some condition in the trigger or procedure, the procedure/trigger loop continues until it exceeds the 16-level maximum nesting value.ID="IN448-128231146"Updatingtrigger firing perBy default, a trigger does not call itself in response
to a second data modification to the same table within the trigger, regardless of the setting of theMOREINFO="NONE" nested triggers configuration variable. A MOREINFO="NONE"setID="IN448-128231147"TriggersrecursionID="IN448-128231148"Triggersenabling self recursionID="IN448-128231149"Triggersself recursionID="IN4426-131234150"self_recursion option, set option, MOREINFO="NONE"self_recursion, enables a trigger to fire again as a result of a data modification within the trigger. For example, if an update trigger on one column of a table results in an update to another column, the update trigger only fires once when self recursion is disabled, but it can fire up to 16 times if self recursion is set on. The MOREINFO="NONE"nested triggers configuration variable must also be enabled in order for self recursion to take place.ID="IN448-132235151"Updatingtrigger firing per
ID="IN448-133236152"TriggersnestedStandards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"create trigger permission defaults to the table owner and is not transferable, except to the Database Owner, who can impersonate the table owner by running the MOREINFO="NONE"setuser command. See AlsoCommands     LINKEND="X68185"alter table
MOREINFO="NONE", LINKEND="X52197"create procedure
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X48835"drop trigger
MOREINFO="NONE", LINKEND="X80111"rollback trigger
MOREINFO="NONE", LINKEND="X64136"setSystem procedures     LINKEND="X22659"sp_commonkey
MOREINFO="NONE", LINKEND="X60334"sp_configure
MOREINFO="NONE", LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X50021"sp_foreignkey
MOREINFO="NONE", LINKEND="X91431"sp_help
,LINKEND="X25756"sp_helptext
MOREINFO="NONE", LINKEND="X43109"sp_primarykey
MOREINFO="NONE", LINKEND="X37949"sp_rename
MOREINFO="NONE", LINKEND="X50477"sp_spaceused
ID="IN4419-138241156"create view commandcreatingID="X30101"create viewID="IN4517-141245158"Multi-table viewsMulti-table viewsSee also Views!see also Views
Creates a view, which is an alternative way of looking at the data in one or more tables. FORMAT="LINESPECIFIC"create view [owner.]view_name [(column_name [, column_name]...)] as select [distinct] select_statement[with check option]Keywords and OptionsREMAP="RI--RefIndent"ID="IN456-141245161"Namingviews
view_name - is the name of the view. The name cannot include the database name. If you have MOREINFO="NONE"set quoted_identifier on, you can use a delimited identifier. Otherwise, the view name must conform to the rules for identifiers. For more information about valid view names, see LINKEND="X62459""Identifiers"
.ID="IN455-141245162"Namescolumn, in views;Naming:columns in views
ID="IN457-141245163"Columnsviews and
column_name ID="IN4516-141245164"Headings, columnHeadings, columnin viewsviews
- specifies names to be used as headings for the columns in the view. If you have set MOREINFO="NONE"quoted_identifier on, you can use a delimited identifier. Otherwise, the column name must conform to the rules for identifiers. For more information about valid column names, see LINKEND="X62459""Identifiers"REMAP="UN--Under"It is always legal to supply column names, but is required only when a column is derived from an arithmetic expression, function, string concatenation, or constant; when two or more columns have the same name (usually because of a join); or when you want to give a column in a view a different name than the column from which it is derived (see Example 3). Column names can also be assigned in the MOREINFO="NONE"select statement (see Example 4). If no column names are specified, the view columns acquire the same names as the columns in the MOREINFO="NONE"select statement. REMAP="RI--RefIndent"ID="IN4526-145249165"select option, create view
MOREINFO="NONE"select - begins the MOREINFO="NONE"select
statement that defines the view.REMAP="RI--RefIndent"ID="IN4516-149253166"distinct keywordcreate view
MOREINFO="NONE"distinct - specifies that the view may not contain duplicate rows (optional).ID="IN4514-153257167"select commandcreate view and
select_statement - completes the MOREINFO="NONE"select statement that defines the view. It can use more than one table and other views.ID="IN4524-157261168"with check option optioncreate view
MOREINFO="NONE"with check option- indicates that all data modification statements are validated against the view selection criteria. All rows inserted or updated through the view must remain visible through the view.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create view titles_view as select title, type, price, pubdate from titlescreate view "new view" ("column 1", "column 2")as select col1, col2 from "old view"REMAP="UN--Under"Creates the new view view from old view. Both columns are renamed in the new view. All view and column names that include embedded blanks are enclosed in double quotation marks. Before creating the view, you must MOREINFO="NONE"set quoted_identifier on.create view accounts (title, advance, amt_due) as select title, advance, price * total_sales from titles where price > $5MOREINFO="NONE" create view cities (authorname, acity, publishername, pcity) as select au_lname, authors.city, pub_name,publishers.city from authors, publishers where authors.city = publishers.city REMAP="UN--Under"Creates a view derived from two base tables, authors and publishers. The view contains the names and cities of the authors that live in the same city as a publisher.create view cities2 as select authorname = au_lname,acity = authors.city, publishername = pub_name, pcity = publishers.city from authors, publishers where authors.city = publishers.city REMAP="UN--Under"Creates a view with the same definition as in Example 3, but with column headings provided in the MOREINFO="NONE"select statement.create view author_codesas select distinct au_idfrom titleauthorREMAP="UN--Under"Creates a view, author_codes, derived from titleauthor which lists the unique author identification codes.create view price_list (price)as select distinct pricefrom titlescreate view stores_calas select * from storeswhere state = "CA"with check optionREMAP="UN--Under"Creates a view of the stores table that excludes information about stores outside of California. The MOREINFO="NONE"with check option clause validates each inserted or updated row against the view's selection criteria. Rows for which state has any value other than "CA" are rejected.create view stores_cal30as select * from stores_calwhere payterms = "Net 30"REMAP="UN--Under"Creates a view, stores_cal30, which is derived from stores_cal. The new view inherits the check option from stores_cal; all rows inserted or updated through stores_cal30 must have a state value of "CA". Because stores_cal30 has no MOREINFO="NONE"with check option clause, it is possible to insert or update rows through stores_cal30 for which payterms has a value other than "Net 30".create view stores_cal30_checkas select * from stores_calwhere payterms = "Net 30"with check optionREMAP="UN--Under"Creates a view, stores_cal30_check, derived from stores_cal. The new view inherits the check option from stores_cal. It also has a MOREINFO="NONE"with check option clause of its own. Each row inserted or updated through stores_cal30_check is validated against the selection criteria of both stores_cal and stores_cal30_check. Rows with a state value other than "CA" or a payterms value other than "Net 30" are rejected.CommentsID="IN458-157261171"Securityviews andMARK="BULL" REMAP="BU--Bullet"You can use views as security mechanisms by granting permission on a view but not on its underlying tables. Restrictions on ViewsMARK="BULL" REMAP="BU--Bullet"You can only create a view in the current database.ID="IN4517-157261172"Number of columnsNumber of columnsin a viewview
The number of columns referenced by a view cannot exceed 250. You cannot create a view on a temporary table. You cannot create a trigger or build an index on a view. You cannot use MOREINFO="NONE"readtext or MOREINFO="NONE"writetext on text or image columns in views. You cannot include MOREINFO="NONE"order by or MOREINFO="NONE"compute clauses, the keyword MOREINFO="NONE"into, or the MOREINFO="NONE"union operator in the MOREINFO="NONE"select statements that define views.MOREINFO="NONE"create MOREINFO="NONE"view statements can be combined with other SQL statements in a single batch. View ResolutionID="IN458-160264173"ChangingChangingSee also Updating!see also Updating
ID="IN458-160264174"Updatingdata in views
ID="IN455-160264175"Viewschanges to underlying tables ofMARK="BULL" REMAP="BU--Bullet"If you alter the structure of a view's underlying table(s) by adding or deleting columns, the new columns will not appear in a view defined with a "MOREINFO="NONE"selectID="IN4513-162266176"Asterisks (*)select and
 *" clause unless the view is deleted and redefined. The asterisk shorthand is interpreted and expanded when the view is first created. To get a report of the tables or views on which a view depends, and of objects that depend on a view, execute the system procedure MOREINFO="NONE"sp_depends. If a view depends on a table (or view) that has been dropped, SQL Server produces an error message if anyone tries to use the view. If a new table (or view) with the same name and schema is created to replace the one that has been dropped, the view again becomes usable. You can redefine a view without redefining other views that depend on it unless the redefinition makes it impossible for SQL Server to translate the dependent view. To display the text of a view, which is stored in syscomments, execute the system procedure MOREINFO="NONE"sp_helptext with the view name as the parameter. ID="IN458-162266177"Renamingviews;Views:renamingYou can rename a view with MOREINFO="NONE"sp_rename. ID="IN4511-162266178"Outer joinsviews andIf you define a view with an outer join, and then query the view with a qualification on a column from the inner table of the outer join, the results may be other than what you expect. All rows from the inner table are returned. Rows that do not meet the qualification show a NULL value in the appropriate columns of those rows. ID="IN457-162266179"Queriesviews andWhen you query through a view, SQL Server checks to make sure that all the database objects referenced anywhere in the statement exist, that they are valid in the context of the statement, and that data update commands do not violate data integrity rules. If any of these checks fail, you get an error message. If the checks are successful, it "translates" the view into an action on the underlying table(s). For more information about views, see the Transact-SQL User's Guide. ID="IN458-162266180"Updatingdata in viewsModifying Data Through ViewsMARK="BULL" REMAP="BU--Bullet"ID="IN4517-164268181"Multi-table viewsdelete and
MOREINFO="NONE"delete statements are not allowed on multi-table views.ID="IN4514-166270182"insert commandnull/not null columns and;Not null values:views and
MOREINFO="NONE"insert statements are not allowed unless all MOREINFO="NONE"not null columns in the underlying table or view are included in the view through which you are inserting new rows. (SQL Server has no way to supply values for MOREINFO="NONE"not null columns in the underlying table or view.) You cannot insert a row through a view that includes a computed column.ID="IN4514-168272183"insert commandviews and;Multi-table views
ID="IN455-170274184"Viewswith check option
MOREINFO="NONE"insert statements are not allowed on join views created with MOREINFO="NONE"distinct or MOREINFO="NONE"with check option.ID="IN4514-172276185"update commandviews and;Multi-table views
MOREINFO="NONE"updateID="IN455-174278186"Viewsupdate and
 statements are allowed on join views MOREINFO="NONE"with check option. The update fails if any of the affected columns appears in the MOREINFO="NONE"where clause, in an expression that includes columns from more than one table.If you insert or update a row through a join view, all affected columns must belong to the same base table.You cannot update or insert into a view defined with the MOREINFO="NONE"distinct clause. Data update statements cannot change any column in a view that is a computation, and cannot change a view that includes aggregates. ID="IN4516-176280187"IDENTITY columnsviews and
MOREINFO="NONE"IDENTITY Columns and ViewsMARK="BULL" REMAP="BU--Bullet"You cannot add a new IDENTITY column to a view with the column_name = MOREINFO="NONE"identity(precision) syntax.To insert an explicit value into an IDENTITY column, the table owner, Database Owner, or the System Administrator must MOREINFO="NONE"set MOREINFO="NONE"identity_insert MOREINFO="NONE"on for the column's base table, not through the view through which it is being inserted. At any given time, a user canMOREINFO="NONE" set identity_insert on for a single table in a database.ID="IN4515-178282188"group by clauseviews andMOREINFO="NONE"group by Clauses and ViewsID="IN4519-178282189"Aggregate functionsviews andMARK="BULL" REMAP="BU--Bullet"If a view definition statement includes aggregate functions as well as qualifications and/or a MOREINFO="NONE"group by, that MOREINFO="NONE"group by or qualification is ignored if the query on the view does not include the aggregated column(s). Do not define a view with a MOREINFO="NONE"group by unless the view definition also includes an aggregate function. If you do so, the MOREINFO="NONE"group by is ignored when you retrieve data from the view. ID="IN4516-182286190"distinct keywordcreate view
MOREINFO="NONE"distinct Clauses and ViewsMARK="BULL" REMAP="BU--Bullet"The MOREINFO="NONE"distinct clause defines a view as a database object that contains no duplicate rows. A row is defined to be a duplicate of another row if all of its columns' values exactly match the same columns' values in another row. Null values are considered to be duplicates of other null values. REMAP="UN--Under"Querying a subset of a view's columns can result in what appear to be duplicate rows. However, the underlying rows in the view are still unique. This is because SQL Server applies the MOREINFO="NONE"distinct requirement to the view's definition when it accesses the view for the first time (before it does any projection and selection), so that all the view's rows are distinct from each other. If you select a subset of columns, some of which contain the same values, the results appear to contain duplicate rows. REMAP="UN--Under"You can specify MOREINFO="NONE"distinct more than once in the view definition's MOREINFO="NONE"select statement to eliminate duplicate rows, as part of an aggregate function or a MOREINFO="NONE"group by clause. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select distinct count(distinct title_id), pricefrom titlesThe scope of the MOREINFO="NONE"distinct applies only for that view; it does not cover any new views derived from the MOREINFO="NONE"distinct view.ID="IN4524-184288191"with check option optionviews and
MOREINFO="NONE"with check option Clauses and ViewsMARK="BULL" REMAP="BU--Bullet"If a view is created MOREINFO="NONE"with check option, each row that is inserted or updated through the view must meet the selection criteria of the view.If a view is created MOREINFO="NONE"with check option, all views derived from the "base" view must satisfy its check option. Each row inserted or updated through the derived view must remain visible through the base view.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="350*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The use of more than one distinct 
keyword and the use of 
"column_heading= column_name" in 
the MOREINFO="NONE"select list are Transact-SQL 
extensions.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PermissionsREMAP="BO--Body"MOREINFO="NONE"create MOREINFO="NONE"view permission defaults to the Database Owner, who can transfer it to other users. The creator of a view must have MOREINFO="NONE"select permission on any objects referenced in the view definition. See AlsoCommands     LINKEND="X48762"create schema
MOREINFO="NONE", LINKEND="X31140"drop view
MOREINFO="NONE", LINKEND="X54355"updateSystem procedures     LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X91431"sp_help
MOREINFO="NONE", LINKEND="X25756"sp_helptext
MOREINFO="NONE", LINKEND="X37949"sp_renameREMAP="BO--Body"ID="X60179"dbccID="IN43149483"Data integritydbcc utility
Database Consistency Checker (MOREINFO="NONE"dbcc) checks the logical and physical consistency of a database. MOREINFO="NONE"dbccID="IN436190124"Checker, consistency. See dbcc (Database Consistency Checker)ID="IN435885175"Consistency check. See dbcc (Database Consistency Checker)ID="IN433578246"dbcc (Database Consistency Checker)dbcc (Database Consistency Checker)See also individual dbcc options!see alsoID="IN437773297"Integrity. See dbcc (Database Consistency Checker); Referential integrityID="IN436068348"Logical consistency. See dbcc (Database Consistency Checker)
ID="IN437063399"Physical database consistency. See dbcc (Database Consistency Checker)ID="IN4316604210"Space allocationSpace allocationSee also Database devices; Segments!see also Database devices; Segments should be used regularly as a periodic check, or if damage is suspected. FORMAT="LINESPECIFIC"dbcc {checktable({MOREINFO="NONE"table_name|table_id}[, skip_ncindex]) |  checkdb [(MOREINFO="NONE"database_name [, skip_ncindex] )] |   checkalloc [(MOREINFO="NONE"database_name [, fix | nofix])] | tablealloc ({MOREINFO="NONE"table_name | MOREINFO="NONE"table_id}    [, {full | optimized | fast | null}     [, fix | nofix ] ]] )| indexalloc {MOREINFO="NONE"table_name | MOREINFO="NONE"table_id}, MOREINFO="NONE"index_id    [, {full | optimized | fast | null}    [, fix | nofix ]] ) |  checkcatalog [(MOREINFO="NONE"database_name)] |   dbrepair (MOREINFO="NONE"database_name, dropdb) |    reindex ({MOREINFO="NONE"table_name | MOREINFO="NONE"table_id}) | fix_text ({MOREINFO="NONE"table_name | table_id}) }Keywords and OptionsREMAP="RI--RefIndent"ID="IN4323554713"checktable option, dbcc
MOREINFO="NONE"checktableID="IN4311534914"Log segmentdbcc checktable report on
ID="IN438515115"Segmentsdbcc checktable report on
 - checks the specified table to see that index and data pages are correctly linked, that indexes are in properly sorted order, that all pointers are consistent, that the data information on each page is reasonable, and that page offsets are reasonable. If the log segment is on its own device, running MOREINFO="NONE"dbcc MOREINFO="NONE"checktableID="IN4313475516"syslogs tablerunning dbcc checktable on
 on the syslogsID="IN435455717"Spacedbcc checktable reporting free;Space:used on the log segment
 table reports the log(s) used and free space. For example: table re t table reports the log(s) used and free space. For example:REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"MOREINFO="NONE"Checking syslogs The total number of data pages in this table is 1. *** NOTICE: Space used on the log segment is 0.20 Mbytes, 0.13%. *** NOTICE: Space free on the log segment is 153.4 Mbytes, 99.87%. DBCC execution completed.  If dbcc printed error messages, see your System Administrator. ID="IN4311455718"Log segmentnot on its own deviceREMAP="UN--Under"If the log segment is not on its own device, this message appears: REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"ID="IN4323406219"checktable option, dbcc
MOREINFO="NONE"*** NOTICE:  Notification of log space used/free cannot be reported because the log segment is not on its own device. ID="IN4319366620"skip_ncindex optiondbcc checktableREMAP="UN--Under"The MOREINFO="NONE"skip_ncindex option causes MOREINFO="NONE"dbcc checktable to skip checking the nonclustered indexes on user tables. The default is to check all indexes.ID="IN436346821"Tablesdbcc checkdb and
ID="IN4320307222"checkdb option, dbcc
MOREINFO="NONE"checkdb - runs the same checks as MOREINFO="NONE"checktable, but on each table, including syslogs, in the specified database. If no database name is given, MOREINFO="NONE"checkdb checks the current database. ID="IN4319267623"skip_ncindex optiondbcc checkdbREMAP="UN--Under"The MOREINFO="NONE"skip_ncindex option causes MOREINFO="NONE"dbcc checktable to skip checking the nonclustered indexes on a user table. The default is to check all indexes.ID="IN4323228024"checkalloc option, dbcc
MOREINFO="NONE"checkalloc - checks the specified database to see that all pages are correctly allocated, and that no page is allocated that isn't used. If no database name is given, MOREINFO="NONE"checkalloc checks the current database. It always uses the optimized report option (see MOREINFO="NONE"tablealloc below).REMAP="UN--Under"ID="IN4316228025"Space allocationtable
MOREINFO="NONE"checkalloc ID="IN4310188426"fix optiondbcc tablealloc
reports on the amount of space allocated and used. The default mode for MOREINFO="NONE"checkalloc is MOREINFO="NONE"nofix. You must put the database into single-user mode in order to use the MOREINFO="NONE"fix option.REMAP="UN--Under"For a discussion of page allocation in SQL Server, see BOOK="sag" LINKEND="X57130"Chapter 11,  "Diagnosing System Problems,"
 in the System Administration Guide. ID="IN4323148827"tablealloc option, dbcc
MOREINFO="NONE"tablealloc -ID="IN4311129028"Table pagesallocation with dbcc tablealloc;Space allocation:pages
ID="IN4311109229"Table pagesallocation with dbcc tablealloc
 checks the specified table to see that all pages are correctly allocated, and that no page is allocated that is not used. This is a smaller version of MOREINFO="NONE"checkalloc, providing the same integrity checks on an individual table. It can be used with the table name or the table's object id (the id column from sysobjects).For an example of MOREINFO="NONE"tablealloc output, see BOOK="sag" LINKEND="X57130"Chapter 11,  "Diagnosing System Problems"
 in the System Administration Guide.ID="IN43789430"Reportstypes of dbcc
ID="IN431769631"Allocation reportdbcc tableallocREMAP="UN--Under"There are three types of reports that can be generated with MOREINFO="NONE"tableallocID="IN4311210032"full optiondbcc tablealloc
: MOREINFO="NONE"fullID="IN4316-210433"optimized reportdbcc tablealloc
, MOREINFO="NONE"optimizedID="IN4311-610834"fast optiondbcc tablealloc
, and MOREINFO="NONE"fast. The MOREINFO="NONE"full option is
equivalent to MOREINFO="NONE"checkalloc at a table level; it reports all types of allocation errorsMOREINFO="NONE". The MOREINFO="NONE"optimizedID="IN4327-610835"Object Allocation Map (OAM)Object Allocation Maps ofID="IN4347-911136"Allocation map. See Object Allocation Map (OAM)ID="IN437-911137"ExtentsextentsID="IN4312-911138"Pages (data)not allocated in the extent option produces a report based on the allocation pages listed in the object allocation map (OAM) pages for the table. It does not report and cannot fix unreferenced extents on allocation pages not listed in the OAM pages. The MOREINFO="NONE"optimized option is the default if no type is indicated, or if you use MOREINFO="NONE"null.The MOREINFO="NONE"fastID="IN4333-1111339"Exception report, dbcc tablealloc
 option does not produce an allocation report but does produce an exception report of pages that are referenced but not allocated in the extent (2521 errors).ID="IN4310-1511740"fix optiondbcc tablealloc
MOREINFO="NONE"fix | MOREINFO="NONE"nofix - determines whether or not MOREINFO="NONE"tableallocID="IN436-1511741"Errorsallocation
ID="IN4313-1511742"System tablesfixing allocation errors found in
 fixes the allocation errors found in the table. The default is MOREINFO="NONE"fix for all tables except system tablesMOREINFO="NONE", for which the default isMOREINFO="NONE" nofix. To use the MOREINFO="NONE"fixID="IN4313-1511743"System tablesrebuilding of;Rebuilding:system tables
 option with system tables, you must first put the database into single user mode.You can specify MOREINFO="NONE"fix or MOREINFO="NONE"nofix only if you include a value for the type of report (MOREINFO="NONE"full, MOREINFO="NONE"optimized, MOREINFO="NONE"fast, or MOREINFO="NONE"null).ID="IN438-1711944"Segmentsdbcc indexalloc report on
ID="IN437-1912145"Indexesdbcc indexalloc and
ID="IN4323-2312546"indexalloc option, dbcc
MOREINFO="NONE"indexalloc ID="IN437-2312547"Indexespage allocation check
- checks the specified index to see that all pages are correctly allocated, and that no page is allocated that is not used. This is a smaller version of MOREINFO="NONE"checkalloc, providing the same integrity checks on an individual index. It can be used with the table name or the table's object id (the id column from sysobjects) plus the index's indid from sysindexes.REMAP="UN--Under"ID="IN4317-2512748"Allocation reportdbcc indexalloc
MOREINFO="NONE"indexalloc produces the same three types of reports as MOREINFO="NONE"tableallocID="IN4311-2913149"full optiondbcc indexalloc
: MOREINFO="NONE"full, ID="IN4316-3313550"optimized reportdbcc indexalloc
MOREINFO="NONE"optimizedID="IN4311-3713951"fast optiondbcc indexalloc
, and MOREINFO="NONE"fast (see preceding paragraphs on MOREINFO="NONE"tablealloc). The ID="IN4310-4114352"fix optiondbcc indexalloc
MOREINFO="NONE"fix|nofix option functions the same with MOREINFO="NONE"indexalloc as with MOREINFO="NONE"tablealloc.You can specify MOREINFO="NONE"fix or MOREINFO="NONE"nofix only if you include a value for the type of report (MOREINFO="NONE"full, MOREINFO="NONE"optimized, MOREINFO="NONE"fast, or MOREINFO="NONE"null).ID="IN4325-4514753"checkcatalog option, dbcc
MOREINFO="NONE"checkcatalogID="IN4313-4714954"System tablesdbcc checkcatalog and
 - checks for consistency in and between system tables. For example, it makes sure that every type in syscolumns has a matching entry in systypes, that every table and view in sysobjectsID="IN4316-4915155"syscolumns table
 has at least one column in syscolumns, and that the last checkpoint in syslogs is valid. MOREINFO="NONE"checkcatalog also reports on any segments that have been defined. If no database name is given, MOREINFO="NONE"checkcatalog checks the current database. ID="IN4328-4915156"Repairing a damaged database
ID="IN4340-4915157"Damaged database, removing and repairingremoving and repairing damaged
ID="IN4321-5315558"dbrepair option, dbcc
MOREINFO="NONE"dbrepair (MOREINFO="NONE"database_name, MOREINFO="NONE"dropdbID="IN438-5515759"Droppingdamaged database;Dropping:dbcc dbrepair database
ID="IN4321-5715960"drop database commanddamaged databases and
) - drops a damaged database. The MOREINFO="NONE"drop database command does not work on a damaged database. REMAP="UN--Under"Users cannot be using the database being dropped when this MOREINFO="NONE"dbcc statement is issued (including the user issuing the statement).ID="IN4341-6416661"Suspect indexes. See reindex option, dbcc
ID="IN4341-7017262"Corrupt indexes. See reindex option, dbcc
ID="IN437-7317563"Indexesreindex integrity check
ID="IN4320-7818064"reindex option, dbcc
MOREINFO="NONE"reindex - checks the integrity of indexes on user tables by running a "fast" version of MOREINFO="NONE"dbcc checktable. It can be used with either a table's name or id (object ID) from sysobjectsID="IN438-7818065"Droppingcorrupt indexes
ID="IN4310-7818066"Rebuildingindexes;Recreating:indexes
ID="IN4310-8018267"Sort orderreindex check after change
. The function prints a message when it discovers the first index-related error, then drops and recreates the suspect indexes. It must be run by the System Administrator or table owner after SQL Server's sort order is changed and indexes are marked suspect by SQL Server. REMAP="UN--Under"Here's an example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"dbcc reindex(titles) REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"One or more indexes are corrupt. They will be     rebuilt. REMAP="UN--Under"In the above example, MOREINFO="NONE"dbcc reindex has discovered one or more corrupt indexes in the table titles. The MOREINFO="NONE"dbcc utility next drops and recreates the appropriate indexes. If the indexes for a table are already correct, or if there are no indexes for the table, MOREINFO="NONE"dbcc reindex does not rebuild the index. It prints an informational message instead. The command is also aborted if a table is suspected of containing corrupt data. If that happens, an error message appears instructing the user to run MOREINFO="NONE"dbcc checktable. MOREINFO="NONE"dbcc reindexID="IN437-8318568"Indexesreindex integrity check
 does not allow re-indexing of system tables. System indexes are checked and rebuilt, if necessary, as an automatic part of recovery after SQL Server is restarted following a sort order change. ID="IN4320-8819069"reindex option, dbccID="IN4321-9219470"fix_text option, dbcc
MOREINFO="NONE"fix_textID="IN4314-9419671"Character setsfix_text upgrade after change in
 - upgrades textID="IN4314-9820072"Character setsfix_text upgrade after change in;Multibyte character sets:fix_text upgrade for
 values after a SQL Server's character set has been changed from any character set to a new multibyte character set. ID="IN4312-9820073"Pages (data)multibyte characters andREMAP="UN--Under"Changing to a multibyte character set makes the internal management of text data more complicated. Since a text value can be large enough to cover several pages, SQL Server must be able to handle characters that span page boundaries. To do so, the server requires additional information on each of the text pages. The System Administrator or table owner must run MOREINFO="NONE"dbcc fix_text on each table that has text data to calculate the new values needed. See the System Administration Guide for more information. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"dbcc checktable(titleauthor)dbcc checkalloc(pubs2)dbcc tablealloc(publishers, null, nofix)REMAP="UN--Under"SQL Server returns an optimized report of allocation for this table but does not fix any allocation errors it finds.dbcc indexalloc ("pubs..titleauthor", 2, full)REMAP="UN--Under"SQL Server returns a full report of allocation for the index audidind with an indid of 2 on the titleauthor table and fixes any allocation errors it finds.dbcc dbrepair(pubs2, dropdb) dbcc reindex(titles) dbcc fix_text(texttest)CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"dbcc (Database Consistency Checker) can be run while the database is active, except for the MOREINFO="NONE"dbrepair(database_name, MOREINFO="NONE"dropdb) option and MOREINFO="NONE"dbcc checkalloc with the MOREINFO="NONE"fix option.MOREINFO="NONE"dbcc locks database objects as it checks them. See the MOREINFO="NONE"dbcc discussion in the System Administration Guide for information on minimizing performance problems while using MOREINFO="NONE"dbcc.To qualify a table or index name with a user name and/or the database name, enclose the qualified name in single or double quotation marks. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"dbcc tablealloc("pubs2.pogo.testtable")MOREINFO="NONE"dbcc reindex cannot be run within a user-defined transaction. ID="IN4314-10020278"Error handlingdbcc and;Log device:space allocation
MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text can generate a large number of log records, and it is possible for the log to fill up while running the utility. The utility is designed so that updates are done in a series of small transactions: in case of a log space failure, only a small amount of work is lost. If you run out of log space, clear out your log and restart MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text using the same table being upgraded when the original MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text failed. ID="IN4321-10420679"fix_text option, dbcc
ID="IN4324-10620880"Multibyte character setsfix_text upgrade forIf you attempt to use MOREINFO="NONE"select, MOREINFO="NONE"readtext, or MOREINFO="NONE"writetext on text values after changing to a multibyte character set and have not run MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text, the command fails and an error message is generated instructing you to run MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text on the table. However, you can delete text rows after changing character sets without running MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text.ID="IN437-10921181"ResultsResultsSee also Output!see also Output
ID="IN436-11121382"Outputdbcc messages or errors
MOREINFO="NONE"dbcc output is sent as messages and/or errors, rather than as result rows. Client programs and scripts should check the appropriate error handlers. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"Only the table owner can execute MOREINFO="NONE"dbcc with the MOREINFO="NONE"checktable, MOREINFO="NONE"fix_text, and MOREINFO="NONE"reindex options. Only the Database Owner can use the MOREINFO="NONE"checkdb, MOREINFO="NONE"checkalloc, MOREINFO="NONE"checkcatalog, MOREINFO="NONE"dbrepair, MOREINFO="NONE"indexalloc, and MOREINFO="NONE"tablealloc options. See AlsoCommands     LINKEND="X72692"drop database
MOREINFO="NONE", LINKEND="X18140"reconfigureSystem procedures     LINKEND="X60334"sp_configure
MOREINFO="NONE", LINKEND="X90458"sp_helpdb
ID="IN4335-11521787"dbcc (Database Consistency Checker)
ID="IN4325-11922188"deallocate cursor commandID="X15455"deallocate cursorID="IN4420-11922290"Deallocating cursors
ID="IN446-12122491"Memoryieleasing with deallocate cursor
ID="IN447-12122492"Cursorsdeallocating
Makes a cursor inaccessible and releases all memory resources committed to that cursor.FORMAT="LINESPECIFIC"deallocate cursor cursor_nameParametersREMAP="RI--RefIndent"cursor_name - is the name of the cursor to deallocate.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"deallocate cursor authors_crsrREMAP="BO--Body"Deallocates the cursor named authors_crsr.CommentsMARK="BULL" REMAP="BU--Bullet"SQL Server returns an error message if the cursor does not exist.You must deallocate a cursor before you can use its cursor name as part of another MOREINFO="NONE"declare cursor statement.MOREINFO="NONE"deallocate cursor has no effect on memory resource usage when specified in a stored procedure or trigger.You can MOREINFO="NONE"deallocate a cursor whether it is open or closed.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X78688"close
MOREINFO="NONE", LINKEND="X11816"declare cursor
ID="IN4425-125228100"deallocate cursor commandTopics     LINKEND="X80039"Cursors
ID="IN4415-129232101"declare command
ID="IN4415-131234102"Local variablesdeclare (name and datatype)ID="X40303"declareID="IN459-132236104"Variableslocal
Declares the name and type of local variables for a batch or procedure. Local variables are assigned values with a MOREINFO="NONE"select statement. FORMAT="LINESPECIFIC"REMAP="BO--Body"Variable declaration: FORMAT="LINESPECIFIC"declare MOREINFO="NONE"@variable_name MOREINFO="NONE"datatype [, MOREINFO="NONE"@variable_name MOREINFO="NONE"datatype]... REMAP="BO--Body"Variable assignment: ID="IN4516-134238106"select statementvariables andFORMAT="LINESPECIFIC"select MOREINFO="NONE"@variable = {MOREINFO="NONE"expression | MOREINFO="NONE"select_statement} [, MOREINFO="NONE"@variable = {MOREINFO="NONE"expression | select_statement} ...][from MOREINFO="NONE"table_list] [where MOREINFO="NONE"search_conditions] [group by MOREINFO="NONE"group_by_list] [having MOREINFO="NONE"search_conditions] [order by MOREINFO="NONE"order_by_list] [compute MOREINFO="NONE"function_list [by MOREINFO="NONE"by_list]]Keywords and OptionsREMAP="RI--RefIndent"ID="IN4513-135239108"@ (at symbol)local variable name;At symbol (@):local variable name
@variable_name - must begin with @ and must conform to the rules for identifiers. ID="IN459-135239109"Datatypeslocal variables and
datatype - can be either a system datatype or a user-defined datatype. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"declare @one varchar(18), @two varchar(18) select @one = "this is one", @two = "this is two" if @one = "this is one"   print "you got one" if @two = "this is two"   print "you got two" else print "nope"declare @veryhigh money select @veryhigh = max(price)   from titles if @veryhigh > $20   print "Ouch!" CommentsMARK="BULL" REMAP="BU--Bullet"The maximum number of parameters in a procedure is 255. The number of local or global variables is limited only by available memory. The "@" sign denotes a variable name. ID="IN4513-136240112"@ (at symbol)local variable name;At symbol (@):local variable nameLocal variables are often used as counters forMOREINFO="NONE" whileID="IN4520-138242113"if...else conditionslocal variables and
 loops or MOREINFO="NONE"if ...else blocks. In stored procedures, they are declared for automatic, non-interactive use by the procedure when it executes. Local variables must be used within the batch or procedure in which they are declared. ID="IN4516-140244114"select statementlocal variables andThe MOREINFO="NONE"select statement that assigns a value to the local variable usually returns a single value. If there is more than one value to return, the variable is assigned the last one. The MOREINFO="NONE"select statement that assigns values to variables cannot be used to retrieve data in the same statement. ID="IN4513-142246115"print commandlocal variables andThe MOREINFO="NONE"printID="IN4517-144248116"raiserror commandlocal variables and
 and MOREINFO="NONE"raiserror commands can take local variables as arguments. Users cannot create global variables, and cannot update the value of global variables directly in a select statement.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X69372"print
MOREINFO="NONE", LINKEND="X60573"raiserror
MOREINFO="NONE", LINKEND="X35229"select
MOREINFO="NONE", LINKEND="X37548"while
ID="IN459-145249120"VariableslocalTopics     LINKEND="X72999"Parameters
, LINKEND="X44102"Variables (Local and Global)
ID="IN4522-149253121"declare cursor commandID="X11816"declare cursorID="IN467-149254123"Cursorsdefining
Defines a cursor.FORMAT="LINESPECIFIC"FORMAT="LINESPECIFIC"declare MOREINFO="NONE"cursor_name cursorFORMAT="LINESPECIFIC"for MOREINFO="NONE"select_statementFORMAT="LINESPECIFIC"[for {read only | update [of
MOREINFO="NONE"column_name_list ]}]ParametersREMAP="RI--RefIndent"cursor_name - is the name of the cursor being defined.select_statement - is the query that defines the cursor result set. See MOREINFO="NONE"select for more information.ID="IN4636-153258126"for read only option, declare cursor
MOREINFO="NONE"for read only - specifies that the cursor result set cannot be updated.ID="IN4633-157262127"for update option, declare cursor
MOREINFO="NONE"for update - specifies that the cursor result set is updatable.ID="IN4625-161266128"of option, declare cursor
MOREINFO="NONE"of column_name_list - is the list of columns from the cursor result set (specified by the select_statement) defined as updatable. SQL Server also allows you to include columns that are not specified in the list of columns of the cursor's select_statement (and excluded from the result set), but that are part of the tables specified in the select_statement. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"declare authors_crsr cursorfor select au_id, au_lname, au_fnamefrom authorswhere state != 'CA'REMAP="UN--Under"Defines a result set for the authors_crsr cursor that contains all authors from the authors table who do not reside in California.declare titles_crsr cursorfor select title, title_id from titleswhere title_id like "BU%"for read onlyREMAP="UN--Under"Defines a read-only result set for the titles_crsr cursor that contains the business-type books from the titles table.declare pubs_crsr cursorfor select pub_name, city, statefrom publishersfor update of city, stateREMAP="UN--Under"Defines an updatable result set for the pubs_crsr cursor that contains all of the rows from the publishers table. It defines the address of each publisher (city and state columns) for update.CommentsRestrictions on CursorsMARK="BULL" REMAP="BU--Bullet"A MOREINFO="NONE"declare cursor statement must precede any MOREINFO="NONE"open statement for that cursor. You cannot include other statements with MOREINFO="NONE"declare cursor in the same Transact-SQL batch.ID="IN466-161266131"Namingcursors
cursor_name must be a valid SQL Server identifier name (not longer than 30 characters and must start with a letter or the symbols # or _).MOREINFO="NONE"select StatementMARK="BULL" REMAP="BU--Bullet"select_statement may use the full syntax and semantics of a Transact-SQL MOREINFO="NONE"select statement, with these restrictions:MARK="DASH" REMAP="BS--BulletSub"select_statement must contain a MOREINFO="NONE"from clause.select_statement cannot contain a MOREINFO="NONE"compute, MOREINFO="NONE"for browse, or MOREINFO="NONE"into clause.select_statement can contain the MOREINFO="NONE"holdlock keyword.The select_statement can contain references to Transact-SQL parameter names or Transact-SQL local variables (for all cursor types except language- see LINKEND="X80039""Cursors"
 in LINKEND="X56620"Chapter 3,  "Transact-SQL Topics"
 for information about cursor types). The names must reference Transact-SQL parameters and local variables defined in the procedure, trigger, or statement batch that contains the MOREINFO="NONE"declare cursor statement.REMAP="UN--Under"The parameters and/or local variables referenced in the MOREINFO="NONE"declare cursor statement do not have to contain valid values until the cursor is opened.The select_statement can contain references to the inserted and deleted temporary tables that are used in triggers.ScopeID="IN4616-161266132"Scope of cursorsscopeMARK="BULL" REMAP="BU--Bullet"A cursor is defined by its scope. Scope determines the region where the cursor is known. Once a cursor's scope no longer exists, its cursor name also no longer exists. SQL Server divides the scope of a cursor into the following regions:MARK="DASH" REMAP="BS--BulletSub"session - this region starts when a client logs onto SQL Server and ends when it logs off. This region precludes any regions defined by stored procedures or triggers.stored procedure - this region starts when a stored procedure begins execution and ends when it completes execution. If a stored procedure calls another stored procedure, SQL Server starts a new region and treats it as a subregion of the first procedure.trigger - this region starts when a stored procedure begins execution and ends when it completes execution.A cursor name must be unique within a given scope. Scopes are distinct in that a cursor name defined in one region can also be defined in another or within its own subregion. However, you cannot access a cursor defined in one region from another region. SQL Server does allow access to a cursor in subregions if no other cursor with that same name exists in the subregion.REMAP="UN--Under"Name conflicts within a particular scope are detected by SQL Server only during runtime. For example, the following stored procedure works correctly because only one names_crsr cursor is defined in its scope:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create procedure proc1 as    declare @flag int    if (@flag)        declare names_crsr cursor        for select au_fname from authors    else        declare names_crsr cursor        for select au_lname from authorsID="IN4617-161266133"Cursor result setcursorsResult SetMARK="BULL" REMAP="BU--Bullet"Cursor result set rows may not reflect the values in the actual base table rows. For example, a cursor declared with an MOREINFO="NONE"order by clause usually requires the creation of an internal table to order the rows for the cursor result set. SQL Server does not lock the rows in the base table that correspond to the rows in the internal table, which permits other clients to update these base table rows. In that case, the rows returned to the client from the cursor result set would not be in sync with the base table rows.ID="IN467-161266134"Cursorscursor scans;Scans, cursorA cursor result set is generated as the rows are returned through a MOREINFO="NONE"fetch of that cursor. This means that a cursor MOREINFO="NONE"select query is processed like a normal MOREINFO="NONE"select query. This process, known as a cursor scan, provides a faster turnaround time and eliminates the need to read rows the application does not require. REMAP="UN--Under"A restriction of cursor scans is that they can only use the unique indexes of a table. However, if none of the base tables referenced by the cursor result set are updated by another process in the same lock space as that cursor, the restriction is unnecessary. SQL Server allows the declaration of cursors on tables without unique indexes, but any attempt to update these tables in the same lock space will close all cursors on such tables.ID="IN467-161266135"Cursorsupdatable;Updatable cursors
UpdatabilityID="IN467-161266136"Cursorsread-only;Read-only cursorsMARK="BULL" REMAP="BU--Bullet"After defining a cursor using MOREINFO="NONE"declare cursor, SQL Server determines if it is updatable or read-only. Updatable cursors implies that you can update or delete rows within the cursor result set. You cannot change the result set of read-only cursors. Use the MOREINFO="NONE"for update or MOREINFO="NONE"for read only clauses to explicitly define the cursor as updatable or read-only. However, you cannot define an updatable cursor if its select_statement contains one of the following constructs:MARK="DASH" REMAP="BS--BulletSub"MOREINFO="NONE"distinct optionMOREINFO="NONE"group by clauseAggregate functionsMOREINFO="NONE"union operatorREMAP="UN--Under"If you omit either the MOREINFO="NONE"for update or MOREINFO="NONE"read only clause, SQL Server checks whether the cursor is updatable.REMAP="UN--Under"SQL Server also defines a cursor as read-only if you declare a Language or Server type cursor that includes an MOREINFO="NONE"order by clause as part of its select_statement. SQL Server handles updates differently for Client or Executable type cursors, thereby eliminating this restriction.If you do not specify a column_name_list with the MOREINFO="NONE"for update clause, all the specified columns in the query are updatable. SQL Server attempts to use unique indexes for updatable cursors when scanning the base table. For cursors, SQL Server considers an index containing an IDENTITY column to be unique, even if it is not declared so. REMAP="UN--Under"If you do not specify the MOREINFO="NONE"for update clause, SQL Server chooses any unique index, although it can also use other indexes or table scans if no unique index exists for the specified table columns. However, when you specify the MOREINFO="NONE"for update clause, SQL Server must use a unique index defined for one or more of the columns to scan the base table. If none exists, it returns an error.ID="IN4617-161266137"Halloween problemHalloween problem
Any columns of the base table you specify in the column_name_list of MOREINFO="NONE"for update should include only those columns you need to update, and not any columns included in at least one unique index. This allows SQL Server to use that unique index for its cursor scan which helps prevent an update anomaly called the Halloween Problem.REMAP="UN--Under"This problem occurs when a client updates a column of a cursor result set row which defines the order in which the rows are returned from the base tables. For example, if SQL Server accesses a base table using an index and the index key is updated by the client, the updated index row can move within the index and be read again by the cursor. This is a result of an updatable cursor only logically creating a cursor result set. The cursor result set is actually the base tables that derive the cursor.If you specify the MOREINFO="NONE"read only option, the cursor result set may not be updated using the MOREINFO="NONE"delete or MOREINFO="NONE"update statement.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantEntry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0" TheMOREINFO="NONE" for update and MOREINFO="NONE"for read only 
options are Transact-SQL 
extensions.See AlsoCommands      LINKEND="X29776"openTopics     LINKEND="X80039"Cursors
ID="IN4614-165270141"delete commandID="X45593"deleteID="IN478-166272143"Droppingrows from a table
ID="IN478-169275144"DeletingDeletingSee also Dropping!see also Dropping
ID="IN4722-172278145"Removing. See Dropping
Removes rows from a table. FORMAT="LINESPECIFIC"delete [from] [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name|MOREINFO="NONE"view_name}[where MOREINFO="NONE"search_conditions] FORMAT="LINESPECIFIC"delete [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name | MOREINFO="NONE"view_name} [from [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name | MOREINFO="NONE"view_name}  [, [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name |MOREINFO="NONE" view_name}]...] [where MOREINFO="NONE"search_conditions] FORMAT="LINESPECIFIC"delete [from] [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name|MOREINFO="NONE"view_name}where current of cursor_name Keywords and OptionsREMAP="RI--RefIndent"ID="IN4712-176282148"from keyworddelete
MOREINFO="NONE"from - (after MOREINFO="NONE"delete) is an optional keyword used for compatibility with other versions of SQL. Follow it with the name of the table or view from which you want to remove rows. MOREINFO="NONE"from - (after table_name or view_name) lets you name more than one table or view to use with a MOREINFO="NONE"where clause when specifying which rows to delete. This MOREINFO="NONE"fromID="IN4716-178284149"select statementembedded
 clause allows you to delete rows from one table based on data stored in other tables, giving you much of the power of an embedded MOREINFO="NONE"select statement. ID="IN4712-182288150"where clausedelete
MOREINFO="NONE"where - is a standard MOREINFO="NONE"where clause. See LINKEND="X30827""where Clause"
 for more information.ID="IN4723-186292151"where current of clausedelete
MOREINFO="NONE"where current of cursor_name - causes SQL Server to delete the row of the table or view indicated by the current cursor position for cursor_name.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"delete authors REMAP="UN--Under"Deletes all rows from the authors table. delete from authors where au_lname = "McBadden" REMAP="UN--Under"Deletes a row or rows from the authors table. delete titles from titles, authors, titleauthor where authors.au_lname = 'Bennet'   and authors.au_id = titleauthor.au_id   and titleauthor.title_id = titles.title_id REMAP="UN--Under"Deletes rows for books written by Bennet from the titles table. (The pubs2 database includes a trigger (deltitle) which prevents the deletion of titles which are recorded in the sales table; you must drop this trigger for this example to work.) delete titles where current of title_crsrREMAP="UN--Under"Deletes a row from the titles table currently indicated by the cursor title_crsr.delete authorswhere syb_identity = 4REMAP="UN--Under"Determines which row has a value of 4 for the IDENTITY column and deletes it from the authors table. Note the use of the MOREINFO="NONE"syb_identity keyword instead of the actual name of the IDENTITY column.CommentsRestrictionsID="IN4717-188294154"Multi-table viewsdelete andMARK="BULL" REMAP="BU--Bullet"You cannot use MOREINFO="NONE"delete with a multi-table view (one whose MOREINFO="NONE"from clause names more than one table) even though you may be able to use MOREINFO="NONE"update or MOREINFO="NONE"insert on that same view. When you delete a row through a view you change multiple tables, which is not permitted. MOREINFO="NONE"insert and MOREINFO="NONE"update statements that affect only one base table of the view are permitted. ID="IN4722-192298155"truncate table commandfaster than delete command
SQL Server treats two different designations for the same table in a MOREINFO="NONE"delete as two tables. For example, the following MOREINFO="NONE"delete issued in pubs2 specifies discounts as two tables (discounts and pubs2..discounts):REMAP="UI--UserInput" FORMAT="LINESPECIFIC"delete discountsfrom pubs2..discounts, pubs2..storeswhere pubs2..discounts.stor_id =    pubs2..stores.stor_idREMAP="UN--Under"In this case, the join does not include discounts, so the MOREINFO="NONE"where condition remains true for every row; SQL Server deletes all rows in discounts (which is not the desired result). To avoid this problem, use the same designation for a table throughout the statement.Deleting All Rows from a TableMARK="BULL" REMAP="BU--Bullet"If you don't use a MOREINFO="NONE"where clause, all rows in the table named after MOREINFO="NONE"delete [MOREINFO="NONE"from] are removed. The table, though empty of data, continues to exist until you issue a MOREINFO="NONE"drop table command. MOREINFO="NONE"truncate MOREINFO="NONE"table and MOREINFO="NONE"delete without a row specification are functionally equivalent, but MOREINFO="NONE"truncate MOREINFO="NONE"table is faster. MOREINFO="NONE"deleteID="IN4716-192298156"Transaction logsTransaction logsof deleted rowsdeleted rows
 removes rows one at a time and logs these transactions; MOREINFO="NONE"truncate MOREINFO="NONE"table removes whole data pages, and the rows are not logged. REMAP="UN--Under"Both MOREINFO="NONE"delete and MOREINFO="NONE"truncate MOREINFO="NONE"table reclaim the space occupied by the data and its associated indexes. MOREINFO="NONE"delete and TransactionsID="IN4724-194300157"Chained transaction modedelete andMARK="BULL" REMAP="BU--Bullet"When you set chained transaction mode, SQL Server implicitly begins a transaction with the MOREINFO="NONE"delete statement if no transaction is currently active. To complete any deletes, you must MOREINFO="NONE"commit the transaction, or you can MOREINFO="NONE"rollback the changes. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"delete from sales where date < '01/01/89'if exists (select stor_id    from stores    where stor_id not in     (select stor_id from sales))        rollback transactionelse        commit transactionREMAP="UN--Under"This batch begins a transaction (using the chained transaction mode) and deletes from the sales table those rows with dates earlier than Jan. 1, 1989. If it deletes all sales entries associated with a store, it rolls back all the changes to sales and ends the transaction. Otherwise, it commits the deletions and ends the transaction. For more information about the chained mode, see LINKEND="X19352""Transactions"
.Delete TriggersID="IN478-196302158"Triggersdelete andMARK="BULL" REMAP="BU--Bullet"You can define a trigger that will take a specified action when a MOREINFO="NONE"delete command is issued on a specified table. Using MOREINFO="NONE"delete where current of ID="IN477-196302159"Cursorsdeleting rowsMARK="BULL" REMAP="BU--Bullet"Use the clause MOREINFO="NONE"where current of with cursors. Before deleting rows using the clause MOREINFO="NONE"where current of, you must first define the cursor with MOREINFO="NONE"declare cursor and open it using the MOREINFO="NONE"open statement. Position the cursor on the row you want to delete using one or more MOREINFO="NONE"fetch statements. The cursor name cannot be a Transact-SQL parameter or local variable. The cursor must be an updatable cursor or SQL Server returns an error. Any deletion to the cursor result set also affects the base table row which the cursor row is derived from. You can delete only one row at a time using the cursor.You cannot delete rows in a cursor result set if the cursor's MOREINFO="NONE"select statement contains a join clause even though the cursor is considered updatable. The table_name or view_name specified with a MOREINFO="NONE"delete...MOREINFO="NONE"where current of must be the table or view specified in the first MOREINFO="NONE"from clause of the MOREINFO="NONE"select statement that defines the cursor. After the deletion of a row from the cursor's result set, the position of the cursor points before the next row in the cursor's result set. You must still use MOREINFO="NONE"fetch to access the next row. If the deleted row is the last row of the cursor result set, the cursor points after the last row of the result set. The following describes the position and behavior of open cursors affected by a MOREINFO="NONE"delete:MARK="DASH" REMAP="BS--BulletSub"If a client deletes a row (using another cursor or a regular MOREINFO="NONE"delete) and that row represents the current cursor position of other opened cursors owned by the same client, the position of each affected cursor is implicitly set to before the next available row. However, it is not possible for one client to delete a row representing the current cursor position of another client's cursor.If a client deletes a row which represents the current cursor position of another cursor defined by a join operation and owned by the same client, SQL Server still accepts the MOREINFO="NONE"delete statement. However, it implicitly closes the cursor defined by the join.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliant Entry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The use of more than one table in 
the MOREINFO="NONE"from clause and qualification of 
table name with database name are 
Transact-SQL extensions.PermissionsREMAP="BO--Body"MOREINFO="NONE"delete permission defaults to the table or view owner, who can transfer it to other users. REMAP="BO--Body"If you have MOREINFO="NONE"set ansi_permissions MOREINFO="NONE"on, you must have MOREINFO="NONE"select permission on all columns appearing in the MOREINFO="NONE"where clause, in addition to the regular permissions required for MOREINFO="NONE"delete statements. (By default,MOREINFO="NONE" ansi_permissions is MOREINFO="NONE"off.)See AlsoCommands     LINKEND="X19955"create trigger
MOREINFO="NONE", LINKEND="X58548"drop table
MOREINFO="NONE", LINKEND="X48835"drop trigger
MOREINFO="NONE", LINKEND="X16531"truncate table
MOREINFO="NONE", LINKEND="X30827"where Clause
ID="IN4714-200306164"delete command
ID="IN478-201307165"Droppingrows from a tableTopics     LINKEND="X80039"Cursors
, LINKEND="X19352"TransactionsREMAP="BO--Body"ID="X64061"disk init
Makes a physical device or file usable by SQL Server. (The master device is initialized by the MOREINFO="NONE"sybinit installation program; it is not necessary to initialize this device with MOREINFO="NONE"disk initID="IN431989134"disk reinit commanddisk reinit commandSee also disk init command!see also
ID="IN433986165"Device initialization. See Initializing
.) FORMAT="LINESPECIFIC"disk init name = "MOREINFO="NONE"device_name" , physname = "MOREINFO="NONE"physicalname" , vdevno = MOREINFO="NONE"virtual_device_number , size = MOREINFO="NONE"number_of_blocks [, vstart = MOREINFO="NONE"virtual_address , cntrltype = MOREINFO="NONE"controller_number ] [, contiguous] (OpenVMS only) Keywords and OptionsREMAP="RI--RefIndent"ID="IN431182209"name optiondisk init
ID="IN436822010"Namingdatabase device;Naming:file
MOREINFO="NONE"name - is the name of the database device or file. The name must conform to the rules for identifiers, and be enclosed in single or double quotes. This name is used in the MOREINFO="NONE"create database and MOREINFO="NONE"alter database commands. ID="IN4315782411"physname optiondisk init
MOREINFO="NONE"physname - is the full specification of the database device. This name must be enclosed in single or double quotes. ID="IN4313742812"vdevno optiondisk init
ID="IN437742813"Numbersvirtual device;Virtual device number;Devices:numbering
MOREINFO="NONE"vdevno - is the virtual device number. It must be unique among database devices associated with SQL Server. The device number 0 is reserved for the master device. Legal numbers are between 1 and 255, but the highest number must be one less than the number of database devices for which your SQL Server is configured. For example, for a SQL Server with the default configuration of 10 devices, the legal device numbers are 1 through 9. To see the maximum number of devices available on your SQL Server, run MOREINFO="NONE"sp_configure, and check the MOREINFO="NONE"devices value.REMAP="UN--Under"To determine the virtual device number, look at the device_number column of the MOREINFO="NONE"sp_helpdevice report, and use the next unused integer. REMAP="UN--Under"If you drop a device with MOREINFO="NONE"sp_dropdevice, you cannot re-use its MOREINFO="NONE"vdevno until the server is re-booted.ID="IN4311703214"size optiondisk init
MOREINFO="NONE"size - is the size of the database device in 2K blocks. REMAP="UN--Under"ID="IN434683415"Sizemodel database;Size:database device
If you are planning to use the new device for the creation of a new database, the minimum MOREINFO="NONE"size is the size of the modelID="IN4323683416"Blocks, database device
ID="IN434683417"Sizelog device;Log device:space allocation
 database, 1024 2K blocks (2 Mb). If you are initializing a log device, the MOREINFO="NONE"size can be as small as 512 2K blocks (1 megabyte). ID="IN4313643818"vstart optiondisk init
MOREINFO="NONE"vstart - is the starting virtual address, or the starting offset in 2K blocks. The value for MOREINFO="NONE"vstart should be 0 (the default). Reset MOREINFO="NONE"vstart only if instructed to do so. ID="IN4316604219"cntrltype optiondisk init
MOREINFO="NONE"cntrltype ID="IN4316604220"Disk controllers
- specifies the disk controller. Its default value is zero. Reset MOREINFO="NONE"cntrltype only if instructed to do so. ID="IN4327564621"contiguous option (OpenVMS)disk init
MOREINFO="NONE"contiguousID="IN435564622"Filescontiguous (OpenVMS)
 - forces contiguous database file creation (OpenVMS only). This option is meaningful only if the mirror is a file rather than a foreign device. If you include the MOREINFO="NONE"contiguous option, the system creates a contiguous file or the command fails with an error message. If you do not include the MOREINFO="NONE"contiguous option, the system still tries to create a contiguous file. If it fails to create the file contiguously, the system creates a file that does not force contiguity. In either case, the system prints a message indicating the type of file that is created.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"disk init   name = "user_disk",   physname = "/dev/rxy1a",   vdevno = 2, size = 5120 REMAP="UN--Under"Initializes a disk on a UNIX system.disk init name = "user_disk", physname = "disk$rose_1:[dbs]user.dbs", vdevno = 2, size = 5120, contiguousREMAP="UN--Under"Initializes a disk on a OpenVMS system, forcing the database file to be created contiguously.CommentsMARK="BULL" REMAP="BU--Bullet"Use MOREINFO="NONE"disk init for each new database device. Each time MOREINFO="NONE"disk initID="IN4316525025"sysdevices tabledisk init and
 is issued, a row is added to master..sysdevices. A new database device does not automatically become part of the pool of default database storage. Assign default status to a database device with the system procedure MOREINFO="NONE"sp_diskdefault. ID="IN439525026"Path namehard-coded or logical device
ID="IN4315475527"physname optiondisk init, in OpenVMSOn OpenVMS systems, using a logical name to refer to the MOREINFO="NONE"physname offers more flexibility than using a hard-coded path name. For example, if you define the logical name "userdisk" as:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"disk$rose_1:[dbs]user.dbsREMAP="UN--Under"you can change the MOREINFO="NONE"physname in the OpenVMS example above to "MOREINFO="NONE"userdisk". If you decide to reorganize your disk or to move "MOREINFO="NONE"user.dbs", all you need to do is redefine the logical name as the new path.REMAP="UN--Under"Any logical name used by a particular SQL Server must be:MARK="DASH" REMAP="BS--BulletSub"A system logical name, or ID="IN4315426028"physname optiondisk init, in OpenVMSA process logical name defined in the runserver file for that SQL Server.ID="IN4327386429"Recovery of master databaseafter using disk init
ID="IN4317346830"disk init commandmaster database backup afterBack up the ID="IN4315307231"master databasebackup after disk init
master database with the ID="IN4321267632"dump database commandafter using disk init
MOREINFO="NONE"dump databaseID="IN4324228033"dump transaction commandafter using disk init
 or MOREINFO="NONE"dump transaction command after each use of MOREINFO="NONE"disk init. This makes recovery easier and safer in case master is damaged. (If you add a device with MOREINFO="NONE"disk init and fail to back up masterID="IN4312208234"Initializingdisk reinit and
, you may be able to recover the changes by using MOREINFO="NONE"disk reinit and then stopping and restarting SQL Server.) User databases are assigned to database devices with the optional clause:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"on device_name REMAP="UN--Under"of the MOREINFO="NONE"create database or MOREINFO="NONE"alter database command. ID="IN4316208235"Transaction logsTransaction logson a separate deviceseparate device
ID="IN439208236"MigrationMigrationof system log to another devicesystem log to another device
ID="IN4323168637"create database commanddisk init andThe preferred method for placing a database's transaction log (that is, the system table syslogs) on a different device than the one on which the rest of the database is stored, is the MOREINFO="NONE"log MOREINFO="NONE"on extension to MOREINFO="NONE"create database. Alternatively, you can name at least two devices when you create the database, and then execute the system procedure MOREINFO="NONE"sp_logdevice. You can also MOREINFO="NONE"alter database to a second device and then run MOREINFO="NONE"sp_logdevice. The MOREINFO="NONE"log on extension immediately moves the entire log to a separate device; the MOREINFO="NONE"sp_logdevice method retains part of the system log on the original database device, until transaction activity causes the migration to become complete. For a report on all SQL Server devices on your system (both database and dump devices), execute the system procedure MOREINFO="NONE"sp_helpdevice. Remove a database device with the system procedure MOREINFO="NONE"sp_dropdevice. You must first drop all existing databases on that device. REMAP="UN--Under"After dropping a database device, you can create a new one with the same name (using MOREINFO="NONE"disk initID="IN437168638"Numbersvirtual device;Virtual device number
) as long as you give it a different physical name and virtual device number. If you wish to use the same physical name and virtual device number, you must restart SQL Server.ID="IN434168639"Sizeinitialized database device;Size:log device;Size:transaction log deviceIf MOREINFO="NONE"disk init failed because you gave a MOREINFO="NONE"size that was too large for the database device, you should use a different virtual device number, or restart the Server before executing MOREINFO="NONE"disk init again.To successfully complete disk initialization, the "sybase" user must have the appropriate operating system permissions on the device that is being initialized. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"disk init permission defaults to System Administrators, and is not transferable. You must be using the master database to use MOREINFO="NONE"disk init. See AlsoCommands     LINKEND="X61977"alter database
MOREINFO="NONE", LINKEND="X75308"create database
MOREINFO="NONE", LINKEND="X86010"disk refit
MOREINFO="NONE", LINKEND="X47917"disk reinit
MOREINFO="NONE", LINKEND="X68345"dump database
MOREINFO="NONE", LINKEND="X47924"dump transaction
MOREINFO="NONE", LINKEND="X28090"load database
MOREINFO="NONE", LINKEND="X75212"load transactionSystem procedures     LINKEND="X92302"sp_diskdefault
MOREINFO="NONE", LINKEND="X57787"sp_dropdevice
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
MOREINFO="NONE", LINKEND="X21496"sp_logdevice
ID="IN4317129044"disk init command
ID="IN4312119145"Initializingdisk
ID="IN431979546"disk mirror command
ID="IN431449847"Disk mirroringdisk mirroring toID="X27321"disk mirrorID="IN446310049"Addingmirror device
Creates a software mirror that immediately takes over when the primary device fails. You can mirror the master device, devices that store data, and devices that store transaction logs; you cannot mirror dump devices.FORMAT="LINESPECIFIC"disk mirror name = "MOREINFO="NONE"device_name" , mirror = "MOREINFO="NONE"physicalname" [ ,writes = { serial | noserial }] [ ,contiguous ] (OpenVMS onlyMOREINFO="NONE") Keywords and OptionsREMAP="RI--RefIndent"ID="IN4445010353"Process logical name. See Logical device name
ID="IN4444-310654"System logical name. See Logical device name
ID="IN4419-310655"Logical device namedisk mirroring;Name of device:disk mirroring and
MOREINFO="NONE"name - is the name of the database device that you want to mirror. This is recorded in the name column of the sysdevices table. The name must be enclosed in single or double quotes. ID="IN4427-711056"mirror keyword, disk mirror
MOREINFO="NONE"mirrorID="IN449-711057"Path namemirror device
ID="IN4430-711058"I/O devices, disk mirroring to
ID="IN445-711059"Filesmirror device
 - is the full path name of the database mirror device that is to be your secondary device. It must be enclosed in single or double quotes. If the secondary device is a file, physicalname should be a path specification sufficient to identify the file unambiguously. It cannot be an existing file. ID="IN4426-1111460"writes option, disk mirror
MOREINFO="NONE"writesID="IN4426-1912261"serial option, disk mirror
 - allows you to choose whether to enforce serial writes to the devices. In the default case (MOREINFO="NONE"serial), the write to the primary database device is guaranteed to finish before the write to the secondary device begins. If the primary and secondary devices are on different physical devices, serial writes can ensure that at least one of the disks may be unaffected in the event of a power failure. ID="IN4415-2112462"OpenVMS systemscontiguous option on
ID="IN4427-2512863"contiguous option (OpenVMS)disk mirror
MOREINFO="NONE"contiguous - (OpenVMS only) is meaningful only if the mirror is a file rather than a foreign device. This option forces the file that will be used as the secondary device to be created contiguously. If you include the MOREINFO="NONE"contiguous option, the system creates a contiguous file or the command fails with an error message. If you do not include the MOREINFO="NONE"contiguous option, the system still tries to create a contiguous file. If it fails to create the file contiguously, the system creates a file that does not force contiguity. In either case, the system prints a message indicating the type of file that is created. The MOREINFO="NONE"contiguous option is also available with MOREINFO="NONE"disk initID="INA445-2512864"Filescontiguous (OpenVMS)
ID="IN4415-2512865"OpenVMS systemsmirroring options
 for OpenVMS users. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"disk mirror   name = "user_disk",   mirror = "/server/data/mirror.dat" REMAP="UN--Under"Creates a software mirror for the database device user_disk on the file mirror.dat. CommentsMARK="BULL" REMAP="BU--Bullet"Devices are mirrored, not databases. A device and its mirror together constitute one logical device. The physical name of the mirror device goes in the mirrorname column of the sysdevicesID="IN447-2512868"Devicessecondary
 table; it does not require a separate entry in sysdevices and should not be initialized with MOREINFO="NONE"disk init.Mirror all default database devices so that you are still protected if a MOREINFO="NONE"create or MOREINFO="NONE"alter database command affects a database device in the default list. You can mirror or unmirror database devices without shutting down SQL Server. Disk mirroring does not interfere with ongoing activities in the database. ID="IN447-2512869"Backupsdisk mirroring and
ID="IN4415-2913270"master databasebackup after disk mirrorBack up the master database with the MOREINFO="NONE"dump database command after each use of MOREINFO="NONE"disk mirror. This makes recovery easier and safer in case master is damaged. When a read or write to a mirrored device is unsuccessful, SQL Server causes the bad device to become unmirrored, and prints error messages. SQL Server continues to run, unmirrored. The System Administrator must use the MOREINFO="NONE"disk remirror command to restart mirroring.ID="IN4416-2913271"Database devicestransaction logs on separate
ID="IN4413-3113472"syslogs tableput on a separate deviceAlways put user database transaction logs on a separate database device. To put a database's transaction log (that is, the system table syslogs) on a different device than the one on which the rest of the database is stored, name the database device and the log device when you create the database. You could also MOREINFO="NONE"alter database to a second device and then run the system procedure MOREINFO="NONE"sp_logdevice. ID="IN4420-3113473"Separation, physicalSeparation, physicalof transaction log device;Transaction logs:on a separate device[Transaction logs:separate device]transaction log deviceFor greater protection, mirror the database device used for transaction logs. If you mirror the database device for the master database, you can use the MOREINFO="NONE"-r option and the name of the mirror for UNIX, or the MOREINFO="NONE"mastermirrorID="IN4416-3313674"Restarts, Serverusing dataserver utility
ID="IN4426-3714075"dataserver utility commanddisk mirror and
 option for OpenVMS, when you restart SQL Server with the MOREINFO="NONE"dataserver utility program. This option should also be added to the RUN_servername file for that server, so that the ID="IN4427-4114476"startserver utility commanddisk mirror and
MOREINFO="NONE"startserver utility program will know about it. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"dataserver -dmaster.dat -rmirror.datREMAP="UN--Under"starts a master device named master.dat and its mirror, mirror.dat. For more information, see MOREINFO="NONE"dataserver and MOREINFO="NONE"startserver in the SQL Server Utility Programs. If you mirror a database device that has unallocated space (room for additional MOREINFO="NONE"create database and MOREINFO="NONE"alter database statement to allocate part of the device), MOREINFO="NONE"disk mirror begins mirroring these allocations when they are made, not when the MOREINFO="NONE"disk mirror command is issued.For a report on all SQL Server devices on your system (user database devices and their mirrors, as well as dump devices), execute the system procedure MOREINFO="NONE"sp_helpdevice. For more details about disk mirroring in the OpenVMS environment, see the SYBASE SQL Server
 Installation
 Guide for OpenVMS. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"disk mirror permission defaults to the System Administrator, and is not transferable. You must be using the master database to use MOREINFO="NONE"disk mirror. See AlsoCommands     LINKEND="X61977"alter database
MOREINFO="NONE", LINKEND="X75308"create database
MOREINFO="NONE", LINKEND="X64061"disk init
MOREINFO="NONE", LINKEND="X86010"disk refit
MOREINFO="NONE", LINKEND="X47917"disk reinit
MOREINFO="NONE", LINKEND="X49953"disk remirror
MOREINFO="NONE", LINKEND="X45609"disk unmirror
MOREINFO="NONE", LINKEND="X68345"dump database
MOREINFO="NONE", LINKEND="X47924"dump transaction
MOREINFO="NONE", LINKEND="X28090"load database
MOREINFO="NONE", LINKEND="X75212"load transaction
ID="IN4419-4514881"disk mirror command
ID="IN446-4614982"Addingmirror deviceTopics     LINKEND="X82597"Disk MirroringSystem procedures     LINKEND="X92302"sp_diskdefault
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
MOREINFO="NONE", LINKEND="X21496"sp_logdeviceUtility programs     
BOOK="unix" LINKEND="X76998"dataserver
, BOOK="unix" LINKEND="X28711"startserver
ID="IN4418-5015383"disk refit commandID="X86010"disk refitID="IN459-5215685"RestoringRestoringa damaged master databasedamaged master database
Rebuilds the master database's sysusages and sysdatabases system tables from information contained in sysdevices. Use MOREINFO="NONE"disk refit after MOREINFO="NONE"disk reinitID="IN459-5415886"RestoringRestoringa damaged master databasedamaged master database
 as part of the procedure to restore the ID="IN4515-5816287"master databasedisk refit and
master database. FORMAT="LINESPECIFIC"disk refit ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"disk refit CommentsID="IN4516-6016491"Restarts, Serverafter using disk refitMARK="BULL" REMAP="BU--Bullet"Stop and then restart SQL Server after using MOREINFO="NONE"disk refit. For more information, see the SQL Server Installation Guide for your system or the System Administration Guide. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"disk refit permission defaults to System Administrators, and is not transferable. You must be in the master database to use MOREINFO="NONE"disk refit. See AlsoCommands     LINKEND="X64061"disk init
MOREINFO="NONE", LINKEND="X47917"disk reinitSystem procedures     LINKEND="X85886"sp_addumpdevice
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
ID="IN4518-6416896"disk refit command
ID="IN4519-6817297"disk reinit commandID="X47917"disk reinit
ID="IN4631-7417999"Reinitializing, disk reinit anddisk reinit and
ID="IN469-76181100"RestoringRestoringa damaged master databasedamaged master database
Rebuilds the master database's sysdevices system table. Use MOREINFO="NONE"disk reinitID="IN469-78183101"RestoringRestoringa damaged master databasedamaged master database
ID="IN4615-82187102"master databasedisk reinit and
 as part of the procedure to restore the master database. FORMAT="LINESPECIFIC"disk reinit name = "MOREINFO="NONE"device_name", physname = "MOREINFO="NONE"physicalname" , vdevno = MOREINFO="NONE"virtual_device_number , size = number_of_MOREINFO="NONE"blocks [, vstart = MOREINFO="NONE"virtual_address , cntrltype = MOREINFO="NONE"controller_number] Keywords and OptionsREMAP="RI--RefIndent"ID="IN4611-86191105"name optiondisk reinit
MOREINFO="NONE"name - is the name of the database device. It must conform to the rules for identifiers, and must be enclosed in single or double quotes. This name is used in the MOREINFO="NONE"create database and MOREINFO="NONE"alter database commands. ID="IN4615-90195106"physname optiondisk reinit
ID="IN4614-92197107"Name of devicephysical, disk reinit and
MOREINFO="NONE"physname - is the name of the database device. The physical name must be enclosed in single or double quotes. ID="IN4613-96201108"vdevno optiondisk reinit
MOREINFO="NONE"vdevno ID="IN467-96201109"Numbersvirtual device;Virtual device number;Devices:numbering
- is the virtual device number. It must be unique among devices used by SQL Server. The device number 0 is reserved for the master database device. Legal numbers are between 1 and 255, but cannot be greater than the number of database devices for which your system is configured. The default is 50 devices. ID="IN4611-100205110"size optiondisk reinit
MOREINFO="NONE"size - is the size of the database device in 2K-blocks. The minimum usable size is 1024 2K-blocks (2 megabytes). ID="IN4613-104209111"vstart optiondisk reinit
MOREINFO="NONE"vstart ID="IN4615-104209112"Virtual address
- is the starting virtual address, or the starting offset in 2K blocks. The value for vstart should be 0 (the default). Reset it only if instructed to do so. ID="IN4616-108213113"cntrltype optiondisk reinit
MOREINFO="NONE"cntrltype ID="IN4616-108213114"Disk controllers
- specifies the disk controller. Its default value is 0. Reset it only if instructed to do so. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"disk reinit   name = "user_disk",   physname = "/server/data/userdata.dat",   vdevno = 2, size = 5120CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"disk reinit insures that master..sysdevices is correct if the master database has been damaged, or if devices have been added since the last dump of master. MOREINFO="NONE"disk reinit is very similar to MOREINFO="NONE"disk init, but does not initialize the database device. For complete information on restoring the master database, see the SYBASE SQL Server Installation Guide for your system or the System Administration Guide. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance levelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"disk reinit permission defaults to System Administrators, and is not transferable. You must be in the master database to use MOREINFO="NONE"disk reinit. See AlsoCommands     LINKEND="X61977"alter database
MOREINFO="NONE", LINKEND="X75308"create database
MOREINFO="NONE", LINKEND="X60179"dbcc
MOREINFO="NONE", LINKEND="X64061"disk init
MOREINFO="NONE", LINKEND="X86010"disk refitSystem procedures     LINKEND="X85886"sp_addumpdevice
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
ID="IN4619-112217120"disk reinit command
ID="IN4631-118223121"Reinitializing, disk reinit anddisk reinit and
ID="IN4621-122227122"disk remirror commandID="X49953"disk remirror
ID="IN4731-125231124"Remirroring. See Disk mirroring
Restarts disk mirroring after it is stopped by failure of a mirrored device or temporarily disabled by the MOREINFO="NONE"disk unmirrorID="IN4721-130236125"disk remirror commanddisk remirror commandSee also Disk mirroring!see also Disk mirroring
 command. FORMAT="LINESPECIFIC"disk remirror name = "MOREINFO="NONE"device_name" Keywords and OptionsREMAP="RI--RefIndent"ID="IN4719-130236128"Logical device namedisk remirroring;Name of device:disk remirroring and
MOREINFO="NONE"name - is the name of the database device that you want to remirror. This is recorded in the name column of the sysdevices table. The name must be enclosed in single or double quotes. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"disk remirror   name = "user_disk" REMAP="UN--Under"Resumes software mirroring on the database device user_disk. CommentsMARK="BULL" REMAP="BU--Bullet"Devices are mirrored, not databases. You should mirror all the default database devices so that you are still protected if a MOREINFO="NONE"create or MOREINFO="NONE"alter database command affects a database device in the default list. You can mirror, remirror, or unmirror database devices without shutting down SQL Server. Disk mirroring does not interfere with ongoing activities in the database. ID="IN477-130236131"Backupsdisk remirroring and
ID="IN4715-134240132"master databasebackup after disk remirrorIt is important to back up the master database with the MOREINFO="NONE"dump MOREINFO="NONE"database command after each use of MOREINFO="NONE"disk remirror. This makes recovery easier and safer in case master is damaged. ID="IN4715-136242133"Failures, mediadisk remirror and
When a read or write to a mirrored device is unsuccessful, SQL Server causes the bad device to become unmirrored, and prints error messages. SQL Server continues to run, unmirrored. The System Administrator must use MOREINFO="NONE"disk remirror to restart mirroring.UseMOREINFO="NONE" disk remirror to reestablish mirroring after it is temporarily stopped with the MOREINFO="NONE"mode = retain option of the MOREINFO="NONE"disk unmirror command. The MOREINFO="NONE"disk remirror command copies data on the retained disk to the mirror. If mirroring is permanently disabled with the MOREINFO="NONE"mode = remove option, you must remove the operating system file that contains the mirror before using MOREINFO="NONE"disk remirror.ID="IN4716-136242134"Database devicestransaction logs on separate
ID="IN4720-136242135"Separation, physicalSeparation, physicalof transaction log device;Transaction logs:on a separate device[Transaction logs:separate device]transaction log device
ID="IN4713-138244136"syslogs tableput on a separate deviceIn addition to mirroring user database devices, you should always put user database transaction logs on a separate database device. The database device used for transaction logs can also be mirrored, for even greater protection. To put a database's transaction log (that is, the system table syslogs) on a different device than the one on which the rest of the database is stored, name the database device and the log device when you create the database. You could also MOREINFO="NONE"alter database to a second device and then run the system procedure MOREINFO="NONE"sp_logdevice. If you mirror the database device for the master database, you can use the MOREINFO="NONE"-r option and the name of the mirror for UNIX, or the MOREINFO="NONE"mastermirrorID="IN4716-140246137"Restarts, Serverusing dataserver utility
 option for OpenVMS, when you restart SQL Server with the MOREINFO="NONE"dataserver utility program. This option should also be added to the RUN_servername file for that server, so that the MOREINFO="NONE"startserver utility program will know about it. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"dataserver -dmaster.dat -rmirror.datREMAP="UN--Under"starts a master device named master.dat and its mirror, mirror.datID="IN4726-144250138"dataserver utility commanddisk remirror and
. For more information, see MOREINFO="NONE"dataserverID="IN4727-148254139"startserver utility commanddisk remirror and
 and MOREINFO="NONE"startserver in the SQL Server Utility Programs. For a report on all SQL Server devices on your system (user database devices and their mirrors, as well as dump devices), execute the system procedure MOREINFO="NONE"sp_helpdevice. For more details about disk mirroring in the OpenVMS environment, see the SYBASE SQL Server
 Installation
 Guide for OpenVMS.
 Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Standard COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"disk remirror permission defaults to the System Administrator, and is not transferable. You must be using the master database to use MOREINFO="NONE"disk remirror. See AlsoCommands     LINKEND="X61977"alter database
MOREINFO="NONE", LINKEND="X75308"create database
MOREINFO="NONE", LINKEND="X64061"disk init
MOREINFO="NONE", LINKEND="X27321"disk mirror
MOREINFO="NONE", LINKEND="X86010"disk refit
MOREINFO="NONE", LINKEND="X47917"disk reinit
MOREINFO="NONE", LINKEND="X45609"disk unmirror
MOREINFO="NONE", LINKEND="X68345"dump database
MOREINFO="NONE", LINKEND="X47924"dump transaction
MOREINFO="NONE", LINKEND="X28090"load database
MOREINFO="NONE", LINKEND="X75212"load transactionTopics     LINKEND="X82597"Disk MirroringSystem procedures     LINKEND="X92302"sp_diskdefault
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
MOREINFO="NONE", LINKEND="X21496"sp_logdeviceUtility programs      
BOOK="unix" LINKEND="X76998"dataserver
MOREINFO="NONE", BOOK="unix" LINKEND="X28711"startserver
ID="IN4721-152258144"disk unmirror command
ID="IN4739-155261145"Disabling mirroring. See Disk mirroring
ID="IN4739-158264146"Unmirroring devices. See Disk mirroringID="X45609"disk unmirrorID="IN4821-163270148"disk unmirror commanddisk unmirror commandSee also Disk mirroring!see also Disk mirroring
De-activates disk mirroring to allow hardware maintenance or the changing of a hardware device. MOREINFO="NONE"disk unmirror disables either the original database device or the mirror, so that it is no longer available to SQL Server for reads or writes. It does not remove the associated file from the operating system.FORMAT="LINESPECIFIC"disk unmirror name = "MOREINFO="NONE"device_name" [ ,side = { "primary" | secondary }] [ ,mode = { retain | remove }] Keywords and OptionsREMAP="BO--Body"ID="IN4819-163270151"Logical device namedisk unmirroring;Name of device:disk unmirroring and
MOREINFO="NONE"name = "device_name" - is the name of the database device that you want to unmirror. The name must be enclosed in single or double quotes. REMAP="RI--RefIndent"ID="IN4826-167274152"side option, disk unmirror
MOREINFO="NONE"sideID="IN4814-167274153"Pair, mirrored
ID="IN4830-167274154"Deactivation of disk mirroringunmirroring and
ID="IN4829-171278155"primary option, disk unmirror
 - specifies whether to disable the MOREINFO="NONE""primaryID="IN4831-175282156"secondary option, disk unmirror
" device or the MOREINFO="NONE"secondaryID="IN4816-179286157"sysdevices tablemirrornames column in
 device (the mirror). By default, the secondary device is unmirrored. ID="IN4826-183290158"mode option, disk unmirror
MOREINFO="NONE"mode - determines whether the unmirroring is temporary (MOREINFO="NONE"retain) or permanent (MOREINFO="NONE"remove). By default, unmirroring is temporary.REMAP="UN--Under"Set MOREINFO="NONE"retain when you plan to remirror the database device later in the same configuration. ID="IN4828-187294159"retain option, disk unmirror
ID="IN4815-187294160"Failures, mediaautomatic failover and
This option mimics what happens when the primary device fails: MARK="DASH" REMAP="BS--BulletSub"I/O is directed only at the device not being unmirrored The status column of sysdevices indicates that mirroring is deactivated REMAP="UN--Under"MOREINFO="NONE"remove eliminates all sysdevicesID="IN4828-191298161"remove option, disk unmirror
 references to a mirror device: MARK="DASH" REMAP="BS--BulletSub"The status column indicates that the mirroring feature is ignored The phyname column is replaced by the name of the secondary device in the mirrorname column if the primary device is the one being deactivatedThe mirrorname column is set to NULL ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"disk unmirror name = "user_disk" REMAP="UN--Under"Suspends software mirroring for the database device user_disk. CommentsMARK="BULL" REMAP="BU--Bullet"You can unmirror a database device while it is in use. You cannot unmirror any of a database's devices while a MOREINFO="NONE"dump database, MOREINFO="NONE"load database, or MOREINFO="NONE"load transaction command is in progress for that database. SQL Server displays a message asking you whether to abort the dump or load or to defer the MOREINFO="NONE"disk unmirror until after the dump or load completes.You cannot unmirror a database's log device while a MOREINFO="NONE"dump transaction is in progress for that databaseMOREINFO="NONE", SQL Server displays a message asking you whether to abort the dump or defer the MOREINFO="NONE"disk unmirror until after the dump completes.MOREINFO="NONE"dump transaction with truncate_only and MOREINFO="NONE"dump transaction with no_log are not affected when a log device is unmirrored.Disk unmirroring alters the sysdevices table in the masterID="IN487-191298164"Backupsdisk mirroring and
ID="IN4815-195302165"master databasebackup after disk unmirror
 database. It is important to back up the master database with the MOREINFO="NONE"dump MOREINFO="NONE"database command after each use of MOREINFO="NONE"disk unmirror. This makes recovery easier and safer in case master is damaged. UseMOREINFO="NONE" disk remirror to reestablish mirroring after it is temporarily stopped with the MOREINFO="NONE"mode = retain option of the MOREINFO="NONE"disk unmirror command. If mirroring is permanently disabled with the MOREINFO="NONE"mode = remove option, you must remove the operating system file that contains the mirror before using MOREINFO="NONE"disk remirror.You should mirror all the default database devices so that you are still protected if a MOREINFO="NONE"create or MOREINFO="NONE"alter database command affects a database device in the default list. When a read or write to a mirrored device is unsuccessful, SQL Server automatically unmirrors the bad device and prints error messages. SQL Server continues to run, unmirrored. A System Administrator must restart mirroring with the MOREINFO="NONE"disk remirror command.For a report on all SQL Server devices on your system (user database devices and their mirrors, as well as dump devices), execute the system procedure MOREINFO="NONE"sp_helpdevice. For more details about disk mirroring in the OpenVMS environment, see the SYBASE SQL Server
 Installation Guide for OpenVMS.
 Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Standard COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"disk unmirror permission defaults to the System Administrator, and is not transferable. You must be using the master database to use MOREINFO="NONE"disk unmirror. See AlsoCommands     LINKEND="X61977"alter database
MOREINFO="NONE", LINKEND="X75308"create database
MOREINFO="NONE", LINKEND="X64061"disk init
MOREINFO="NONE", LINKEND="X27321"disk mirror
MOREINFO="NONE", LINKEND="X86010"disk refit
MOREINFO="NONE", LINKEND="X47917"disk reinit
MOREINFO="NONE", LINKEND="X49953"disk remirror
MOREINFO="NONE", LINKEND="X68345"dump database
MOREINFO="NONE", LINKEND="X47924"dump transaction
MOREINFO="NONE", LINKEND="X28090"load database
MOREINFO="NONE", LINKEND="X75212"load transactionTopics     LINKEND="X82597"Disk MirroringSystem procedures     LINKEND="X92302"sp_diskdefault
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
MOREINFO="NONE", LINKEND="X21496"sp_logdeviceUtility programs     BOOK="unix" LINKEND="X76998"dataserver
MOREINFO="NONE", BOOK="unix" LINKEND="X28711"startserverID="X72692"drop database
Removes one or more databases from SQL Server. FORMAT="LINESPECIFIC"drop database database_name [, MOREINFO="NONE"database_name]... Keywords and OptionsREMAP="RI--RefIndent"database_name - is the name of a database to remove. Use MOREINFO="NONE"sp_helpdb to get a list of databases. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"drop database publishing drop database publishing, newpubs REMAP="UN--Under"The dropped databases (and their contents) are gone. CommentsMARK="BULL" REMAP="BU--Bullet"You must be using the master database to drop a database. Removing a database deletes the database and all its objects, frees its storage allocation, and erases its entries in the sysdatabases and sysusages system tables in the ID="IN43159398"master databasedropping databases and
master database. You cannot drop a database that is in use (open for reading or writing by any user). You cannot use MOREINFO="NONE"drop database to remove a database that is referenced by a table in another database. Execute the following query to determine which tables and external databases have foreign key constraints on primary key tables in the current database:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select object_name(tableid), db_name(frgndbname)         from sysreferenceswhere frgndbname is not nullREMAP="UN--Under"Use MOREINFO="NONE"alter table to drop these cross-database constraints, then re-issue the MOREINFO="NONE"drop database command.You cannot use MOREINFO="NONE"drop database to remove a damaged database. Use the MOREINFO="NONE"dbcc dbrepair command: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"dbcc dbrepair (MOREINFO="NONE"database_name, dropdb)ID="IN432091119"sybsecurity databasedroppingYou cannot drop the sybsecurity database if auditing is enabled. If auditing is disabled, only the System Security Officer can drop sybsecurity.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"Only the Database Owner can execute MOREINFO="NONE"drop database, except in the case of the sybsecurity database which can only be dropped by the System Security Officer. See AlsoCommands     LINKEND="X61977"alter database
MOREINFO="NONE", LINKEND="X75308"create database
MOREINFO="NONE", LINKEND="X60179"dbcc
MOREINFO="NONE", LINKEND="X39034"useSystem procedures     LINKEND="X78355"sp_changedbowner
MOREINFO="NONE", LINKEND="X90458"sp_helpdb
MOREINFO="NONE", LINKEND="X99854"sp_renamedb
MOREINFO="NONE", LINKEND="X50477"sp_spaceused
ID="IN4321871513"drop database command
ID="IN438861614"Droppingdatabases
ID="IN4320822015"drop default commandID="X97463"drop defaultID="IN448822117"Defaultsdropping;Defaults:removing user-defined;Dropping:user-defined default
ID="IN449822118"Unbindingdefaults
Removes a user-defined default. FORMAT="LINESPECIFIC"drop default [MOREINFO="NONE"owner.]MOREINFO="NONE"default_name [, [MOREINFO="NONE"owner.]MOREINFO="NONE"default_name]... Keywords and OptionsREMAP="RI--RefIndent"default_name - is the name of an existing default. Execute MOREINFO="NONE"sp_helpID="IN447822121"Listingexisting defaults
 to get a list of existing defaults. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop default datedefault REMAP="UN--Under"The user-defined default datedefault has been dropped. CommentsID="IN4432802324"sp_unbindefault system proceduredefault after unbinding itMARK="BULL" REMAP="BU--Bullet"A default cannot be dropped if it is currently bound to a column or user-defined datatype. Use the system procedure MOREINFO="NONE"sp_unbindefault to unbind the default before you drop it. ID="IN447802325"Bindingnew defaultYou can bind a new default to a column or user-defined datatype without unbinding its current default. The new default will override the old one. ID="IN4415802326"Not null valuesdropping defaults for;Null values:dropping defaults forWhen you drop a default for a NULL column, NULL becomes the column's default value. When you drop a default for a NOT NULL column, an error message will display if users do not explicitly enter a value for that column. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"drop MOREINFO="NONE"default permission defaults to the owner of the default, and is not transferable. See AlsoCommands     LINKEND="X81463"create defaultSystem procedures     LINKEND="X91431"sp_help
MOREINFO="NONE", LINKEND="X25756"sp_helptext
MOREINFO="NONE", LINKEND="X87638"sp_unbindefault
ID="IN4420762731"drop default command
ID="IN4418713232"drop index commanddroppingID="X93093"drop index
Removes an index from a table in the current database. FORMAT="LINESPECIFIC"drop index table_name.index_name [, MOREINFO="NONE"table_name.MOREINFO="NONE"index_name]... Keywords and OptionsREMAP="RI--RefIndent"ID="IN456713336"Tablesindex location
table_name - is the table in which the indexed column is located. The table must be in the current database.index_name - is the index to be dropped. In Transact-SQL, index names need not be unique in a database, though they must be unique within a table. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop index authors.au_id_ind REMAP="UN--Under"The index au_id_ind in the authors table no longer exists. CommentsMARK="BULL" REMAP="BU--Bullet"Once the command is issued, you regain all of the space occupied by the index. This space can be used for any database objects. You cannot use MOREINFO="NONE"drop index on any of the system tables that exist in the ID="IN4515673739"master databasedrop index and
master database and in user databases. You cannot drop indexes supporting unique constraints using the MOREINFO="NONE"drop index statement. Such indexes are dropped when the constraints are dropped through MOREINFO="NONE"alter table or when the table is dropped. See LINKEND="X80969"create table
 for more information about unique constraint indexes.You cannot drop indexes that are currently used by any open cursor. For information about which cursors are open and what indexes they use, use MOREINFO="NONE"sp_cursorinfo.ID="IN457673740"IndexeslistingTo get information about what indexes exist on a table or view, use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_helpindex tabview_nameREMAP="UN--Under"where tabview_name is the name of the table or view.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"drop index permission defaults to the index owner, and is not transferable. See AlsoCommands     LINKEND="X58868"create indexSystem procedures     LINKEND="X95439"sp_cursorinfo
MOREINFO="NONE", LINKEND="X87980"sp_helpindex
MOREINFO="NONE", LINKEND="X50477"sp_spaceused
ID="IN4518624244"drop index commanddropping
ID="IN4522584645"drop procedure command
ID="IN4517574746"Stored proceduresdroppingID="X21497"drop procedureID="IN4617564948"System proceduresdropping user-defined
Removes user-defined stored procedures. FORMAT="LINESPECIFIC"drop procedure [MOREINFO="NONE"owner.]MOREINFO="NONE"procedure_name [, [MOREINFO="NONE"owner.]MOREINFO="NONE"procedure_name] ... Keywords and OptionsREMAP="RI--RefIndent"procedure_name - is the name of the stored procedure to be dropped.ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop procedure showind REMAP="UN--Under"The stored procedure showind has been deleted. CommentsMARK="BULL" REMAP="BU--Bullet"The existence of a stored procedure is checked each time a user or a program executes that procedure. ID="IN4622545153"drop procedure commandgrouped procedures and;Grouping:procedures of the same name;Stored procedures:grouping
ID="IN4616545154"Procedure groups
ID="IN467545155"Numberssame name group procedureA procedure group (more than one procedure with the same name but with different ;number suffixes) can be dropped with a single MOREINFO="NONE"drop procedure statement. For example, if the procedures used with the application orders were named orderproc;1, orderproc;2, etc., the following statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop proc orderproc REMAP="UN--Under"would drop the entire group. Once procedures have been grouped, individual procedures within the group cannot be dropped. For example, the statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop procedure orderproc;2 REMAP="UN--Under"is not allowed. The system procedure MOREINFO="NONE"sp_helptext displays the procedure's text (which is stored in syscomments). ID="IN4615525356"master databasedropping user-created system procedures from
MOREINFO="NONE"drop procedure drops user-created procedures only from your current database. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance levelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"drop procedure permission defaults to the procedure owner, and is not transferable. See AlsoCommands     LINKEND="X52197"create procedureSystem procedures     LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X25756"sp_helptext
MOREINFO="NONE", LINKEND="X37949"sp_rename
ID="IN4622485760"drop procedure command
ID="IN4617475861"Stored proceduresdropping
ID="IN4617465962"System proceduresdropping user-defined
ID="IN4617426363"drop rule commandID="X62555"drop ruleID="IN478426465"Droppinguser-defined rule;Rules:dropping user-defined
Removes a user-defined rule. FORMAT="LINESPECIFIC"drop rule [MOREINFO="NONE"owner.]MOREINFO="NONE"rule_name [, [MOREINFO="NONE"owner.]MOREINFO="NONE"rule_name]... ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop rule pubid_rule REMAP="BO--Body"       The rule pubid_rule no longer exists. Keywords and OptionsREMAP="RI--RefIndent"rule_name - is the name of the rule to be dropped. CommentsID="IN4730386870"sp_unbindrule system proceduredrop rule and;Unbinding:rulesMARK="BULL" REMAP="BU--Bullet"Before dropping a rule, you must unbind it using the system procedure MOREINFO="NONE"sp_unbindrule. If the rule hasn't been unbound, an error message will be given and the MOREINFO="NONE"drop rule command will be aborted. You can bind a new rule to a column or user-defined datatype without unbinding its current rule. The new rule overrides the old one. After you drop a rule, new data entered into the columns that previously were governed by it goes in without constraints. Already existing data is not affected in any way. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"drop rule permission defaults to the rule owner, and is not transferable. See AlsoCommands     LINKEND="X43186"create ruleSystem procedures     LINKEND="X38718"sp_bindrule
MOREINFO="NONE", LINKEND="X91431"sp_help
MOREINFO="NONE", LINKEND="X25756"sp_helptext
MOREINFO="NONE", LINKEND="X37191"sp_unbindrule
ID="IN4717347275"drop rule command
ID="IN4718307676"drop table commandID="X58548"drop tableID="IN488287978"Droppingtables;Tables:dropping
Removes a table definition and all of its data, indexes, triggers, and permission specifications from the database. FORMAT="LINESPECIFIC"drop table [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name [, [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name ]... Keywords and OptionsREMAP="RI--RefIndent"table_name - is the name of the table to be dropped. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop table roysched REMAP="BO--Body"       The table roysched and its data and indexes no longer exist. Comments MARK="BULL" REMAP="BU--Bullet"When you MOREINFO="NONE"dropID="IN4810287983"Recreatingtables
 a table, any rules or defaults on it lose their binding, and any triggers associated with it are automatically dropped. If you recreate a table, you must re-bind the appropriate rules and defaults and recreate any triggers. ID="IN4813268184"System tablesaffected by drop tableThe system tables affected when a table is dropped are sysobjects, syscolumns, sysindexes, sysprotects, and syscomments. You cannot use the MOREINFO="NONE"drop table command on any of the system tables, either in the master database or in a user database. You can drop a table in any database so long as you are the table owner. For example, to drop a table called newtable in the database otherdb: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"drop table otherdb..newtable REMAP="UN--Under"orMOREINFO="NONE":REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"drop table otherdb.yourname.newtable ID="IN488268185"Droppingrows from a tableIf you MOREINFO="NONE"delete all the rows in a table or give the MOREINFO="NONE"truncate table command, the table still exists until you MOREINFO="NONE"drop it. ID="IN4833268186"Referential integrity constraintscross-database;Constraints:cross-databaseUsing Cross-Database Referential Integrity ConstraintsMARK="BULL" REMAP="BU--Bullet"When you create a cross-database constraint, SQL Server stores the following information in the sysreferences system table of each database:TOCENTRY="1"LBL="Table 1-11: "Information stored about referential integrity constraintsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Information 
Stored in 
sysreferencesCOLNAME="C2" NAMEST="C2" NAMEEND="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Columns with Information about theCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Referenced TableCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Referencing TableVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Key Column IDsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"refkey1 through refkey16COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fokey1 through fokey16COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table IDCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"reftabidCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tableidCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database NameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pmrydbname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"frgndbnameYou can drop the referencing table or its database without problems. SQL Server automatically removes the foreign key information from the referenced database.Because the referencing table depends on information from the referenced table, SQL Server does not allow you to:MARK="DASH" REMAP="BS--BulletSub"Drop the referenced table,Drop the external database that contains it, orRename either database with MOREINFO="NONE"sp_renamedbREMAP="UN--Under"Use the MOREINFO="NONE"sp_helpconstraint system procedure to determine which tables reference the table you want to drop. Use MOREINFO="NONE"alter table to drop the constraints before re-issuing the MOREINFO="NONE"drop table command.Each time you add or remove a cross-database constraint, or drop a table that contains a cross-database constraint, dump both of the affected databases. Loading earlier dumps of these databases could cause database corruption.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"drop table permission defaults to the table owner and is not transferable, except to the Database Owner, who can impersonate the table owner by running the MOREINFO="NONE"setuser command. See AlsoCommands     LINKEND="X68185"alter table
MOREINFO="NONE",LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X45593"delete
MOREINFO="NONE", LINKEND="X16531"truncate tableSystem procedures     LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X91431"sp_help
MOREINFO="NONE", LINKEND="X50477"sp_spaceused
ID="IN4818228590"drop table command
ID="IN488208791"Droppingtables;Tables:dropping
ID="IN4820169192"drop trigger commandID="X48835"drop triggerID="IN498169294"Triggersdropping
Removes a trigger. FORMAT="LINESPECIFIC"drop trigger [owner.]trigger_name [, [MOREINFO="NONE"owner.]MOREINFO="NONE"trigger_name]... Keywords and OptionsREMAP="RI--RefIndent"trigger_name - is the name of the trigger to be dropped. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop trigger trigger1 REMAP="UN--Under"The trigger trigger1 no longer exists. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"drop trigger permission defaults to the trigger owner, and is not transferable. See AlsoCommands     LINKEND="X19955"create triggerSystem procedures     LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X91431"sp_help
MOREINFO="NONE", LINKEND="X25756"sp_helptext
ID="IN49201296101"drop trigger command
ID="IN49178100102"drop view command
ID="IN4958100103"ViewsdroppingID="X31140"drop viewID="IN5058101105"Viewsdropping
Removes one or more views from the current database. FORMAT="LINESPECIFIC"drop view [owner.]view_name [, [MOREINFO="NONE"owner.]MOREINFO="NONE"view_name]...Keywords and OptionsREMAP="RI--RefIndent"ID="IN5058101108"Namesview
view_name - is the name of the view to be dropped. It must be a legal identifier. It cannot include a database name. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop view new_price REMAP="UN--Under"FORMAT="LINESPECIFIC"Removes the view new_price from the current database.CommentsID="IN50136103111"System tablesaffected by drop viewMARK="BULL" REMAP="BU--Bullet"When you use MOREINFO="NONE"drop view, the definition of the view and other information about it is deleted from the system tables sysobjects, syscolumns, syscomments, sysdepends, sysprocedures, and sysprotects. All privileges for the view are deleted, too. Existence of a view is checked each time the view is referenced, for example, by another view or by a stored procedure. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"drop view permission defaults to the view owner, and is not transferable. See AlsoCommands     LINKEND="X30101"create viewSystem procedures     LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X91431"sp_help
MOREINFO="NONE", LINKEND="X25756"sp_helptext
ID="IN50172107115"drop view commandREMAP="BO--Body"ID="X68345"dump databaseID="IN431686165"Transaction logsbacking up;Transaction logs:dump database and
Makes a backup copy of the entire database, including the transaction log, in a form that can be read in with MOREINFO="NONE"load databaseID="IN432480226"dump transaction commanddump transaction commandSee also dump database command; Dump devices!see also
ID="IN435177257"Database dump. See Dump, database; Dump devices
ID="IN431274288"Dump devicesDump devicesSee also Database devices; Log device!see also
ID="IN431571319"Failures, mediaFailures, mediaSee also Recovery!see also
ID="IN439683410"RestoringRestoringSee also Recovery!see also
. Dumps and loads are performed through a Backup Server.FORMAT="LINESPECIFIC"dump database database_name to stripe_device [ at backup_server_name ]    [density = density_value,     blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file =file_name][stripe on stripe_device [ at backup_server_name ]    [density = density_value,      blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file = file_name]][[stripe on stripe_device [ at backup_server_name ]     [density = density_value,      blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file = file_name]]...][with {     density = density_value,      blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file = file_name,    [dismount | nodismount],    [nounload | unload],    retaindays = number_days,    [noinit | init],    notify = {client | operator_console}    }]]Keywords and OptionsREMAP="RI--RefIndent"database_name - is the name of the database from which you are copying data. The database name can be specified as a literal, a local variable, or a parameter to a stored procedure.ID="IN4321663613"dump database commanddump devices
MOREINFO="NONE"to stripe_deviceID="IN4314663614"Name of devicedump device;Dump devices:naming
 - is the ID="IN4312643815"Dump devicesdump database and
device to which data is being copied. See LINKEND="X46333""Specifying Dump Devices"
 for information about what form to use when specifying a dump device. See the System Administration Guide Supplement for a list of supported dump devices.ID="IN4321624016"dump database commandBackup Server, remote
MOREINFO="NONE"at backup_server_name - is the name of the Backup Server. This parameter is optional when dumping to the default Backup Server. When dumping across the network, specify the network name of a remote Backup Server running on the machine to which the dump device is attached. For platforms that use interfaces files, the backup_server_name must appear in the interfaces file.ID="IN4321604217"dump database commandtape density
MOREINFO="NONE"density = density_value - overrides the default density for a tape device. Use this option only when reinitializing a volume on OpenVMS systems. Valid densities are 800, 1600, 6250, 6666, 10000, and 38000. Not all values are valid for every tape drive; use the correct density for your tape drive.ID="IN4321584418"dump database command blocksize
MOREINFO="NONE"blocksize = number_bytes - overrides the default blocksize for a dump device. (Wherever possible, use the default blocksize; it is the "best" blocksize for your system.) The blocksize must be at least one database page (2048 bytes for most systems, 4096 for Stratus) and must be an exact multiple of the database page size. On OpenVMS systems, blocksize cannot exceed 16,384 bytes. ID="IN4321564619"dump database commandtape capacity
ID="IN4321544820"dump database commandtape capacity
MOREINFO="NONE"capacity = number_kilobytes -  is the maximum amount of data that the device can write to a single tape volume. The capacity must be at least five database pages, and should be slightly less than the recommended capacity for your device. REMAP="UN--Under"OpenVMS systems write until they reach the physical end-of-tape marker, then send a volume change request. On UNIX platforms that cannot reliably detect the end-of-tape marker, you must indicate how many kilobytes can be dumped to the tape. You must supply a MOREINFO="NONE"capacity for dump devices specified as a physical pathname. If a dump device is specified as a logical device name, the Backup Server uses the size parameter stored in the sysdevices system table unless you specify a capacity.ID="IN4321525021"dump database commandvolume name
MOREINFO="NONE"dumpvolume = volume_name - establishes the name that is assigned to the volume. The Backup Server writes the volume_name in the ANSI tape label when overwriting an existing dump, dumping to a brand new tape, or dumping to a tape whose contents are not recognizable. The MOREINFO="NONE"load database command checks the label and generates an error message if the wrong volume is loaded. Be sure to label each tape volume as you create it. This makes it easier for the operator to load the correct tape.ID="IN4321505222"dump database commanddump striping
MOREINFO="NONE"stripe on stripe_device - is an additional dump device. You can use up to 32 devices, including the device named in the MOREINFO="NONE"to stripe_device clause. The Backup Server splits the database into approximately equal portions, and sends each portion to a different device. Dumps are made concurrently on all devices, reducing the time required to make a dump and requiring fewer volume changes during the dump. See LINKEND="X46333""Specifying Dump Devices"
 for information about how to specify a dump device.ID="IN4321485423"dump database commanddismounting tapes
ID="IN4328445824"dismount | nodismount optiondump database
MOREINFO="NONE"dismount | MOREINFO="NONE"nodismount - on platforms, such as OpenVMS, that support logical dismountID="IN4317406225"nodismount optiondump database
, determines whether tapes remain mounted. By default, all tapes used for a dump are dismounted when the dump completes. Use MOREINFO="NONE"nodismount to keep tapes available for additional dumps or loads.ID="IN4321386426"dump database commandrewinding tapes after
MOREINFO="NONE"nounload | MOREINFO="NONE"unload - determines whether tapes rewind after the dump completes. By default, tapes do not rewind, allowing you to make additional dumps to the same tape volume. Specify MOREINFO="NONE"unload for the last dump file to be added to a multi-dump volume. This rewinds and unloads the tape when the dump completes.ID="IN4321366627"dump database commandexpiration date
MOREINFO="NONE"retaindays = number_days  - on UNIX systems, specifies the number of days that Backup Server protects you from overwriting a dump. ID="IN4314366628"Dump, databaseoverwriting
This option is meaningful for disk, quarter-inch cartridge, and single-file media. On multi-file media, this option is meaningful for all volumes but the first. If you try to overwrite a dump before it expires, Backup Server requests confirmation before overwriting the unexpired volume.REMAP="UN--Under"The number_days must be a positive integer, or 0 for dumps you can overwrite immediately. If you do not specify a MOREINFO="NONE"retaindays value, Backup Server uses the server-wide "tape retention" value, set by MOREINFO="NONE"sp_configure.ID="IN4321346829"dump database commandinitializing/appending
MOREINFO="NONE"noinit | MOREINFO="NONE"init - determines whether the dump is appended to existing dump files or reinitializes (overwrites) the tape volume. By default, dumps are appended following the last end-of-tape mark, allowing you to dump additional databases to the same volume. New dumps can be appended only to the last volume of a multi-volume dump. Use MOREINFO="NONE"init for the first database you dump to a tape, to overwrite its contents.ID="IN4321327030"dump database commandfile name;Dump, database:file name
MOREINFO="NONE"file = file_name - is the name of the dump file. The name cannot exceed 17 characters and must conform to operating system conventions for file names. If you do not specify a file name, Backup Server creates a default. For more information, see LINKEND="X16281""Dump Files"
.ID="IN4321307231"dump database commandmessage destination
MOREINFO="NONE"notify = {MOREINFO="NONE"client |MOREINFO="NONE" operator_console} - overrides the default message destination. MARK="DASH" REMAP="BS--BulletSub"On operating systems (such as OpenVMS) that offer an operator terminal feature, volume change messages are always sent to the operator terminal on the machine on which the Backup Server is running. UseMOREINFO="NONE" client to route other Backup Server messages to the terminal session that initiated the MOREINFO="NONE"dump database.On operating systems (such as UNIX) that do not offer an operator terminal feature, messages are sent to the client that initiated the MOREINFO="NONE"dump database. Use MOREINFO="NONE"operator_console to route messages to the terminal on which the Backup Server is running.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database pubs2to "/dev/nrmt0"REMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database pubs2to "MTA0:"REMAP="UN--Under"Dumps the database pubs2 to a tape device.If the tape has an ANSI tape label, this command appends this dump to the files already on the tape, since the MOREINFO="NONE"init option is not specified.For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database pubs2to
"/dev/rmt4" at REMOTE_BKP_SERVERstripe on "/dev/nrmt5" at
REMOTE_BKP_SERVERstripe on "/dev/nrmt0" at REMOTE_BKP_SERVERwith retaindays = 14REMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database pubs2to "MTA0:" at REMOTE_BKP_SERVERstripe on "MTA1:" at REMOTE_BKP_SERVERstripe on "MTA2:" at REMOTE_BKP_SERVERREMAP="UN--Under"Dumps the pubs2 database, using the REMOTE_BKP_SERVER Backup Server. The command names three dump devices, so the Backup Server dumps approximately one third of the database to each device. This command appends the dump to existing files on the tapes. On UNIX systems, the MOREINFO="NONE"retaindays option specifies that the tapes cannot be overwritten for 14 days. (OpenVMS systems do not use the MOREINFO="NONE"retaindays option; they always create new versions of files.)For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database
pubs2to "/dev/nrmt0"with initREMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database pubs2to "MTA0:" with initREMAP="UN--Under"The MOREINFO="NONE"init option initializes the tape volume, overwriting any existing files.For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database pubs2to
"/dev/nrmt0"with unloadREMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database pubs2to "MTA0:"with unloadREMAP="UN--Under"Rewinds the dump volumes upon completion of the dump.For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database
pubs2to "/dev/nrmt0"with notify = clientREMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database pubs2to "MTA0:"with notify = clientREMAP="UN--Under"The MOREINFO="NONE"notify clause sends Backup Server messages requesting volume changes to the client which initiated the dump request, rather than sending them to the default location, the console of the Backup Server machine.CommentsID="IN4314307234"Dump, databasecommands used forCommands Used to Back Up DatabasesREMAP="BO--Body"LINKEND="X23427"Table 1-12
 describes the commands and system procedures used to back up databases:TOCENTRY="1"LBL="Table 1-12: " ID="X23427"Commands used to back up databases and logsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="11*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Use This CommandCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ToVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Make routine dumps of the entire 
database, including the transaction logCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Make routine dumps of the transaction 
log, then truncate the inactive portionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transaction with no_truncate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dump the transaction log after failure of a 
database deviceCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transaction with 
truncate_onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Truncate the log without making a 
backup COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Then copy the entire databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transaction with no_logCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Truncate the log after your usual method 
fails due to insufficient log spaceCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Then copy the entire databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Respond to the Backup Server's volume 
change messagesID="IN4314297335"Dump, databasescheduling
ID="IN4321277536"dump database commandrestrictions
MOREINFO="NONE"dump database RestrictionsID="INA4314277537"Dump, databasecross-platform not supportedMARK="BULL" REMAP="BU--Bullet"You cannot load a dump that was made on a different platform or with an earlier version of SQL Server.If a database has cross-database referential integrity constraints, the sysreferences system table stores the name-not the ID number-of the external database. SQL Server cannot guarantee referential integrity if you use MOREINFO="NONE"load database to change the database name or to load it onto a different server.Before dumping a database in order to load it with a different name or move it to anotherSQL Server, use alter table to drop all external referential integrity constraints.You cannot use the MOREINFO="NONE"dump database command in a user-defined transaction.ID="IN4314277538"Dump, databasepermissions problemsIf you issue a MOREINFO="NONE"dump database command on a database where a MOREINFO="NONE"dump transaction is already in progress, the MOREINFO="NONE"dump database command sleeps until the transaction dump completes.When using quarter inch cartridge tape, you can dump only one database or transaction log per tape.Scheduling DumpsID="IN4313277539"Dynamic dumpsMARK="BULL" REMAP="BU--Bullet"SQL Server database dumps are dynamic-they can take place while the database is active. Because it may slow the system down slightly, so you may want to run MOREINFO="NONE"dump MOREINFO="NONE"databaseID="IN4314277540"Dump, databaseacross networks
 when the database is not being heavily updated.Back up the MOREINFO="NONE"master database regularly and frequentlyID="IN4321237941"dump database commandmaster database and
. In addition to your regular backups, dump master after each MOREINFO="NONE"create MOREINFO="NONE"database, alter database, and MOREINFO="NONE"disk init command is issued. Back up the model database each time you make a change to the database.ID="IN4321218142"dump database commandnew databases and
ID="IN4314218143"Dump, databasenew databases andUse MOREINFO="NONE"dump database immediately after creating a database, to make a copy of the entire database. You cannot run MOREINFO="NONE"dump transaction on a new database until you have run MOREINFO="NONE"dump database.Each time you add or remove a cross-database constraint, or drop a table that contains a cross-database constraint, dump both of the affected databases. Loading earlier dumps of these databases could cause database corruption.Develop a regular schedule for backing up user databases and their transaction logs.ID="IN4314218144"Dump, databasethresholds and;Thresholds:database dumps andUse thresholds to automate backup procedures. To take advantage of SQL Server's last-chance threshold, create user databases with a separate log segment. See the System Administration GuideID="IN4314208245"Dump, databasescheduling
 for more information about thresholds.ID="IN4314208246"Dump, databasesystem databases;Dump, transaction log:system databases;System databases:dumpingDumping the System DatabasesID="IN4315188447"master databasetransaction log purgingMARK="BULL" REMAP="BU--Bullet"The master, model, and sybsystemprocsID="IN4316168648"Transaction logsmaster database
 databases do not have a separate segment for their transaction logs. Use MOREINFO="NONE"dump transaction with truncate_onlyID="IN4310168649"Log devicepurging a;Transaction logs:purging
 to purge the log, then MOREINFO="NONE"dump database to back up the database. ID="IN4327148850"Recovery of master databaseThe backups of the master database are needed for recovery procedures in case of a failure that affects the master database. See the System Administration Guide ID="IN4314129051"Dump, databasemodel database
ID="IN4314109252"Dump, databasemaster database
ID="IN435739953"master database recovery. See Recovery of master database
for step-by-step instructions for backing up and restoring the master database. ID="IN4321010254"dump database commanddump devicesSpecifying Dump DevicesMARK="BULL" REMAP="BU--Bullet"You can specify the dump device as a literal, a local variable, or a parameter to a stored procedure. You cannot dump to the "null device" (on UNIX, /dev/null; on OpenVMS, any device name beginning with NL).You can specify a local dump device as:MARK="DASH" REMAP="BS--BulletSub"A logical device name from the sysdevices system tableAn absolute pathnameA relative pathnameREMAP="UN--Under"The Backup Server resolves relative pathnames using SQL Server's current working directory.When dumping across the network, you must specify the absolute pathname of the dump device. The pathname must be valid on the machine on which the Backup Server is running. If the name includes any characters except letters, numbers or the underscore (_), you must enclose it in quotes.Ownership and permissions problems on the dump device may interfere with use of MOREINFO="NONE"dump commands. The MOREINFO="NONE"sp_addumpdevice procedure adds the device to the system tables, but does not guarantee that you can dump to that device or create a file as a dump device. ID="IN4320010255"Number (quantity of)active dumps or loads
ID="IN4321-310556"dump database commanddump devicesYou can run more than one dump (or load) at the same time as long as they use different dump devices.ID="IN4314-310557"Dump, databaseBackup Server andBackup ServersID="IN4316-510758"sysservers tableBackup Server andMARK="BULL" REMAP="BU--Bullet"You must have a Backup Server running on the same machine as your SQL Server. (On OpenVMS systems, the Backup Server can be running in the same cluster as the SQL Server, as long as all database devices are visible to both.) The Backup Server must be listed in the master..sysservers table. This entry is created during installation or upgrade, and should not be deleted.ID="IN4314-510759"Dump, databaseremoteIf your backup devices are located on another machine, so that you dump across a network, you must also have a Backup Server installed on the remote machine.Dump FilesMARK="BULL" REMAP="BU--Bullet"Dumping a database with theMOREINFO="NONE" init option overwrites any existing files on the tape or disk. Dump file names identify which database was dumped and when the dump was made. If you do not specify a file name, Backup Server creates a default file name by concatenating the:MARK="DASH" REMAP="BS--BulletSub"Last seven characters of the database nameTwo digit year numberThree-digit day of the year (1 through 366)Hexadecimal-encoded time at which the dump file was createdREMAP="UN--Under"For example, the file cations930590E100 contains a copy of the publications database made on the fifty-ninth day of 1993: FLOAT="0"FORMAT="UNKNOWN" FILEREF="fig1_1.xwd"LBL="Figure 1-1: "File naming convention for database dumpsThe Backup Server sends the dump file name to the location specified by the MOREINFO="NONE"with notify clause. Before storing a backup tape, the operator should label it with the database name, file name, date, and other pertinent information. When loading a tape without an identifying label, use the MOREINFO="NONE"with headeronly and MOREINFO="NONE"with listonly options to determine the contents.Volume NamesID="IN436-510760"Labelstape;Labels:dump volumesMARK="BULL" REMAP="BU--Bullet"Dump volumes are labeled according to the ANSI tape-labeling standard. The label includes the logical volume number and the position of the device within the stripe set.During loads, Backup Server uses the tape label to verify that volumes are mounted in the correct order. This allows you to load from a smaller number of devices than you used at dump time.When dumping and loading across the network, you must specify the same number of stripe devices for each operation.ID="IN4314-610861"Dump, databasevolume changesID="IN4314-610862"Dump, databasesuccessiveID="IN4321-811063"dump database commandmessagesChanging Dump VolumesMARK="BULL" REMAP="BU--Bullet"On OpenVMS systems, the operating system requests a volume change when it detects the end of a volume or when the specified drive is off-line. After mounting another volume, the operator uses the REPLY command to reply to these messages.On UNIX systems, the Backup Server requests a volume change when the tape capacity has been reached. After mounting another volume, the operator notifies the Backup Server by executing the MOREINFO="NONE"sp_volchanged system procedure on any SQL Server that can communicate with the Backup Server.If the Backup Server detects a problem with the currently mounted volume, it requests a volume change by sending messages to either the client or its operator console. The operator responds to these messages with the MOREINFO="NONE"sp_volchangedID="IN4314-911164"Dump, databasevolume changes
 system procedure.ID="IN4314-1111365"Dump, databaseappending to volume;Dump, database:overwritingAppending to/Overwriting a VolumeMARK="DASH" REMAP="BS--BulletSub"By default (MOREINFO="NONE"noinit), Backup Server writes successive dumps to the same tape volume, making efficient use of high-capacity tape media. Data is added following the last end-of-tape mark. New dumps can be appended only to the last volume of a multi-volume dump. Before writing to the tape, Backup Server verifies that the first file has not yet expired. If the tape contains non-Sybase data, Backup Server rejects it to avoid destroying potentially valuable information. Use the MOREINFO="NONE"init option to reinitialize a volume. If you specify MOREINFO="NONE"init, Backup Server overwrites any existing contents, even if the tape contains non-Sybase data, the first file has not yet expired, or the tape has ANSI access restrictions.LINKEND="X64598"Figure 1-2
 illustrates how to dump three databases to a single volume usingMOREINFO="NONE":MARK="DASH" REMAP="BS--BulletSub"MOREINFO="NONE" init to initialize the tape for the first dump, MOREINFO="NONE"noinit (the default) to append subsequent dumpsMOREINFO="NONE"unload to rewind and unload the tape after the last dumpFLOAT="0"FORMAT="UNKNOWN" FILEREF="fig1_2.xwd"LBL="Figure 1-2: " ID="X64598"Dumping several databases to the same volumeID="IN4314-1511767"Disk mirroringdump database command and
ID="IN4314-1311566"Dump, databaseappending to volume;Dump, database:overwritingDumping Databases Whose Devices Are MirroredMARK="BULL" REMAP="BU--Bullet"At the beginning of a MOREINFO="NONE"dump database, SQL Server passes Backup Server the primary device name of all database and log devices. If the primary device has been unmirrored, SQL Server passes the name of the secondary device instead. If any named device fails before the Backup Server completes its data transfer, SQL Server aborts the dump.If you attempt to unmirror any of the named database devices while a MOREINFO="NONE"dump database is in progressMOREINFO="NONE", SQL Server displays a message. The user executing the MOREINFO="NONE"disk unmirror command can abort the dump or defer the MOREINFO="NONE"disk unmirror until after the dump completes.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"Only the System Administrator, the Database Owner, and users with the Operator role can execute MOREINFO="NONE"dump database.See AlsoCommands     LINKEND="X47924"dump transaction
MOREINFO="NONE", LINKEND="X28090"load database
 LINKEND="X75212"load transactionTopics     LINKEND="X96191"RolesSystem procedures     LINKEND="X96491"sp_addthreshold
MOREINFO="NONE", LINKEND="X85886"sp_addumpdevice
MOREINFO="NONE", LINKEND="X57787"sp_dropdevice
MOREINFO="NONE", LINKEND="X39966"sp_dropthreshold
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
MOREINFO="NONE", LINKEND="X90458"sp_helpdb
MOREINFO="NONE", LINKEND="X52248"sp_helpthreshold
MOREINFO="NONE", LINKEND="X21496"sp_logdevice
MOREINFO="NONE", LINKEND="X50477"sp_spaceused
MOREINFO="NONE", LINKEND="X94792"sp_volchanged
ID="IN4321-1912172"dump database command
ID="IN439-2212473"Databasesdump database command
ID="IN4324-2712974"dump transaction commanddump transaction commandSee also Dump, transaction log!See also
ID="IN4324-3113375"dump transaction commandID="X47924"dump transactionID="IN4412-3413777"Transactionsdump transaction command
Makes a copy of a transaction log and removes the inactive portion.FORMAT="LINESPECIFIC"REMAP="BO--Body"To make a routine log dump:FORMAT="LINESPECIFIC"dump tran[saction] database_name  to stripe_device [ at backup_server_name ]    [density = density_value,      blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file = file_name][stripe on stripe_device [ at backup_server_name ]    [density = density_value,      blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file = file_name]][[stripe on stripe_device [ at backup_server_name ]     [density = density_value,      blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file = file_name] ]...][with {     density = density_value,     blocksize = number_bytes,    capacity = number_kilobytes,     dumpvolume = volume_name,    file = file_name,    [dismount | nodismount],    [nounload | unload],    retaindays = number_days,    [noinit | init],    notify = {client | operator_console}}]REMAP="BO--Body"To truncate the log without making a backup copy:FORMAT="LINESPECIFIC"dump tran[saction] database_name  with truncate_onlyREMAP="BO--Body"To truncate a log that is filled to capacity. Use only as a last resortID="IN4416-3413779"Transaction logsdumping
ID="IN4410-3714080"Log deviceLog deviceSee also Transaction logs!see also
ID="IN4440-4014381"Logs. See Segments; Transaction logs
ID="IN4413-4514882"syslogs tablesyslogs tableSee also Recovery; Transaction logs!see also Recovery; Transaction logs
ID="IN4416-5215583"Transaction logsTransaction logsSee also dump transaction command; syslogs table!see also
:FORMAT="LINESPECIFIC"dump tran[saction] database_name  with no_log REMAP="BO--Body"To back up the log after a database device failMOREINFO="NONE"s:FORMAT="LINESPECIFIC"dump tran[saction] database_name  to stripe_device [ at backup_server_name ]    [density = density_value,      blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file = file_name][stripe on stripe_device [ at backup_server_name ]    [density = density_value,      blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file = file_name]][[stripe on stripe_device [ at backup_server_name ]     [density = density_value,      blocksize = number_bytes,     capacity = number_kilobytes,      dumpvolume = volume_name,     file = file_name] ]...][with {     density = density_value,     blocksize = number_bytes,    capacity = number_kilobytes,     dumpvolume = volume_name,    file = file_name,    [dismount | nodismount],    [nounload | unload],    retaindays = number_days,    [noinit | init],    no_truncate,     notify = {client | operator_console}}]Keywords and OptionsREMAP="RI--RefIndent"database_name - is the name of the database from which you are copying data. The name can be given as a literal, a local variable, or a parameter to a stored procedure.ID="IN4430-5215585"Inactive transaction log spaceinactive space
MOREINFO="NONE"truncate_MOREINFO="NONE"only - removes the inactive part of the log without making a backup copyID="IN445-5215586"Spaceretrieving inactive log;Space:used on the log segment
ID="IN4421-5615987"dump database commandafter using dump transaction with no_log
. Use on databases without separate log segments, Do not specify a dump device or Backup Server name.MOREINFO="NONE"no_log - removes the inactive part of the log without making a backup copy and without recording the procedure in the transaction log. Use MOREINFO="NONE"no_logID="IN445-5615988"Spacerunning out of
 only when you have totally run out of log space and cannot run your usual MOREINFO="NONE"dump transaction command. ID="IN4424-6016389"dump transaction commanddump devices;dump transaction command:dump striping
MOREINFO="NONE"to stripe_deviceID="IN4414-6016390"Name of devicedump device;Dump devices:naming
 - is the ID="IN4412-6216591"Dump devicesdump transaction and
device to which data is being dumped. See LINKEND="X46333""Specifying Dump Devices"
 for information about what form to use when specifying a dump device. See the System Administration Guide Supplement for your platform for a list of supported dump devices.MOREINFO="NONE"at backup_server_name - is the name of the Backup Server. This parameter is optional when dumping to the default Backup Server. When dumping across the network, specify the network name of a remote Backup Server running on the machine to which the dump device is attached. For platforms that use interfaces files, the backup_server_name must appear in the interfaces file.MOREINFO="NONE"density = density_value - overrides the default density for a tape device. Use this option only when reinitializing a volume on OpenVMS systems. Valid densities are 800, 1600, 6250, 6666, 10000, and 38000. Not all values are valid for every tape drive; use the correct density for your tape drive.MOREINFO="NONE"blocksize = number_bytes - overrides the default blocksize for a dump device. (Wherever possible, use the default blocksize; it is the "best blocksize for your system.) The blocksize must be at least one database page (2048 bytes for most systems, 4096 for Stratus) and must be an exact multiple of the database page size. On OpenVMS systems, blocksize cannot exceed 16,384 bytes. ID="IN4424-6416792"dump transaction commandtape capacity
MOREINFO="NONE"capacity = number_kilobytes -  is the maximum amount of data that the device can write to a single tape volume. The capacity must be at least five database pages, and should be slightly less than the recommended capacity for your device. REMAP="UN--Under"OpenVMS systems write until they reach the physical end-of-tape marker, then send a volume change request. On UNIX platforms that cannot reliably detect the end-of-tape marker, you must indicate how many kilobytes can be dumped to the tape. You must supply a MOREINFO="NONE"capacity for dump devices specified as a physical pathname. If a dump device is specified as a logical device name, the Backup Server uses the size parameter stored in the sysdevices system table unless you specify a capacity.ID="IN4424-6616993"dump transaction commandvolume name
MOREINFO="NONE"dumpvolume = volume_name - establishes the name that is assigned to the volume. The Backup Server writes the volume_name in the ANSI tape label when overwriting an existing dump, dumping to a brand new tape, or dumping to a tape whose contents are not recognizable. The MOREINFO="NONE"load MOREINFO="NONE"transaction command checks the label and generates an error message if the wrong volume is loaded.ID="IN4424-6817194"dump transaction commanddump striping
MOREINFO="NONE"stripe on stripe_device - is an additional dump device. You can use up to 32 devices, including the device named in the MOREINFO="NONE"to stripe_device clause. The Backup Server splits the log into approximately equal portions, and sends each portion to a different device. Dumps are made concurrently on all devices, reducing the time and the number of volume changes required. See LINKEND="X46333""Specifying Dump Devices"
 for information about how to specify a dump device.ID="IN4428-7217595"dismount | nodismount optiondump transaction
ID="IN4424-7417796"dump transaction commanddismounting tapes
MOREINFO="NONE"dismount | MOREINFO="NONE"nodismount - on platforms that support logical dismountID="IN4417-7818197"nodismount optiondump transaction
 (such as OpenVMS), determines whether tapes remain mounted. By default, all tapes used for a dump are dismounted when the dump completes. Use MOREINFO="NONE"nodismount to keep tapes available for additional dumps or loads.ID="IN4424-8018398"dump transaction commandrewinding tapes after
MOREINFO="NONE"nounload | MOREINFO="NONE"unload - determines whether tapes rewind after the dump completes. By default, tapes do not rewind, allowing you to make additional dumps to the same tape volume. Specify MOREINFO="NONE"unload for the last dump file to be added to a multi-dump volume. This rewinds and unloads the tape when the dump completes.ID="IN4424-8218599"dump transaction commandexpiration date
MOREINFO="NONE"retaindays = number_days  - on UNIX systems, specifies the number of days that Backup Server protects you from overwriting a dump. This option is meaningful for disk, quarter-inch cartridge, and single-file media. On multi-file media, this option is meaningful for all volumes but the first. If you try to overwrite a dump before it expires, Backup Server requests confirmation before overwriting the unexpired volume. REMAP="UN--Under"The number_days must be a positive integer, or 0 for dumps you can overwrite immediately. If you do not specify a MOREINFO="NONE"retaindays value, Backup Server uses the server-wide "tape retention" value, set by MOREINFO="NONE"sp_configure. ID="IN4424-84187100"dump transaction commandinitializing tape
MOREINFO="NONE" noinit | MOREINFO="NONE"init ID="IN4424-86189101"dump transaction commandappending dumps
- determines whether the dump is appended to existing dump files or reinitializes (overwrites) the tape volume. By default, dumps are appended following the last end-of-tape mark, allowing you to dump additional databases to the same volume. New dumps can be appended only to the last volume of a multi-volume dump. Use MOREINFO="NONE"init for the first database you dump to a tape, to overwrite its contents.ID="IN4424-88191102"dump transaction commandfile name;Dump, transaction log:file name
MOREINFO="NONE"file = file_name - is the name of the dump file. The name cannot exceed 17 characters and must conform to operating system conventions for file names. If you do not specify a file name, Backup Server creates a default file name. For more information, see LINKEND="X16281""Dump Files"
.ID="IN4414-90193103"Device failuredump transaction command after
ID="IN4424-94197104"dump transaction commandwith no_truncate option
MOREINFO="NONE"no_truncate -  dumps a transaction log even if the disk containing the data segments for a database is inaccessible, using a pointer to the transaction log in the master database. The MOREINFO="NONE"with MOREINFO="NONE"no_truncate option provides up-to-the-minute log recovery when the transaction log resides on an undamaged device, and the master database and user databases reside on different physical devices. ID="IN4424-96199105"dump transaction commandmessage destination
MOREINFO="NONE"notify = {MOREINFO="NONE"client |MOREINFO="NONE" operator_console} - overrides the default message destination. MARK="DASH" REMAP="BS--BulletSub"On operating systems (such as OpenVMS) that offer an operator terminal feature, volume change messages are always sent to the operator terminal on the machine on which the Backup Server is running. UseMOREINFO="NONE" client to route other Backup Server messages to the terminal session that initiated the MOREINFO="NONE"dump database.On operating systems (such as UNIX) that do not offer an operator terminal feature, messages are sent to the client that initiated the MOREINFO="NONE"dump database. Use MOREINFO="NONE"operator_console to route messages to the terminal on which the Backup Server is running.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump transaction pubs2to "/dev/nrmt0"REMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump database pubs2to "MTA0:"REMAP="UN--Under"Dumps the transaction log to a tape, appending it to the files on the tape, since the MOREINFO="NONE"init option is not specified. For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump transaction mydbto "/dev/nrmt4" at REMOTE_BKP_SERVERstripe on "/dev/nrmt5" at REMOTE_BKP_SERVERwith init, retaindays = 14REMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"dump transaction mydbto "MTA0:" at REMOTE_BKP_SERVERstripe on "MTA1:" at REMOTE_BKP_SERVERwith initREMAP="UN--Under"Dumps the transaction log for the mydb database, using the Backup Server REMOTE_BKP_SERVER. The Backup Server dumps approximately half of the log to each of the two devices. The MOREINFO="NONE"init option overwrites any existing files on the tape. On UNIX systems, the MOREINFO="NONE"retaindays option specifies that the tapes cannot be overwritten for fourteen days. (OpenVMS systems do not use MOREINFO="NONE"retaindays; they always create new versions of dump files.) CommentsCommands Used to Back Up DatabasesREMAP="BO--Body"LINKEND="X23427"Table 1-12
 describes the commands and system procedures used to back up databases:TOCENTRY="1"LBL="Table 1-13: "Commands used to back up logs and databasesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="11*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Use This CommandCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ToVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Make routine dumps of the entire 
database, including the transaction logCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Make routine dumps of the transaction 
log (the system table, syslogs), then 
truncate the inactive portionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transaction with no_truncate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dump the transaction log after failure of a 
database deviceCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transaction with 
truncate_onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Truncate the log without making a 
backup COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Then copy the entire databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transaction with no_logCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Truncate the log after your usual method 
fails due to insufficient log spaceCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Then copy the entire databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Respond to the Backup Server's volume 
change messagesdump transaction RestrictionsMARK="BULL" REMAP="BU--Bullet"You cannot load a dump that was made on a different platform or with an earlier version of SQL Server.You cannot dump to the "null device" (on UNIX, /dev/null; on OpenVMS, any device name beginning with NL).You cannot use the MOREINFO="NONE"dump transaction command in a transaction.When using quarter inch cartridge tape, you can dump only one database or transaction log per tape.You cannot issue a MOREINFO="NONE"dump transaction to a device while theID="IN4416-104207108"Transaction logssyslogs table trunc log on chkpt;dump transaction command:trunc log on chkpt and
MOREINFO="NONE" trunc log on chkpt database option is enabled, or after enabling ID="IN4424-112215109"dump transaction commandselect into/bulkcopy and;select into/bulkcopy database option:dump transaction and
MOREINFO="NONE"select into/bulk copy and making unlogged changes to the database with MOREINFO="NONE"select into, "fast" bulk copy operations, or default unlogged MOREINFO="NONE"writetext operations. Use MOREINFO="NONE"dump database instead. Never modify the log table syslogs with a deleteMOREINFO="NONE", update, or insert command.If a database does not have a separate log segment, you cannot useID="IN4416-112215110"Transaction logsTransaction logstransfer;Transfer:transaction log;Transaction logs:on a separate deviceseparate device
MOREINFO="NONE" dump transaction to copy the log and truncate it. ID="IN4421-112215111"Dump, transaction logpermissions problemsIf a user or threshold procedure issues a MOREINFO="NONE"dump transaction command on a database where a MOREINFO="NONE"dump database or another MOREINFO="NONE"dump transaction is in progress, the second command sleeps until the first completes.To restore a database, use MOREINFO="NONE"load database to load the most recent database dump, thenMOREINFO="NONE" load transaction to load each subsequent transaction log dump in the order in which it was made. ID="IN4414-112215112"Dump, databasecommands used for;Dump, transaction log:command used for
ID="IN4414-114217113"Device failuredump transaction command after
Each time you add or remove a cross-database constraint, or drop a table that contains a cross-database constraint, dump both of the affected databases. Loading earlier dumps of these databases could cause database corruption.ID="IN4424-118221114"dump transaction commandwith no_truncate optionCopying the Log After Device Failure: MOREINFO="NONE"with no_truncateMARK="BULL" REMAP="BU--Bullet"After device failure, use MOREINFO="NONE"dump transaction with no_truncate to copy the log without truncating it. You can use this option only if your log is on a separate segment and your master database is accessible.The backup created by MOREINFO="NONE"dump transaction with no_truncate is the most recent dump for your log. When restoring the database, load this dump last.ID="IN4424-123226115"dump transaction commandwith truncate_only optionDatabases Without Separate Log Segments: MOREINFO="NONE"with truncate_onlyMARK="BULL" REMAP="BU--Bullet"When a database does not have a separate log segment, use MOREINFO="NONE"dump transaction with truncate_onlyID="IN4415-125228116"master databasebacking up
 to remove committed transactions from the log without making a backup copy. dump transaction with truncate_only provides no means to recover your databases. Run dump database at the earliest opportunity to ensure recoverability.ID="IN4424-130233117"dump transaction commandwith truncate_only optionID="IN4415-132235118"master databasetransaction log purgingUse MOREINFO="NONE"with truncate_only on the master, model, and sybsystemprocsID="IN4416-134237119"Transaction logsmaster database
 databases, which do not have a separate log segment.You can also use this option on very small databases, which can store the transaction log and data on the same device. ID="IN449-134237120"Databasescreating with separate log segmentMission-critical user databases should have a separate log segment. Use the MOREINFO="NONE"log MOREINFO="NONE"on clause of MOREINFO="NONE"create database to create a database with a separate log segment, or MOREINFO="NONE"alter database and MOREINFO="NONE"sp_logdeviceID="IN4416-134237121"Transaction logsplacing on separate segment
 to transfer the log to a separate device. ID="IN4424-139242122"dump transaction commandwith no_log option
ID="IN4424-142245123"dump transaction commandinsufficient log space
ID="IN4416-142245124"Transaction logsinsufficient spaceWhen All Else Fails: MOREINFO="NONE"with no_logMARK="BULL" REMAP="BU--Bullet"Use MOREINFO="NONE"dump transaction with no_log only as a last resort, after your usual method of dumping the transaction log (MOREINFO="NONE"dump transaction or MOREINFO="NONE"dump transaction with truncate_only) fails because of insufficient log space.MOREINFO="NONE"dump transaction with no_log truncates the log without logging the dump transaction event. Because it copies no data, it requires only the name of the database.Every use of MOREINFO="NONE"dump transaction... with no_log is considered an error, and is recorded in the server's error log.dump transaction with no_log provides no means to recover your databases. Run dump database at the earliest opportunity to ensure recoverability.If you have created your databases with separate log segments, written a last-chance threshold procedure that dumps your transaction log often enough, and allocated enough space to your log and database, you should not have to use this option. If you must use MOREINFO="NONE"with no_log, increase the frequency of your dumps and the amount of log spID="IN4424-145248125"dump transaction commandinsufficient log space
ace.ID="IN4424-150253126"dump transaction commandwith no_log option
ID="IN4421-151254127"Dump, transaction logschedulingScheduling DumpsID="IN4413-151254128"Dynamic dumpsMARK="BULL" REMAP="BU--Bullet" Transaction log dumps are dynamic-they can take place while the database is active. Because it may slow the system downID="IN4421-151254129"Dump, transaction logacross networks
 slightly, so you may want to run dumps when the database is not being heavily updated.Use MOREINFO="NONE"dump database immediately after creating a database, to make a copy of the entire database. You cannot run MOREINFO="NONE"dump transaction on a new database until you have run MOREINFO="NONE"dump database.Develop a regular schedule for backing up user databases and their transaction logs.ID="IN448-153256130"Recoverydump transaction and
ID="IN447-156259131"BackupsBackupsSee also Dump, database; Dump, transaction log; Load, database; Load, transaction log!See alsoID="IN4414-160263132"Speed (Server)Speed (Server)of dump transaction compared to dump databasedump transaction compared to dump database
MOREINFO="NONE"dump transaction uses less storage space and takes less time than MOREINFO="NONE"dump database.ID="IN4421-161264133"Dump, transaction logscheduling
 Transaction log dumps are typically made more frequently than database dumps.ID="IN4410-161264134"Thresholdstransaction log dumps and;Dump, transaction log:thresholds andUsing Thresholds to Automate dump transactionMARK="BULL" REMAP="BU--Bullet"Use thresholds to automate backup procedures. To take advantage of SQL Server's last-chance threshold, create user databases with a separate log segment.When space on the log segment falls below the last-chance threshold, SQL Server executes the last-chance threshold procedure. Including a MOREINFO="NONE"dump transaction command in your last-chance threshold procedure helps protect you from running out of log space. For more information, see LINKEND="X67172"sp_thresholdaction
 in Volume 2.ID="IN4416-161264135"Transaction logsspace, monitoringYou can use MOREINFO="NONE"sp_addthreshold to add a second threshold to monitor log space. For more information about thresholds, see the System Administration Guide.ID="IN4412-162265136"Dump devicesnamingID="X46333"Specifying Dump DevicesMARK="BULL" REMAP="BU--Bullet"You can specify the dump device as a literal, a local variable, or a parameter to a stored procedure. You can specify a local dump device as:MARK="DASH" REMAP="BS--BulletSub"A logical device name from the sysdevices system tableAn absolute pathnameA relative pathnameREMAP="UN--Under"The Backup Server resolves relative pathnames using SQL Server's current working directory.When dumping across the network, you must specify the absolute pathname of the dump device. The pathname must be valid on the machine on which the Backup Server is running. If the name includes any characters except letters, numbers or the underscore (_), you must enclose it in quotes.Ownership and permissions problems on the dump device may interfere with use of MOREINFO="NONE"dump commands. The MOREINFO="NONE"sp_addumpdevice procedure adds the device to the system tables, but does not guarantee that you can dump to that device or create a file as a dump device. ID="IN4420-162265137"Number (quantity of)active dumps or loads
ID="IN4412-163266138"Dump devicesnamingYou can run more than one dump (or load) at the same time as long as they use different dump devices.ID="IN4421-165268139"Dump, transaction logremote;dump transaction command:Backup Server, remoteBackup ServersID="IN4416-167270140"sysservers tableBackup Server andMARK="BULL" REMAP="BU--Bullet"You must have a Backup Server running on the same machine as your SQL Server. (On OpenVMS systems, the Backup Server can be running in the same cluster as the SQL Server, as long as all database devices are visible to both.) The Backup Server must be listed in the master..sysservers table. This entry is created during installation or upgrade, and should not be deleted.If your backup devices are located on another machine, so that you dump across a network, you must also have a Backup Server installed on the remote machine.ID="IN4424-171274141"dump transaction commandfile name;Dump, transaction log:file nameID="X16281"Dump FilesMARK="BULL" REMAP="BU--Bullet"Dumping a log with theMOREINFO="NONE" init option overwrites any existing files on the tape or disk. Dump file names identify which database was dumped and when the dump was made. If you do not specify a file name, Backup Server creates a default file name by concatenating the:MARK="DASH" REMAP="BS--BulletSub"Last seven characters of the database nameTwo digit year numberThree-digit day of the year (1 through 366)Hexadecimal-encoded time at which the dump file was createdREMAP="UN--Under"For example, the file cations930590E100 contains a copy of the publications database made on the fifty-ninth day of 1993:FLOAT="0"FORMAT="UNKNOWN" FILEREF="fig1_3.xwd"LBL="Figure 1-3: "File naming convention for transaction log dumpsThe Backup Server sends the dump file name to the location specified by the MOREINFO="NONE"with notify clause. Before storing a backup tape, the operator should label it with the database name, file name, date, and other pertinent information. When loading a tape without an identifying label, use the MOREINFO="NONE"with headeronly and MOREINFO="NONE"with listonly options to determine the contents.ID="IN4424-175278142"dump transaction commandfile name;Dump, transaction log:file name
ID="IN4424-177280143"dump transaction commandvolume nameVolume NamesMARK="BULL" REMAP="BU--Bullet"Dump volumes are labeled according to the ANSI tape-labeling standard. The label includes the logical volume number and the position of the device within the stripe set.During loads, Backup Server uses the tape label to verify that volumes are mounted in the correct order. This allows you to load from a smaller number of devices than you used at dump time.ID="IN4421-177280144"Dump, transaction logremoteWhen dumping and loading across the network, you must specify the same number of stripe devices for each operation.ID="IN4414-177280145"Dump, databasesuccessiveID="IN4421-179282146"dump database commandmessagesChanging Dump VolumesMARK="BULL" REMAP="BU--Bullet"On OpenVMS systems, the operating system requests a volume change when it detects the end of a volume or when the specified drive is off-line. After mounting another volume, the operator uses the REPLY command to reply to these messages.On UNIX systems, the Backup Server requests a volume change when the tape capacity has been reached. After mounting another volume, the operator notifies the Backup Server by executing the MOREINFO="NONE"sp_volchanged system procedure on any SQL Server that can communicate with the Backup Server.If the Backup Server detects a problem with the currently mounted volume (for example, the wrong volume is mounted), it requests a volume change by sending messages to either the client or its operator console. The operator responds to these messages with the MOREINFO="NONE"sp_volchanged system procedure.ID="IN4421-181284147"Dump, transaction logappending to volume;Dump, transaction log:initializing volumeAppending to/Overwriting a VolumeMARK="DASH" REMAP="BS--BulletSub"By default (MOREINFO="NONE"noinit), Backup Server writes successive dumps to the same tape volume, making efficient use of high-capacity tape media. Data is added following the last end-of-tape mark. New dumps can be appended only to the last volume of a multi-volume dump. Before writing to the tape, Backup Server verifies that the first file has not yet expired. If the tape contains non-Sybase data, Backup Server rejects it to avoid destroying potentially valuable information. Use the MOREINFO="NONE"init option to reinitialize a volume. If you specify MOREINFO="NONE"init, Backup Server overwrites any existing contents, even if the tape contains non-Sybase data, the first file has not yet expired, or the tape has ANSI access restrictions.LINKEND="X35965"Figure 1-4
 illustrates how to dump three transaction logs to a single volume. Use:MARK="DASH" REMAP="BS--BulletSub"MOREINFO="NONE"init to initialize the tape for the first dump.MOREINFO="NONE"noinit (the default) to append subsequent dumpsMOREINFO="NONE"unload to rewind and unload the tape after the last dumpFLOAT="0"FORMAT="UNKNOWN" FILEREF="fig1_4.xwd"LBL="Figure 1-4: " ID="X35965"Dumping three transaction logs to a single volume ID="IN4414-186289149"Disk mirroringdump transaction command and
ID="IN4421-183286148"Dump, transaction logappending to volume;Dump, transaction log:initializing volumeDumping Logs Stored on Mirrored DevicesMARK="BULL" REMAP="BU--Bullet"At the beginning of a MOREINFO="NONE"dump transaction, SQL Server passes the primary device name of each logical log device to the Backup Server. If the primary device has been unmirrored, SQL Server passes the name of the secondary device instead. If the named device fails before Backup Server completes its data transfer, SQL Server aborts the dump.If you attempt to unmirror a named log device while a MOREINFO="NONE"dump transaction is in progressMOREINFO="NONE", SQL Server displays a message. The user executing the MOREINFO="NONE"disk unmirror command can abort the dump or defer the MOREINFO="NONE"disk unmirror until after the dump completes.MOREINFO="NONE"dump transaction with truncate_only and MOREINFO="NONE"dump transaction with no_log do not use the Backup Server. These commands are not affected when a log device is unmirrored, either by a device failure or by a MOREINFO="NONE"disk unmirror command.MOREINFO="NONE"dump transaction copies only the log segment. It is not affected when a data-only device is unmirrored, either by a device failure or by a MOREINFO="NONE"disk unmirror command.ID="IN4414-189292150"Disk mirroringdump transaction command andStandards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"Only System Administrators, users who have been granted the Operator role, and the Database Owner can execute MOREINFO="NONE"dump transaction. See AlsoCommands     LINKEND="X68345"dump database
MOREINFO="NONE",LINKEND="X28090"load database
MOREINFO="NONE",LINKEND="X75212"load transactionTopics     LINKEND="X96191"RolesSystem procedures     LINKEND="X85886"sp_addumpdevice
MOREINFO="NONE", LINKEND="X29657"sp_dboption
MOREINFO="NONE", LINKEND="X57787"sp_dropdevice
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
MOREINFO="NONE", LINKEND="X21496"sp_logdevice
MOREINFO="NONE", LINKEND="X94792"sp_volchangedID="X30305"executeID="IN433290124"Running a procedure with execute
ID="IN434189135"User-defined stored procedures, executing
ID="IN431788146"Stored proceduresexecuting
Runs a system procedure or a user-defined stored procedure. FORMAT="LINESPECIFIC"[execute] [@MOREINFO="NONE"return_status = ][[[server.]MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"procedure_name[;number]     [[@parameter_name =] MOREINFO="NONE"value |         [@MOREINFO="NONE"parameter_name =] @variable [output]    [,[@MOREINFO="NONE"parameter_name =] MOREINFO="NONE"value |         [@MOREINFO="NONE"parameter_name =] @variable [output]...]] [with recompile] Keywords and OptionsREMAP="RI--RefIndent"MOREINFO="NONE"execute - is used to execute a stored procedure. It is only necessary if the stored procedure call is notID="INA4316861610"Batch processingexecute
 the first statement in a batch. ID="IN4313861611"Return statusstored procedure;Stored procedures:return status
@return_status - is an optional integer variable that stores the return status of a stored procedure. It must be declared in the batch or stored procedure before it is used in an execute statement. procedure_name - is the name of a procedure that has been defined with a MOREINFO="NONE"create procedure statement. You can execute a procedure in another database as long as you are its owner or have permission to execute it in that database. You can execute a procedure on another SQL Server as long as you have permission to use that server and to execute the procedure in that database. REMAP="UN--Under"If you specify a server name, but do not specify a database name, SQL Server looks for the procedure in your default database. The owner name is optional only if the Database Owner ("dbo") owns the procedure or if you own it. ;number ID="INA437861612"Numberssame name group procedure
ID="IN4322841813"drop procedure commandgrouped procedures and
- is an optional integer used to group procedures of the same name so that they can be dropped together with a single MOREINFO="NONE"drop procedureID="IN4317841814"Stored proceduresgrouping;Grouping:procedures of the same name;Procedure groups
 statement. Procedures used in the same application are often grouped this way. For example, if the procedures used with the application orders are named orderproc;1, orderproc;2, and so on, the statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop proc orderproc REMAP="UN--Under"drops the entire group. Once procedures have been grouped, individual procedures within the group cannot be dropped. For example, you cannot execute the statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"drop procedure orderproc;2 parameter_name - is the name of an argument to the procedure, as defined in the MOREINFO="NONE"create procedureID="IN4313841815"@ (at symbol)procedure arguments and;At symbol (@):procedure arguments and
 statement. Parameter names must be preceded by the "@" symbol. ID="IN4321822016"Parameters, procedureexecute andREMAP="UN--Under"If the "@parameter_name = value" form is used, parameter names and constants need not be supplied in the order defined in the MOREINFO="NONE"create procedure statement. However, if this form is used for any parameter, it must be used for all subsequent parameters. ID="IN436822017"Valuesprocedure parameter or argument;Parameters, procedure:ways to supply
value ID="IN4324802218"create procedure commandorder of parameters in
ID="IN435782419"OrderOrderof parameters in create procedureparameters in create procedure
- is the value of the parameter or argument to the procedure. If you do not use parameter names, parameter values must be supplied in the order defined in the MOREINFO="NONE"create procedure statement.ID="IN4324762620"create procedure commandorder of parameters inREMAP="UN--Under"If a default is defined in the MOREINFO="NONE"create procedureID="IN4319742821"Wildcard charactersWildcard charactersin a like match stringlike match string
 statement, a user can execute the procedure without giving a parameter. The default must be a constant. It can include the wildcard characters (%, _ , [], and [^]) if the procedure uses the parameter name with the keyword MOREINFO="NONE"like. See Example 2 in the MOREINFO="NONE"create procedure section. REMAP="UN--Under"The default can be NULL. Usually, the procedure definition specifies what action should be taken if a parameter value is NULL. @variable - is the name of a variable used to store a return parameter. ID="IN4313683422"output optioncreate procedure;output option:return parameter
MOREINFO="NONE"output ID="IN4313643823"output optionexecute
ID="IN4317624024"Return parametersoutput keyword
- indicates that the stored procedure is to return a return parameter. The matching parameter in the stored procedure must also have been created with the keyword MOREINFO="NONE"output. ID="IN4313604225"Recompilationexecute with recompile option
ID="IN4321564626"with recompile optionexecute
MOREINFO="NONE"with MOREINFO="NONE"recompile - forces compilation of a new plan. Use this option if the parameter you're supplying is atypical or if the data has significantly changed. The changed plan is used on subsequent executions.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"execute showind titles REMAP="UN--Under"or:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"exec showind @tabname = titles REMAP="UN--Under"or, if this is the only statement in a batch or file: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"showind titles REMAP="UN--Under"All three examples above execute the stored procedure showind with a parameter value titles. declare @retstat int execute @retstat = GATEWAY.pubs.dbo.checkcontract "409-56-4008" REMAP="UN--Under"Executes the stored procedure checkcontract on the remote server GATEWAY. Stores the return status indicating success or failure in @retstat. declare @percent int select @percent = 10 execute roy_check "BU1032", 1050, @pc = @percent output select Percent = @percent REMAP="UN--Under"Executes the stored procedure roy_check, passing three parameters. The third parameter, @pc, is an MOREINFO="NONE"output parameter. After execution of the procedure, the return value is available in the variable @percent. CommentsID="IN4321564629"Parameters, procedureways to supplyMARK="BULL" REMAP="BU--Bullet"There are two ways to supply parameters-by position, or by using:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"parameter_nameMOREINFO="NONE" = valueMOREINFO="NONE" ID="IN4324525030"create procedure commandOrderorder of parameters in;Order:of parameters in create procedureparameters in create procedure
ID="IN4324505231"create procedure commandorder of parameters inREMAP="UN--Under"If you use the second form, you do not have to supply the parameters in the order defined in the MOREINFO="NONE"create procedure statement. ID="IN439505232"Variablesreturn values andREMAP="UN--Under"If you are using the MOREINFO="NONE"output keyword and intend to use the return parameters in additional statements in your batch or procedure, the value of the parameter must be passed as a variable, for example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"parameter_name = @variable_name You cannot use text and image columns as parameters to stored procedures or as values passed to parameters.ID="IN4313465633"output optioncreate procedureIt is an error to execute a procedure specifying MOREINFO="NONE"output for a parameter that is not defined as a return parameter in the MOREINFO="NONE"create procedure statement. ID="IN439465634"Constantsreturn parameters in place ofYou cannot pass constants to stored procedures using MOREINFO="NONE"output; the return parameter requires a variable name. You must declare the variable's datatype and assign it a value before executing the procedure. Return parameters cannot have a datatype of text or image. ID="IN4316445835"Batch processingexecuteIt is not necessary to use the keyword MOREINFO="NONE"execute if the statement is the first one in a batch. A batch is a segment of an input file terminated by the word "go" on a line by itself. ID="IN4314426036"Speed (Server)executeSince the execution plan for a procedure is stored the first time it is run, subsequent run time is much shorter than for the equivalent set of stand-alone statements. ID="IN437426037"Nestingstored procedures;Stored procedures:nestingNesting occurs when one stored procedure calls another. The nesting level is incremented when the called procedure begins execution and it is decremented when the called procedure completes execution. Exceeding the maximum of 16 levels of nesting causes the transaction to fail. The current nesting level is stored in the @@nestlevelID="IN436386438"LevelsLevels@@nestlevel;@@nestlevel global variable[atatnestlevel global variable;nestlevel global variable]nestlevel
 global variable. ID="IN436386439"Statusstored procedures execution;Stored procedures:execution status ofReturn values 0 and -1 through -14 are currently used by SQL Server to indicate the execution status of stored procedures. Values from -15 to -99 are reserved for future use. See LINKEND="X44808"return
 for a list of values. ID="IN4321386440"Parameters, procedurenot part of transactions;Transactions:parameters not part of
ID="IN4319386441"Roll back processesparameter values andParameters are not part of transactions, so if a parameter is changed in a transaction which is later rolled back, its value does not revert to its previous value. The value that is returned to the caller is always the value at the time the procedure returns. If you use MOREINFO="NONE"select * in your MOREINFO="NONE"create procedure statement, the procedure does not pick up any new columns you may have added to the table (even if you use the with recompile option to execute). You must MOREINFO="NONE"drop the procedure and recreate it. ID="IN4322366642"Remote procedure callsexecute andCommands executed via remote procedure calls cannot be rolled back. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"execute permission defaults to the owner of the stored procedure, who can transfer it to other users. See AlsoCommands     LINKEND="X52197"create procedure
MOREINFO="NONE", LINKEND="X21497"drop procedure
MOREINFO="NONE", LINKEND="X44808"returnTopics     LINKEND="X72999"Parameters
,LINKEND="X44102"Variables (Local and Global)
, LINKEND="X18218"Wildcard CharactersSystem procedures     LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X25756"sp_helptext
ID="IN4317336946"Stored proceduresexecute
ID="IN4315297347"execute command
ID="IN4317287448"Stored proceduresexecuting
ID="IN4332257749"Running a procedure with execute
ID="IN4341247850"User-defined stored procedures, executing
ID="IN4313208251"fetch commandID="X18078"fetchID="IN447188553"Cursorsfetch
ID="IN4417188554"Cursor result setreturning rows;Returning rows, cursor result set
Returns a row or a set of rows from a cursor result set.ID="IN447168756"CursorsfetchSyntaxREMAP="SY--Syntax" FORMAT="LINESPECIFIC"fetch cursor_name [ into fetch_target_list ]ParametersREMAP="RI--RefIndent"cursor_name - the name of the cursorID="IN4412129159"into keywordfetch
MOREINFO="NONE"into fetch_target_list - is a comma-separated list of parameters or local variables into which cursor results are placed. The parameters and variables must be declared prior to the MOREINFO="NONE"fetch.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"fetch authors_crsrREMAP="UN--Under"Returns a row of information from the cursor result set defined by the authors_crsr cursor.MOREINFO="NONE"fetch pubs_crsr into @name, @city, @stateREMAP="UN--Under"Returns a row of information from the cursor result set defined by the pubs_crsr cursor into the variables @name, @city, and @state.CommentsRestrictionsMARK="BULL" REMAP="BU--Bullet"Before you can use MOREINFO="NONE"fetch, you must declare the cursor and MOREINFO="NONE"open it.The cursor_name cannot be a Transact-SQL parameter or local variable.You cannot MOREINFO="NONE"fetch a row that has already been fetched. There is no way to backtrack through the result set. But you can close and re-open the cursor to create the cursor result set again and start from the beginning.ID="IN449129162"Datatypescursor result set and;Cursor result set:datatypes and;Cursors:datatype compatibilitySQL Server expects a one-to-one correspondence between the variables in the fetch_target_list and the target list expressions specified by the select_statement that defines the cursor. The datatypes of the variables or parameters must be compatible with the datatypes of the columns in the cursor result set.ID="IN4424109363"Chained transaction modefetch and
ID="IN441289564"Transactionsfetch andWhen you set chained transaction mode, SQL Server implicitly begins a transaction with the MOREINFO="NONE"fetch statement if no transaction is currently active. However, this situation occurs only when you set the MOREINFO="NONE"close on endtran option and the cursor remains open after the end of the transaction that initially opened it, since the MOREINFO="NONE"open statement also automatically begins a transaction.Cursor PositionMARK="BULL" REMAP="BU--Bullet"After you MOREINFO="NONE"fetch all the rows, the cursor points to the last row of the result set. If you MOREINFO="NONE"fetch again, SQL Server returns a warning through the @@sqlstatus variable (described below) indicating there is no more data, and the cursor position moves beyond the end of the result set. You can no longer MOREINFO="NONE"update or MOREINFO="NONE"delete from that current cursor position.With MOREINFO="NONE"fetch into, SQL Server does not advance the cursor position if an error occurs because the number of variables in the fetch_target_list does not equal the number of target list expressions specified by the query that defines the cursor. However, it does advance the cursor position even if a compatibility error occurs between the datatypes of the variables and the datatypes of the columns in the cursor result set.Determining How Many Rows Are FetchedMARK="BULL" REMAP="BU--Bullet"You can MOREINFO="NONE"fetch one or more rows at a time. Use the MOREINFO="NONE"cursor rows option of the MOREINFO="NONE"set command to specify the number of rows to MOREINFO="NONE"fetch.Getting Information About FetchesMARK="BULL" REMAP="BU--Bullet"The ID="IN442749965"@@sqlstatus global variablesqlstatus global variablefetch andfetch and;atatsqlstatus global variable:fetch and
@@sqlstatus global variable holds status information (warning exceptions) resulting from the execution of a MOREINFO="NONE"fetch statement. The value of @@sqlstatus is 0, 1, or 2. TOCENTRY="1"LBL="Table 1-14: "@@sqlstatus valuesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="2*"COLNAME="C2" COLWIDTH="17*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"indicates successful completion of the MOREINFO="NONE"fetch statement.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"indicates that the MOREINFO="NONE"fetch statement resulted in an error.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"indicates that there is no more data in the result set. This warning 
can occur if the current cursor position is on the last row in the 
result set and the client submits a MOREINFO="NONE"fetch statement for that cursor.Only a MOREINFO="NONE"fetch statement can set @@sqlstatus. All other statements have no effect on @@sqlstatus.TheID="IN4426010366"@@rowcount global variablerowcount global variablefetch andfetch and;atatrowcount global variable:fetch and
 @@rowcount global variable holds the number of rows returned from the cursor result set to the client up to the last MOREINFO="NONE"fetch. In other words, it represents the total number of rows seen by the client at any one point in time. REMAP="UN--Under"Once all the rows have been read from the cursor result set, @@rowcount represents the total number of rows in the cursor results set. Each open cursor is associated with a specific @@rowcount variable, which is dropped when you close the cursor. Check @@rowcount after a MOREINFO="NONE"fetch to get the number of rows read for the cursor specified in that MOREINFO="NONE"fetch.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliant COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The use of variables in a target list 
and fetch of multiple rows are 
Transact-SQL extensions.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PermissionsREMAP="BO--Body"MOREINFO="NONE"fetch permission defaults to all users.See AlsoCommands     LINKEND="X11816"declare cursor
, LINKEND="X29776"open
, LINKEND="X64136"setTopics     LINKEND="X80039"Cursors
, LINKEND="X19352"Transactions
ID="IN4412-410771"goto keywordID="X60287"goto LabelID="IN459-410873"Branchingto label, unconditional;Unconditional branching to a user-defined label
ID="IN456-611074"Labelsgoto label
Branches to a user-defined label. FORMAT="LINESPECIFIC"MOREINFO="NONE"label:  goto MOREINFO="NONE"labelExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"declare @count smallint select @count = 1 restart:   print "yes" select @count = @count + 1 while @count <=4   goto restartMOREINFO="NONE" CommentsMARK="BULL" REMAP="BU--Bullet"The label name must conform to the rules for identifiers and must be followed by a colon (:) when it is declared. It is not followed by a colon when it is used with MOREINFO="NONE"goto. ID="IN455-811278"Loopsgoto labelThe MOREINFO="NONE"goto is usually made dependent on an MOREINFO="NONE"if or MOREINFO="NONE"while test, or some other condition, in order to avoid an endless loop between MOREINFO="NONE"goto and the label. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommandsLINKEND="X74736"if...else,LINKEND="X37548"while
ID="IN4512-1211682"goto keyword
 Topics     LINKEND="X12929"Control-of-Flow LanguageID="X69087"grantID="IN4613-1612183"grant command
ID="IN4618-2212785"Object permissionsgrant;Permissions:grant
ID="IN4619-2513086"Command permissionsgrant assignment of
ID="IN4619-2813387"Command permissionsCommand permissionsSee also Object permissions; Permissions!see also Object permissions; Permissions
ID="IN4615-3113688"Database OwnersDatabase OwnersSee also Database object owners; Permissions!see also
ID="IN4618-3413989"Object permissionsObject permissionsSee also Command permissions; Permissions!see also Command permissions; Permissions
ID="IN469-3914490"OwnershipOwnershipSee also Permissions; setuser command!see also
ID="IN4627-4214791"Privileges. See Permissions
ID="IN468-4515092"SecuritySecuritySee also Permissions!see also Permissions
ID="IN4654-4815393"User permissions. See Database Owners; Permissions
ID="IN4634-5115694"Access. See Permissions; Users
ID="IN4626-5415995"Authority. See Permissions
ID="IN4622-5716296"Database object ownersDatabase object ownersSee also Database Owners; Ownership!see also Database Owners; Ownership
ID="IN4641-6016597"Hierarchy of permissions. See Permissions
Assigns permissions to users. FORMAT="LINESPECIFIC"REMAP="BO--Body"To grant permission to access database objects:FORMAT="LINESPECIFIC"MOREINFO="NONE"grant {all [privileges]| MOREINFO="NONE"permission_list} on {MOREINFO="NONE" table_name [(MOREINFO="NONE"column_list)]    |MOREINFO="NONE" view_name[(MOREINFO="NONE"column_list)]     | stored_MOREINFO="NONE"procedure_name}to {public | MOREINFO="NONE"name_list | role_name}[with grant option]REMAP="BO--Body"To grant permission to create database objects:FORMAT="LINESPECIFIC"MOREINFO="NONE"grant {all [privileges] | MOREINFO="NONE"command_list} to {public | MOREINFO="NONE"name_list | role_name} Keywords and OptionsREMAP="RI--RefIndent"ID="IN4611-64169100"all keywordgrant
MOREINFO="NONE"all - when used to assign permission to access database objects (the first syntax format), MOREINFO="NONE"all specifies that all permissions applicable to the specified object are granted. All object owners can use MOREINFO="NONE"grant all with an object name to grant permissions on their own objects.ID="IN4611-64169101"Permissionsassigning
ID="IN4615-64169102"Database Ownerspermissions granted by;Permissions:assigned by Database Owner
ID="IN4641-67172103"Object owners. See Database object owners
ID="IN4655-70175104"Owners. See Database object owners; Database OwnersREMAP="UN--Under"Only a System Administrator or the Database Owner can assign permission to create database objects (the second syntax format). When used by a System Administrator, MOREINFO="NONE"grant MOREINFO="NONE"all assigns all MOREINFO="NONE"create permissions (MOREINFO="NONE"create database, create default, create procedure, create rule, create table, andMOREINFO="NONE" create view). When the Database Owner uses MOREINFO="NONE"grant MOREINFO="NONE"all, SQL Server grants all MOREINFO="NONE"create permissions except MOREINFO="NONE"create database, and prints an informational message. permission_list - is a list of object access permissions granted. If more than one permission is listed, separate them with commas. The following table illustrates the access permissions that can be granted on each type of objectTOCENTRY="1"LBL="Table 1-15: "Object access permissionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="2*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ObjectCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"permission_list Can Include:VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table or viewCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select, insert, delete, update, referencesCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"columnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select, update, references  
Column names can be specified in either 
permission_list or column_list (see example 2).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"stored procedureCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"executecommand_list - is a list of object creation permissions to be granted. If more than one command is listed, separate them with commas. The command list can include MOREINFO="NONE"create database, MOREINFO="NONE"create default, MOREINFO="NONE"create procedure, MOREINFO="NONE"create rule, MOREINFO="NONE"create table, and MOREINFO="NONE"create MOREINFO="NONE"view. MOREINFO="NONE"create database permission can only be granted by a System Administrator, and only from within the master database.table_name - is the name of the table on which you are granting permissions. The table must be in your current database. Only one object can be listed for each MOREINFO="NONE"grant statement. ID="IN467-72177105"Columnsgrant
column_list - is a list of columns, separated by commas, to which the permissions apply. If columns are specified, only MOREINFO="NONE"select, MOREINFO="NONE"references, and MOREINFO="NONE"update permissions can be granted.view_name - is the name of the view on which you are granting permissions. The view must be in your current database. Only one object can be listed for each MOREINFO="NONE"grant statement. stored _procedure_name - is the name of the stored procedure on which you are granting permissions. The stored procedure must be in your current database. Only one object can be listed for each MOREINFO="NONE"grant statement. ID="IN4614-75180106""public" grouppublic groupSee also Groups!see also Groups
ID="IN466-78183107"GroupsGroupsSee also "public" group!see also public groupID="IN4614-82187108"public keywordgrant
ID="IN4614-84189109""public" grouppublic groupgrant andgrant and
MOREINFO="NONE"public - is all users. For object access permissions, MOREINFO="NONE"public excludes the object owner. For object creation permissions, MOREINFO="NONE"public excludes the Database Owner (who "owns" object creation permissions within the database). You cannot MOREINFO="NONE"grant permissions MOREINFO="NONE"with grant option to "public" or to other groups or roles.name_list - is a list of users' database names and/or group names, separated by commas. ID="IN465-84189110"Rolesgranting
ID="IN4613-86191111"grant commandgrant commandand rolesroles
role_name - is the name of a SQL Server role. This allows you to grant specific permissions to all users who have been granted a specific role. The roles are MOREINFO="NONE"sa_role (System Administrator)MOREINFO="NONE", sso_role (System Security Officer)MOREINFO="NONE", and MOREINFO="NONE"oper_role (Operator). Roles are granted to users with MOREINFO="NONE"sp_role.ID="IN4631-90195112"with grant option option, grant
MOREINFO="NONE"with grant option - allows the users specified in name_list to grant object access permissions to other users. You can only grant permissionsMOREINFO="NONE" with grant MOREINFO="NONE"option to individual users, not to "public" or to a group or role.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"grant insert, deleteon titlesto mary, salesREMAP="UN--Under"Grants Mary and the "sales" group permission to use the MOREINFO="NONE"insert and MOREINFO="NONE"delete commands on the titles table.grant updateon titles (price, advance)to public REMAP="UN--Under"or:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"grant update (price, advance)on titles to publicREMAP="UN--Under"Two ways to grant MOREINFO="NONE"update permission on the price and advance columns of the titles table to "public" (which includes all users).grant create database, create tableto mary, johnREMAP="UN--Under"Grants Mary and John permission to use the MOREINFO="NONE"create database and MOREINFO="NONE"create table commands. Because MOREINFO="NONE"create database permission is being granted, this command can only be executed by a System Administrator within the master database. Mary and John's MOREINFO="NONE"create table permission applies only to the master database.grant all on titles to publicREMAP="UN--Under"Grants complete access permissions on the titles table to all users.grant allto publicREMAP="UN--Under"Grants all object creation permissions in the current database to all users. If this command is executed by a System Administrator from the master database, it includes MOREINFO="NONE"create database permission.grant update on authorsto marywith grant optionREMAP="UN--Under"Gives Mary permission to use the MOREINFO="NONE"update command on the authors table, and to grant that permission to others.grant select, update on titles(price)to bobwith grant optionREMAP="UN--Under"Gives Bob permission to use the MOREINFO="NONE"select and MOREINFO="NONE"update commands on the price column of the titles table, and to grant that permission to others.rant execute on new_sprocto sso_roleREMAP="UN--Under"Grants permission to execute the new_sproc stored procedure to all System Security Officers.grant references on titles(price)to jamesREMAP="UN--Under"Grants James permission to create a referential integrity constraint on another table that refers to the price column of the titles table.ID="X29151"CommentsID="IN4612-94199115"from keywordgrantMARK="BULL" REMAP="BU--Bullet"You can substitute the word MOREINFO="NONE"from for MOREINFO="NONE"to in the MOREINFO="NONE"grant syntax. LINKEND="X75245"Table 1-16: Command and object permissions
ID="IN468-94199116"Transfercommand and object permissions
ID="IN469-94199117"OwnershipOwnershipof command and object permissionscommand and object permissions
ID="IN4617-94199118"Protection systemcommand and object permissions;Security:command and object permissions
 summarizes default permissions on Transact-SQL commands in SQL Server. The user listed under the "Defaults To" heading is the lowest level of user automatically granted permission to execute a command. This user can MOREINFO="NONE"grant or MOREINFO="NONE"revokeID="IN4619-94199119"Command permissionslevels;Levels:permission assignment
ID="IN4615-96201120"Database Ownersuse of setuser
 the permission if it is transferable. Users at higher levels than the default are either automatically assigned the permission, or (in the case of Database Owners) can get it via the MOREINFO="NONE"setuserID="IN465-98203121"Usersimpersonating (setuser)
 command.ID="IN4615-100205122"setuser commanduser impersonation using;Renaming:identity of object ownerREMAP="UN--Under"For example, the owner of a database does not automatically receive permissions on objects owned by other users. A Database Owner can always gain any such permission by assuming the identity of the object owner with the MOREINFO="NONE"setuser command and then issuing the appropriate MOREINFO="NONE"grant or MOREINFO="NONE"revoke statements. System Administrators have permission to access all commands and objects at any time. REMAP="UN--Under"The SQL Server installation script assigns a set of permissions to the default group "public". MOREINFO="NONE"grant or MOREINFO="NONE"revoke statements need not be written for these permissions.REMAP="UN--Under"LINKEND="X75245"Table 1-16
ID="IN4614-102207123"revoke commandobject and command permissions
 does not include the System Security Officer, who does not have any special permissions on commands and objects, but only on certain system procedures. TOCENTRY="1"LBL="Table 1-16: " ID="X75245"Command and object permissionsCOLS="9" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="11*"COLNAME="C2" COLWIDTH="6*"COLNAME="C3" COLWIDTH="6*"COLNAME="C4" COLWIDTH="7*"COLNAME="C5" COLWIDTH="5*"COLNAME="C6" COLWIDTH="5*"COLNAME="C7" COLWIDTH="4*"COLNAME="C8" COLWIDTH="4*"COLNAME="C9" COLWIDTH="4*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C9" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Command and Object PermissionsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatementCOLNAME="C2" NAMEST="C2" NAMEEND="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Defaults ToCOLNAME="C7" NAMEST="C7" NAMEEND="C9" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Can Be 
Granted/RevokedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"System 
Admin.COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OperatorCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database 
OwnerCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object 
OwnerCOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PublicCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YesCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NoCOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"N/AVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"alter database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(1)COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"alter table COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"begin transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"checkpoint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"commitCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create default COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create index COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create procedure COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create rule COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create table COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(2)COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific' (2)COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create trigger COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create view COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dbcc COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"delete COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific' (3)COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk init COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk mirror COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk refit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk reinit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk remirror COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk unmirror COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop (any object)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"execute COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'(4)COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"grant on objectCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"grant commandCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"insert COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific' (3)COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"kill COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"print COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"raiserror COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"readtext COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(5)COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"reconfigure COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"references COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"revoke on object COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"revoke command COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"rollbackCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"save transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific' (3)COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"set COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"setuser COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"shutdown COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"truncate table COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"update COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific' (3)COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"update statistics COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"writetext COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific'COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(6)COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" NAMEST="C1" NAMEEND="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(1) Transferred with database ownership (2) Public can create temporary tables, no permission required (3) If a view, permission defaults to view owner (4) Defaults to stored procedure ownerCOLNAME="C5" NAMEST="C5" NAMEEND="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(5) Transferred with MOREINFO="NONE"select permission (6) Transferred with update permission No means use of the command is never restrictedN/A means use of the command is always restrictedYou can only MOREINFO="NONE"grant or MOREINFO="NONE"revoke permissions on objects in the current database. Before you create a table that includes a referential integrity constraint to reference another user's table, you must be granted MOREINFO="NONE"references permission on that referenced table (see example 10). The table must also include a MOREINFO="NONE"unique constraint or unique index on the referenced columns. See LINKEND="X80969"create table
 for more information about referential integrity constraints. ID="IN4617-102207124"Order of commands
MOREINFO="NONE"grant and MOREINFO="NONE"revoke commands are ID="IN468-102207125"Commandsorder sensitive;Precedence:order-sensitive commands and
order-sensitive. The command that takes effect when there is a conflict is the most recently issued one. ID="IN465-102207126"Userscommand and object permissionsA user can be granted permission on a view or stored procedure even if he or she has no permissions on objects the procedure or view references. See the System Administration Guide
 for more information on using views and stored procedures as security mechanisms.ID="IN467-104209127"Cursorsgrant andSQL Server grants all users permission to declare cursors, regardless of the permissions defined for the base tables or views referenced in the MOREINFO="NONE"declare cursor statement. Cursors are not defined as SQL Server objects (such as tables), so no permissions can be applied against a cursor. When a user opens a cursor, SQL Server does determine if that user has MOREINFO="NONE"select permissions on the objects which define that cursor's result set. It checks permissions on each MOREINFO="NONE"open of a cursor. REMAP="UN--Under"If the user has permission to access the objects defined by the cursor, SQL Server opens the cursor and allows the user to MOREINFO="NONE"fetch row data through the cursor. SQL Server does not apply permission checking for each MOREINFO="NONE"fetch. However, if the user performs a MOREINFO="NONE"delete or an MOREINFO="NONE"update through that cursor, the regular permission checking applies for deleting and updating the data of objects referenced in the cursor result set.ID="IN4617-108213128"sysprotects tablegrant/revoke statements andEach MOREINFO="NONE"grant or MOREINFO="NONE"revoke statement adds a row to the sysprotects system table. However, if a user inherits a particular permission by virtue of being a member of a group, and then the same permission is explicitly granted to the user, no row is added to sysprotects. For example, say that "public" has been granted MOREINFO="NONE"select permission on the phone column of the authors table. John, a member of "public," is then granted MOREINFO="NONE"select permission on all columns of authors. The row added to sysprotects as a result of the MOREINFO="NONE"grant to John will contain references to all columns of authors except for the phone column, on which he already had permission.You can get information about permission with these system procedures:MARK="DASH" REMAP="BS--BulletSub"MOREINFO="NONE"sp_helprotect reports permissions on a database object or on a user.MOREINFO="NONE"sp_column_privileges reports permissions information for one or more columns in a table or view.MOREINFO="NONE"sp_table_privileges reports permissions information for all columns in a table or view.ID="IN4611-112217129"all keywordgrant
ID="IN4619-114219130"Command permissionsgrant allgrant all (Object Creation Permissions) MARK="BULL" REMAP="BU--Bullet"When used with only user and/or group names (no object names), MOREINFO="NONE"grant MOREINFO="NONE"allID="IN4623-116221131"create database commandpermission
 assigns these permissions: MOREINFO="NONE"create database, MOREINFO="NONE"create default, MOREINFO="NONE"create procedure, MOREINFO="NONE"create rule, MOREINFO="NONE"create table, and MOREINFO="NONE"create MOREINFO="NONE"view. MOREINFO="NONE"create database permission can be granted only by a System Administrator and only from within the master database.Only the Database Owner and System Administrator can use the MOREINFO="NONE"grant MOREINFO="NONE"all syntax without an object name to grant MOREINFO="NONE"create command permissions to users or groups. When the MOREINFO="NONE"grant MOREINFO="NONE"all command is used by the Database Owner, an informational message is printed, stating that only a System Administrator can grant MOREINFO="NONE"create database permission. All other permissions in the list above are granted. ID="IN4618-118223132"Object permissionsgrant allAll object owners can use MOREINFO="NONE"grant MOREINFO="NONE"all with an object name to grant permissions on their own objects. When used with a table or view name plus user and/or group names, MOREINFO="NONE"grant MOREINFO="NONE"all enables MOREINFO="NONE"delete, MOREINFO="NONE"insert, MOREINFO="NONE"select and MOREINFO="NONE"update permission on the table. grant with grant option RulesMARK="BULL" REMAP="BU--Bullet"You cannot grant permissions MOREINFO="NONE"with grant option to "public" or to a group or role.In granting permissions, a System Administrator is treated as the object owner. If a System Administrator grants permission on another user's object, the owner`s name appears as the grantor in sysprotects and in MOREINFO="NONE"sp_helprotect output.Information for each MOREINFO="NONE"grant is kept in the system table sysprotects with the following exceptions:MARK="DASH" REMAP="BS--BulletSub"SQL Server displays an informational message if a specific permission is granted to a user more than once by the same grantor. Only the first MOREINFO="NONE"grant is kept.If two MOREINFO="NONE"grants are exactly same except that one of them is granted MOREINFO="NONE"with grant option, the MOREINFO="NONE"grant with grant option is kept.If two MOREINFO="NONE"grant statements grant the same permissions on a particular table to a specific user, but the columns specified in the grants are different, SQL Server treats the grants as if they are one statement. For example, the following MOREINFO="NONE"grant statements are equivalent:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"grant select on titles(price, contract) to keikogrant select on titles(advance) to keikoREMAP="UI--UserInput" FORMAT="LINESPECIFIC"grant select on titles(price, contract, advance)to keikogrant and RolesID="IN4613-120225133"grant commandgrant commandand rolesroles
ID="IN465-120225134"Rolesstored procedures andMARK="BULL" REMAP="BU--Bullet"You can use the MOREINFO="NONE"grant command to grant object creation or object access permissions to all users who have been granted a specified role. (See example 8.)
.) This allows you to restrict use of a stored procedure or an object to users who are System Administrators, System Security Officers, or Operators. To grant or revoke roles, use MOREINFO="NONE"sp_role.REMAP="UN--Under"However, MOREINFO="NONE"grant execute permission does not prevent users who do not have the specified role from being individually granted permission to execute a stored procedure. If you want to ensure, for example, that only System Security Officers can ever be granted permission to execute a stored procedure, you can use the MOREINFO="NONE"proc_role system function within the stored procedure itself. It checks to see whether the invoking user has the correct role to execute the procedure. See LINKEND="X80972""System Functions"
 for more information.ID="IN465-120225135"Rolespermissions andPermissions granted to roles override permissions granted to users or groups. For example, say John has been granted the System Security Officer role, and MOREINFO="NONE"sso_role has been granted permission on the sales table. If John's individual permission on sales is revoked, he is still able to access sales because his role permissions override his individual permissions.ID="IN466-122227136"Groupsgrant andUsers and User Groups ID="IN4614-122227137""public" grouppublic groupMARK="BULL" REMAP="BU--Bullet"User groups allow you to MOREINFO="NONE"grant or MOREINFO="NONE"revoke permissions to more than one user with a single statement. Each user can only be a member of one group, and is always a member of "public".The Database Owner or System Administrator can add new users with MOREINFO="NONE"sp_adduser and create groups with MOREINFO="NONE"sp_addgroup. To allow users with logins on SQL Server to use the database with limited privileges, you can add a "guest" user with MOREINFO="NONE"sp_adduserID="IN4614-122227138"Guest accountsguest
, and assign limited permissions to "guest". All users with logins can access the database as "guest". To remove a user, use MOREINFO="NONE"sp_dropuser. To remove a group, use MOREINFO="NONE"sp_dropgroup. REMAP="UN--Under"To add a new user to a group other than "public", use MOREINFO="NONE"sp_adduser. To change an established user's group, use MOREINFO="NONE"sp_changegroup.ID="IN467-122227139"Listinguser group membersREMAP="UN--Under"To display the members of a group, use MOREINFO="NONE"sp_helpgroup.When MOREINFO="NONE"sp_changegroup is executed to change group membership, it clears the in-memory protection cache by executing:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"grant all to nullID="IN4617-126231140"sysprotects tablesp_changegroup and theREMAP="UN--Under"so that the cache can be refreshed with updated information from the sysprotects table. If you need to modify sysprotects directly, contact Sybase Technical Support. Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantEntry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Granting permissions to groups is a 
Transact-SQL extension.PermissionsREMAP="BO--Body"MOREINFO="NONE"grant permission defaults to object owners. Those users can grant permission to other users on their own database objects.See AlsoCommands     LINKEND="X29921"revoke
, LINKEND="X97464"setuserSystem procedures     LINKEND="X65925"sp_addgroup
, LINKEND="X68639"sp_adduser
, LINKEND="X78355"sp_changedbowner
, LINKEND="X18596"sp_changegroup
, LINKEND="X17416"sp_dropgroup
, LINKEND="X46789"sp_dropuser
, LINKEND="X25329"sp_helpgroup
, LINKEND="X22708"sp_helprotect
, LINKEND="X28192"sp_helpuser
, LINKEND="X39296"sp_roleCatalog stored procedures        LINKEND="X20577"sp_column_privileges
, LINKEND="X48736"sp_table_privileges
ID="IN4615-136241144"group by clausehaving clause and;having clause:group by and
ID="IN4615-144249145"group by clauseID="X96182"group by and having ClausesID="IN4716-150256147"select statementgroup by and having clauses
ID="IN476-155261148"Tablesdividing, with group by and having clauses
Used in MOREINFO="NONE"selectID="IN476-155261149"Groupstable rows
ID="IN4741-160266150"Dividing tables into groups. See group by
 statements to divide a table into groups. FORMAT="LINESPECIFIC"REMAP="BO--Body"Start of MOREINFO="NONE"select statement FORMAT="LINESPECIFIC"MOREINFO="NONE"group by [all] MOREINFO="NONE"aggregate_free_expressionMOREINFO="NONE"     [, MOREINFO="NONE"aggregate_free_expressionMOREINFO="NONE"]...[having MOREINFO="NONE"search_conditionsMOREINFO="NONE"] REMAP="BO--Body"End of MOREINFO="NONE"select statementKeywords and OptionsREMAP="RI--RefIndent"MOREINFO="NONE"group byID="IN4719-164270153"Aggregate functionsgroup by clause and;group by clause:aggregate functions and
 - specifies the groups into which the table will be divided, and if aggregate functions are included in the select list, finds a summary value for each group. These summary values appear as new columns in the results, rather than as new rows. You can refer to these new summary columns in the MOREINFO="NONE"having clause. REMAP="UN--Under"You can use the following aggregate functions in the select list before MOREINFO="NONE"group by (the expression is usually a column name): ID="IN4711-164270154"Rows, tablegroupingREMAP="UN--Under"A table can be grouped by any combination of columns-that is, groups can be nested within each other, as in Example 2. ID="IN4711-168274155"all keywordgroup by
MOREINFO="NONE"all - a Transact-SQL extension that includes all groups in the results, even those excluded by a MOREINFO="NONE"where clause. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"select type, avg(price) from titles where advance > 7000 group by all type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type -----------------  ---------- UNDECIDED                NULL  business                 2.99  mod_cook                 2.99  popular_comp            20.00  psychology               NULL trad_cook               14.99 (6 rows affected) ID="IN4711-176282156"all keywordnegated by having clause;having clause:negates allREMAP="UN--Under""NULL" in the aggregate column indicates groups that would be excluded by the MOREINFO="NONE"where clause. MOREINFO="NONE"having clauses negate the meaning of MOREINFO="NONE"all. aggregate_free_expression ID="IN4738-176282157"Aggregate-free expression, grouping by
ID="IN4711-176282158"Column namegrouping by
- is an expression that includes no aggregates. A Transact-SQL extension allows grouping by an aggregate-free expression as well as by a column name. ID="IN477-176282159"Columnsheadings;Headings, column
ID="IN477-176282160"AliasescolumnREMAP="UN--Under"Note that you cannot group by a column heading or alias. This example is correct: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select Price=avg(price), Pay=avg(advance), Total=price * $1.15 from titles group by price * $1.15 MOREINFO="NONE"having - sets conditions for the MOREINFO="NONE"group by clause similar to the way that MOREINFO="NONE"where sets conditions for the MOREINFO="NONE"select clause. REMAP="UN--Under"ID="IN4717-180286161"Search conditionsgroup by and having query
ID="IN479-182288162"Argumentshaving clause search
MOREINFO="NONE"havingID="IN4719-186292163"Aggregate functionshaving clause and;having clause:aggregate functions and
 search conditions can include aggregate expressions, otherwise its search conditions are identical to MOREINFO="NONE"where search conditions. Here's an example of a MOREINFO="NONE"having clause with aggregates: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select pub_id, total = sum(total_sales) from titles where total_sales is not null group by pub_id having count(*)>5 ID="IN4720-188294164"Number (quantity of)having clause search argumentsREMAP="UN--Under"A MOREINFO="NONE"having clause can include a maximum of 128 search arguments per result table, where the search arguments are in the form:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"column_name MOREINFO="NONE"comparison-operator     cMOREINFO="NONE"onstant-expression and ... REMAP="UN--Under" There is no limit to the number of expressions. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select type, avg(advance), sum(total_sales) from titles group by type REMAP="UN--Under"Calculates the average advance and the sum of the sales for each type of book. select type, pub_id, avg(advance), sum(total_sales) from titles group by type, pub_id REMAP="UN--Under"Groups the results by type and then by pub_id within each type.select type, avg(price) from titles group by type having type like 'p%' REMAP="UN--Under"Calculates results for all groups but displays only groups whose type begins with "p". select pub_id, sum(advance), avg(price) from titles group by pub_id having sum(advance) > $15000 and avg(price) < $10 and pub_id > "0700" REMAP="UN--Under"Displays results for groups matching the conditions in the MOREINFO="NONE"having clause. CommentsID="IN4711-188294167"Column namegrouping by;Expressions:grouping by
ID="IN477-188294168"Columnsheadings;Headings, column
ID="IN477-188294169"AliasescolumnMARK="BULL" REMAP="BU--Bullet"You can use a column name or any expression (except a column heading or alias) after MOREINFO="NONE"group by. You can MOREINFO="NONE"group by a column or expression that does not appear in the select list (a Transact-SQL extension).The maximum number of columns or expressions allowed in a MOREINFO="NONE"group by clause is 16.ID="IN4711-190296170"Null valuesgroup by andNull values in the MOREINFO="NONE"group by column are put into a single group. ID="IN479-194300171"Datatypesinvalid in group by and having clausesYou cannot name text or image columns in MOREINFO="NONE"group by and MOREINFO="NONE"having clauses. ID="IN477-196302172"Cursorsgroup by andYou cannot use a MOREINFO="NONE"group by clause in the MOREINFO="NONE"select statement of an updatable cursor.ID="IN4713-198304173"having clauseaggregate functions and
ID="IN4719-204310174"Aggregate functionsgroup by clause and;group by clause:aggregate functions and;Aggregate functions:having clause andAggregate functions can be used only in the select list or in a MOREINFO="NONE"having clause. They cannot be used in a MOREINFO="NONE"where or MOREINFO="NONE"group by clause. REMAP="UN--Under"Aggregate functions are of two types. Aggregates applied to all the rows in a tableID="IN4719-208314175"Aggregate functionsvector aggregates, group by and;Scalar aggregates:group by and
 (producing a single value for the whole table per function) are called scalar aggregates. An aggregate function in the select list with no MOREINFO="NONE"group by clause applies to the whole table; it is one example of a scalar aggregate. Aggregates applied to a group of rows in a specified column or expression ID="IN4717-212318176"Vector aggregatesgroup by and;Aggregate functions:vector aggregates, group by and
(producing a value for each group per function) are called vector aggregates. In either case, the results of the aggregate operations are shown as new columns that the MOREINFO="NONE"havingID="IN4711-212318177"Rows, tableaggregate functions applied to;Rows, table:scalar aggregates applied to;Rows, table:ways to group
ID="IN477-212318178"ResultsResultsof aggregate operationsaggregate operations
 clause can refer to. REMAP="UN--Under"You can nest a vector aggregate inside a scalar aggregate. (See LINKEND="X79130""Aggregate Functions"
 for more information and an example.) ID="IN478-216322179"Groupingtable rows;Queries:with/without group by and havingMOREINFO="NONE"How group by MOREINFO="NONE"and having MOREINFO="NONE"Queries Work MARK="BULL" REMAP="BU--Bullet"The MOREINFO="NONE"where clause excludes rows that do not meet its search conditions. The MOREINFO="NONE"group by clause collects the surviving rows into one group for each unique value in the MOREINFO="NONE"group by expression. Omitting MOREINFO="NONE"group by creates a single group for the whole table. The MOREINFO="NONE"having clause excludes rows that do not meet its search conditions. MOREINFO="NONE"having only tests rows, but the presence or absence of a MOREINFO="NONE"group by clause may make its behavior appear contradictory: MARK="DASH" REMAP="BS--BulletSub"When the query includes MOREINFO="NONE"group by, MOREINFO="NONE"having excludes result rows from groups. This is whyMOREINFO="NONE" having seems to operate on groups. When the query has no MOREINFO="NONE"group by, MOREINFO="NONE"havingID="IN476-216322180"Tablessingle-group
 excludes result rows from the (single-group) table. This is whyMOREINFO="NONE" having seems to operate on rows. (See Example 6, following.) Aggregate functions specified in the select list calculate summary values for each surviving group. ID="IN4715-220326181"group by clausehaving clause and, in standard SQLStandard MOREINFO="NONE"group by and MOREINFO="NONE"having MARK="BULL" REMAP="BU--Bullet"For MOREINFO="NONE"group by, having, and aggregate functions to produce one row and one summary value per group: MARK="DASH" REMAP="BS--BulletSub"Columns in a select list must also be in the MOREINFO="NONE"group by expression or they must be arguments of aggregate functions. A MOREINFO="NONE"group by expression can only contain column names that are in the select list. Columns in a MOREINFO="NONE"having expression must be single-valued-arguments of aggregates, for instance-and they must be in the select list or MOREINFO="NONE"group by clause. A query with a MOREINFO="NONE"having clause should have a MOREINFO="NONE"group by clause, but if omitted, all the rows not excluded by the MOREINFO="NONE"where clause are considered to be a single group. REMAP="UN--Under"In non-grouped queries, the principle that "MOREINFO="NONE"where excludes rows" always seems straightforward. In grouped queries, the principle expands to "MOREINFO="NONE"where excludes rows before MOREINFO="NONE"group by, then MOREINFO="NONE"having excludes rows from the display of results." ID="IN4713-224330182"having clausegroup by extensions in Transact-SQL and
ID="IN476-224330183"TablesTransact-SQL extension effects and querying
ID="IN4715-228334184"group by clausehaving clause and, in Transact-SQL
ID="IN4710-228334185"ExtensionsTransact-SQL;Transact-SQL:extensionsTransact-SQL Extensions to MOREINFO="NONE"group by and MOREINFO="NONE"havingMARK="BULL" REMAP="BU--Bullet"Transact-SQL extensions to standard SQL make displaying data more flexible, by allowing references to columns and expressions that are not used for creating groups or summary calculations: ID="IN4730-228334186"Extended columns, Transact-SQLMARK="DASH" REMAP="BS--BulletSub"A select list that includes aggregates can include columns that are not arguments of aggregate functions and are not included in the MOREINFO="NONE"group by clause. Example 2, which follows, illustrates how an "extended column" like this affects the display of results. ID="IN4731-230336187"Included groups, group by queryThe MOREINFO="NONE"group by clause can include columns or expressions that are not in the select list. ID="IN4712-234340188"where clausegroup by clause andThe MOREINFO="NONE"group by MOREINFO="NONE"all clause displays all groups, even those excluded from calculations by a MOREINFO="NONE"where clause. See the earlier example for the keyword MOREINFO="NONE"all. ID="IN4717-238344189"Search conditionsgroup by and having queryThe MOREINFO="NONE"having clause can include columns or expressions not in the select list and not in the MOREINFO="NONE"group by clause. When the Transact-SQL extensions add rows and columns to the display, or MOREINFO="NONE"group by is omitted, query results can be hard to interpret. Use the chart and the examples that follow to help you keep track of how Transact-SQL extensions can affect query results. REMAP="UN--Under"The following examples illustrate the differences between standard MOREINFO="NONE"group by and MOREINFO="NONE"having clauses and Transact-SQL extensions:NUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select type, avg(price) from titles group by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type                ----------------------  ----------- UNDECIDED                     NULL business                     13.73 mod_cook                     11.49 popular_comp                 21.48 psychology                   13.50 trad_cook                    15.96 (6 rows affected) REMAP="UN--Under"A standard grouping query.MOREINFO="NONE" select type, title_id, avg(price) from titles group by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC" type        title_id           ------------ -------- ---------------- business     BU1032              13.73 business     BU1111              13.73 business     BU2075              13.73 business     BU7832              13.73 mod_cook     MC2222              11.49 mod_cook     MC3021              11.49 UNDECIDED    MC3026               NULL popular_comp PC1035              21.48 popular_comp PC8888              21.48 popular_comp PC9999              21.48  psychology   PS1372              13.50  psychology   PS2091              13.50  psychology   PS2106              13.50  psychology   PS3333              13.50  psychology   PS7777              13.50  trad_cook    TC3218              15.96  trad_cook    TC4203              15.96  trad_cook    TC7777              15.96  (18 rows affected) REMAP="UN--Under"The Transact-SQL extended column, title_id (in the select list, not an aggregate and not in the MOREINFO="NONE"group by clause) causes all qualified rows to display in each qualified group, even though MOREINFO="NONE"group by should produce a single row per group. The average price per group, displayed on each row of each group, is identical to Example 1. select pub_id, count(pub_id) from publishers REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"pub_id ---------- --------- 0736               3 0877               3 1389               3  (3 rows affected) REMAP="UN--Under"The "standard extension" of omitting the MOREINFO="NONE"group by clause makes publishers a single group. The aggregate applies to the (single-group) table. select pub_id, count(pub_id) from publishers where pub_id < "1000" group by pub_id REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"pub_id -------------- --------- 0736                   1 0877                   1  (2 rows affected) REMAP="UN--Under"In this standard grouping query, two of the three single-row groups contain pub_id values that satisfy the MOREINFO="NONE"where clause. The aggregate function correctly counts one qualifying pub_id per group. select pub_id, count(pub_id) from publishers where pub_id < "1000" REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"pub_id -------------- ----------- 0736                    2 0877                    2 1389                    2  (3 rows affected) REMAP="UN--Under"This example combines two extension effects. By omitting the MOREINFO="NONE"group by clause: MARK="DASH" REMAP="BS--BulletSub"The table becomes a single group. The aggregate counts two qualified rows. pub_id becomes a Transact-SQL extended column because it does not appear in a MOREINFO="NONE"group by clause. No MOREINFO="NONE"having clause is present, so all rows in the group are qualified to display. select pub_id, count(pub_id) from publishers having pub_id < "1000" REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"pub_id -------------- --------- 0736                   3 0877                   3 (2 rows affected) ID="IN4715-242348190"group by clausewithout having clauseREMAP="UN--Under"This example illustrates the effects of a MOREINFO="NONE"having clause used without a MOREINFO="NONE"group by clause. MARK="DASH" REMAP="BS--BulletSub"The table is considered a single group. No MOREINFO="NONE"where clause excludes rows, so all the rows in the group (table) are qualified to be counted. The rows in this single-group table are then tested by the MOREINFO="NONE"having clause. These combined effects display the two qualified rows.select type, price, avg(price) from titles where price > 10.00 group by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type         price                                      ------------ ---------------- ----------------  business                19.99            17.31  business                11.95            17.31  business                 2.99            17.31  business                19.99            17.31  mod_cook                19.99            19.99  mod_cook                 2.99            19.99  popular_comp            22.95            21.48  popular_comp            20.00            21.48  popular_comp             NULL            21.48  psychology              21.59            17.51  psychology              10.95            17.51  psychology               7.00            17.51  psychology              19.99            17.51  psychology               7.99            17.51  trad_cook               20.95            15.96  trad_cook               11.95            15.96  trad_cook               14.99            15.96   (17 rows affected) ID="IN4730-242348191"Extended columns, Transact-SQLREMAP="UN--Under"The way that Transact-SQL extended columns are handled can make it look as if a query is ignoring a MOREINFO="NONE"where clause. This query computes the average prices using only those rows that satisfy the MOREINFO="NONE"where clause, but also displays rows that don't match the MOREINFO="NONE"where clause.ID="IN475-242348192"Joinstable groups andREMAP="UN--Under"SQL Server first builds a work table containing just the type and the aggregate values using the MOREINFO="NONE"where clause. This work table is joined back to the titles table on the type to include the price column in the results, but the MOREINFO="NONE"where clause is not used in the join. The only row in titles which is not in the results is the lone row with type = "undecided" and a NULL price, that is, a row for which there were no results in the work table. If you want to eliminate the rows that have prices less than $10.00 from the results, you must add a MOREINFO="NONE"having clause that repeats the MOREINFO="NONE"where clause: select type, price, avg(price) from titles where price > 10.00 group by type having price > 10.00 REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type           price                                              ----------- ----------------  ----------------  business                 19.99           17.31  business                 11.95           17.31  business                 19.99           17.31  mod_cook                 19.99           19.99  popular_comp             22.95           21.48  popular_comp             20.00           21.48  psychology               21.59           17.51  psychology               10.95           17.51  psychology               19.99           17.51  trad_cook                20.95           15.96  trad_cook                11.95           15.96  trad_cook                14.99           15.96 (12 rows affected) ID="IN4712-244350193"where clauserepeating aREMAP="BO--Body"If you are specifying additional conditions, such as aggregates, in the MOREINFO="NONE"having clause, be sure to also include all conditions specified in the MOREINFO="NONE"where clause. SQL Server will appear to ignore any MOREINFO="NONE"where clause conditions that are missing from the MOREINFO="NONE"having clause. ID="IN4710-248354194"Sort ordergroup by and having and
ID="IN4715-252358195"group by clausehaving clause and, sort orders
MOREINFO="NONE"group by and MOREINFO="NONE"having and sort ordersID="IN475-252358196"NamesOrdersorting groups of;Sort order:groups of names;Order:of names in a groupnames in a group
ID="IN4716-254360197"Case sensitivitygroup by andREMAP="BO--Body"If your server has a case-insensitive sort order installed, MOREINFO="NONE"group by ignores the case of the grouping columns. For example, given this data on a case-insensitive server:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select lname, amount from groupdemoREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"lname      amount ---------- ------------------ Smith                  10.00 smith                   5.00 SMITH                   7.00 Levi                    9.00 Lévi                   20.00REMAP="BO--Body"Grouping by lname produces these results: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select lname, sum(amount)from groupdemogroup by lnameREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"lname ---------- ------------------ Levi                    9.00 Lévi                   20.00 Smith                  22.00 ID="IN4718-256362198"Accent sensitivitygroup by andREMAP="BO--Body"The same query on a case- and accent- insensitive server produces these results:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC" lname  ---------- ------------------  Levi                    29.00  Smith                   22.00Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantEntry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The use within the select list of 
columns that are not in the MOREINFO="NONE"group MOREINFO="NONE"by 
list and have no aggregate functions 
is a Transact-SQL extension.

The use of the MOREINFO="NONE"all keyword is a 
Transact-SQL extension.See AlsoCommands     LINKEND="X48334"compute Clause
, LINKEND="X40303"declare
, LINKEND="X35229"select
, LINKEND="X30827"where ClauseFunctions     LINKEND="X79130"Aggregate Functions
, LINKEND="X24911"Row Aggregate Functions
ID="IN4715-264370202"group by clause
ID="IN4715-274380203"group by clausehaving clause and;having clause:group by and
ID="IN476-279385204"Tablesdividing, with group by and having clausesTopics     LINKEND="X80039"CursorsID="X74736"if...elseID="IN43209662"if...else conditions
ID="IN43199484"Logical expressionsif...else
Imposes conditions on the execution of a SQL statement. The statement following an MOREINFO="NONE"if keyword and its condition is executed if the condition is satisfied (when the logical expression returns "true"). The optional MOREINFO="NONE"else keyword introduces an alternate SQL statement that executes when the MOREINFO="NONE"ifID="IN4309485"
ID="IN433888146"else keyword. See if...else conditions
 condition is not satisfied (when the logical expression returns "false"). FORMAT="LINESPECIFIC"if MOREINFO="NONE"logical_expression 
MOREINFO="NONE"statements
[else [if MOREINFO="NONE"logical_expression] MOREINFO="NONE"statement] Keywords and OptionsREMAP="RI--RefIndent"logical_expression- is an expression (a column name, a constant, any combination of column names and constants connected by arithmetic or bitwise operators, or a subquery) that returns TRUE, FALSE or NULL. If the expression contains a MOREINFO="NONE"select statement, the MOREINFO="NONE"select statement must be enclosed in parentheses. statements ID="IN432084189"begin...end commandsif...else and
- is either a single SQL statement or a block of statements delimited by MOREINFO="NONE"begin and MOREINFO="NONE"end.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"if 3 > 2 print "yes" if exists (select postalcode from authors where postalcode = "94705") print "Berkeley author" if (select max(id) from sysobjects) < 100   print "No user-created objects in this database" else begin   print "These are the user-created objects"   select name, type, id   from sysobjects   where id > 100 end REMAP="UN--Under"The MOREINFO="NONE"if...else condition tests for the presence of user-created objects (all of which have ID numbers that are larger than 100) in a database. Where user tables exist, the MOREINFO="NONE"else clause prints a message and selects their names, types, and ID numbers. if (select total_sales    from titles    where title_id = "PC9999") > 100select "true"else select "false"REMAP="UN--Under"Since the value for total sales for PC9999 in the titles is NULL, this query returns "false". The MOREINFO="NONE"else portion of the query is performed when the MOREINFO="NONE"if portion returns FALSE or NULL. See LINKEND="X20204""Expressions"
 for more information on truth values and logical expressions.CommentsMARK="BULL" REMAP="BU--Bullet"The MOREINFO="NONE"if orMOREINFO="NONE" else conditional affects the performance of only a single SQL statement, unless statements are grouped into a block between the keywords MOREINFO="NONE"begin and MOREINFO="NONE"end, as in Example 3. REMAP="UN--Under"The statement clause could be an MOREINFO="NONE"execute stored procedure command, or any other legal SQL statement or statement block. ID="IN4319822012"Boolean expressionsselect statements inIf a MOREINFO="NONE"select statement is used as part of the Boolean expression, it must return a single value. MOREINFO="NONE"if...else constructs can be used either in a stored procedure (where they are often used to test for the existence of some parameter) or in ad hoc queries as in Examples 1 and 2. ID="IN437802213"Nestingif tests
MOREINFO="NONE"if tests can be nested, either within another MOREINFO="NONE"if or following an MOREINFO="NONE"else. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X55146"begin...end
MOREINFO="NONE", LINKEND="X52197"create procedureTopics     LINKEND="X12929"Control-of-Flow Language
, LINKEND="X20204"Expressions
, LINKEND="X45943"Subqueries
ID="IN4320762617"if...else conditions
 ID="IN4314723018"insert commandID="X91835"insertID="IN446713220"Addingrows to a table or view
Adds new rows to a table or view. FORMAT="LINESPECIFIC"insert [into][MOREINFO="NONE"database.[MOREINFO="NONE"owner.]]{MOREINFO="NONE"table_name|MOREINFO="NONE"view_name}[(MOREINFO="NONE"column_list)] {values (MOREINFO="NONE"expression [,MOREINFO="NONE" expression]...)    |MOREINFO="NONE"select_statement } Keywords and OptionsREMAP="RI--RefIndent"ID="IN4412673623"into keywordinsert
MOREINFO="NONE"into - is optional. ID="IN447653824"Columnslist and insert
column_list ID="IN445653825"OrderOrderof column list and insert datacolumn list and insert data
- is a list of one or more columns to which data is to be added. Enclose the list in parentheses. The columns can be listed in any order, but the incoming data (whether in a MOREINFO="NONE"values clause or a MOREINFO="NONE"select clause) must be in the same order. If a column has the IDENTITY property, you can substitute the MOREINFO="NONE"syb_identity keyword for the actual column name. ID="IN4416634026"IDENTITY columnsinserting tables withREMAP="UN--Under"The column list is necessary when some, but not all, of the columns in the table are to receive data. If no column list is given, the MOREINFO="NONE"insert is assumed to affect all of the columns in the receiving table (in MOREINFO="NONE"create table order). REMAP="UN--Under"For more information, see LINKEND="X56103""The Insert Column List"
.ID="IN4421594427"values option, insert
MOREINFO="NONE"values - is a keyword that introduces a list of expressions. ID="IN4411574628"Expressionsinsert and
expression - specifies constant expressions, variables, parameters or null values for the indicated columns. The values list must be enclosed in parentheses and must match the explicit or implicit column list. Enclose character and datetime constants in single or double quotes. See LINKEND="X84316""Datatypes"
 for more information about data entry rules.select_statement - is a standard MOREINFO="NONE"select statement used to retrieve the values to be inserted. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"insert titles values("BU2222", "Faster!", "business", "1389",     null, null, null, "ok", "06/17/87", 0) insert titles(title_id, title, type, pub_id, notes, pubdate,    contract) values ('BU1237', 'Get Going!', 'business',     '1389', 'great', '06/18/86', 1) insert newauthors   select *   from authors   where city = "San Francisco"insert test   select *   from test   where city = "San Francisco" CommentsMARK="BULL" REMAP="BU--Bullet"ID="IN4411554831"Rows, tableinsert
MOREINFO="NONE"insertID="IN4414475632"insert commandupdate and;update command:insert and
 only adds new rows: use MOREINFO="NONE"update to modify column values in a row you've already inserted. ID="X56103"The Insert Column ListMARK="BULL" REMAP="BU--Bullet"The column list determines the order in which values are entered. For example, suppose you have a table called newpublishers that is identical in structure and content to the publishers table in pubs2. In the example below, the columns in the column list of the newpublishers table match the columns of the select list in the publishers table. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"insert newpublishers (pub_id, pub_name) select pub_id, pub_name     from publishers     where pub_name="New Age Data" REMAP="UN--Under"The pub_id and pub_name for "New Age Data" are stored in the pub_id and pub_name columns of newpublishers. REMAP="UN--Under"In the next example, the order of the columns in the column list of the newpublishers table does not match the order of the columns of the select list of the publishers table. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"insert newpublishers (pub_id, pub_name)     select pub_name, pub_id     from publishers     where pub_name="New Age Data" REMAP="UN--Under"The result is that the pub_id for "New Age Data" is stored in the pub_name column of the newpublishers table, and the pub_name for "New Age Data" is stored in the pub_id column of the newpublishers table. You can leave out items in the column list and MOREINFO="NONE"values list as long as the omitted columns allow null values. See Example 2. Validating Column ValuesMARK="BULL" REMAP="BU--Bullet"ID="IN4420436033"create index commandinsert and
MOREINFO="NONE"insert interacts with the MOREINFO="NONE"ignore_dup_key, MOREINFO="NONE"ignore_dup_row, and MOREINFO="NONE"allow_dup_row options set with the MOREINFO="NONE"create index command. (See LINKEND="X58868""create index"
 for more information.) ID="IN447416234"Columnsnaming;Rules:insert and
ID="IN4417396435"Check constraintsinsert and;Columns:rules bound toA rule or MOREINFO="NONE"check constraint can restrict the domain of legal values that can be entered into a column. Rules are created with MOREINFO="NONE"create rule and bound with the system procedure MOREINFO="NONE"sp_bindrule. MOREINFO="NONE"check constraints are declared with the MOREINFO="NONE"create table ID="IN4412396436"Domain rules
statement.ID="IN447396437"Columnsdefaults bound to;Defaults:bound to columnsA default can supply a value if a user does not explicitly enter one. Defaults are created with MOREINFO="NONE"create default and bound with the system procedure MOREINFO="NONE"sp_bindefault, or they are declared with the MOREINFO="NONE"create table statement.ID="IN4414396438"Data integrityviolations
ID="IN4438396439"Violation of domain or integrity rulesIf an MOREINFO="NONE"insert statement violates domain or integrity rules (see LINKEND="X43186""create rule"
 and LINKEND="X19955""create trigger"
), or if it is the wrong datatype (see LINKEND="X80969""create table"
 and LINKEND="X84316""Datatypes"
), the statement fails and SQL Server displays an error message. Treatment of BlanksID="IN4417396440"Character stringsempty
ID="IN4429396441"Empty string (" ") or (' ')Empty string (" ") or (' ')as a single spacesingle spaceMARK="BULL" REMAP="BU--Bullet"Inserting an empty string ("") into a variable character type or textID="IN4413396442"Padding, datablanks and
 column inserts a single space. char columns are padded to the defined length. ID="IN4417396443"Character stringstruncation
ID="IN446376644"Blankscharacter datatypes and insert
ID="IN4416337045"varchar datatypespaces in and insertAll trailing spaces are removed from data inserted into varcharID="IN4410317246"Truncationinsert and
 columns, except in the case of a string which contains only spaces. Strings which contain only spaces are truncated to a single space. Strings longer than the specified length of a char, nchar, varchar, or nvarcharID="IN4418277647"string_rtruncationinsert and
 column are silently truncated unless MOREINFO="NONE"string_rtruncation option is set to MOREINFO="NONE"on.ID="IN4411238048"Null valuesinserting into text and image columnsInserting into MOREINFO="NONE"text and MOREINFO="NONE"image ColumnsMARK="BULL" REMAP="BU--Bullet"An MOREINFO="NONE"insert of a NULL into a text or image column does not create a valid text pointer, nor does it preallocate 2K bytes per value as would otherwise occur. Use MOREINFO="NONE"update to get a valid text pointer for that column. ID="IN448218249"Triggersinsert andInsert TriggersMARK="BULL" REMAP="BU--Bullet"You can define a trigger that takes a specified action when an MOREINFO="NONE"insert command is issued on a specified table. Inserting Rows Selected from Another TableMARK="BULL" REMAP="BU--Bullet"ID="IN4416178650"select statementinsert and
You can MOREINFO="NONE"select rows from a table and MOREINFO="NONE"insert them into the same table in a single statement. See Example 4. ID="IN4411178651"Null valuesinserting substitute values forTo insert data with MOREINFO="NONE"select from a table that has null values in some fields into a table which does not allow null values, you must provide a substitute value for any NULL entries in the original table. For example, to insert data into an advances table that won't allow null values, this example substitutes "0" for the NULL fields:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert advancesselect pub_id, isnull(advance, 0) from titlesID="IN4422139052"isnull system functioninsert andREMAP="UN--Under"Without the MOREINFO="NONE"isnull function, this command would insert all the rows with non-null values into advances, and produce error messages for all the rows where the advance column in titles contained NULL.ID="IN4415119253"Not null valuesinsert andREMAP="UN--Under"If this kind of substitution cannot be made for your data, it is not possible to insert the data containing null values into the columns with the NOT NULL specification.REMAP="UN--Under"Two tables may be identically structured, but differ in whether null values are permitted in some fields. You can use MOREINFO="NONE"sp_help to see the null types of the columns in your table.ID="IN442499454"Chained transaction modeinsert andTransactions and MOREINFO="NONE"insert MARK="BULL" REMAP="BU--Bullet"When you set chained transaction mode, SQL Server implicitly begins a transaction with the MOREINFO="NONE"insert statement if no transaction is currently active. To complete any inserts, you must MOREINFO="NONE"commit the transaction, or you can MOREINFO="NONE"rollback the changes. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert stores (stor_id, stor_name, city, state)    values ('9999', 'Books-R-Us', 'Fremont', 'AZ')if exists (select t1.city, t2.city     from stores t1, stores t2     where t1.city = t2.city     and t1.state = t2.state     and t1.stor_id < t2.stor_id)        rollback transactionelse        commit transactionREMAP="UN--Under"In chained transaction mode, this batch begins a transaction and inserts a new row into the stores table. If it inserts a row containing the same city and state information as another store in the table, it rolls back the changes to stores and ends the transaction. Otherwise, it commits the insertions and ends the transaction. For more information about the chained mode, see LINKEND="X19352""Transactions"
.ID="IN441449955"insert commandIDENTITY columns and
ID="IN4416-110456"IDENTITY columnsinsert andInserting Values Into IDENTITY ColumnsMARK="BULL" REMAP="BU--Bullet"When inserting a row into a table, do not include the name of the IDENTITY column in the column list, or its value in the values list. If the table consists of only one column, an IDENTITY column, omit the column list and leave the values list empty as follows:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert id_table values()ID="IN446-510857"ValuesIDENTITY columns;IDENTITY columns:values The first time you insert a row into a table, SQL Server assigns the IDENTITY column a value of 1. Each new row gets a column value one higher than the last. This value takes precedence over any defaults declared for the column in the MOREINFO="NONE"create table or MOREINFO="NONE"alter table statement or bound to the column with the MOREINFO="NONE"sp_bindefault system procedure.ID="IN4431-711058"identity configuration variableREMAP="UN--Under"Server failures can create gaps in IDENTITY column values. The maximum size of the gap depends on the setting of the identity burning set configuration variable. Gaps can also result from manual insertion of data into the IDENTITY column, deletion of rows, and transaction rollbacks.Only the table owner, Database Owner, or System Administrator can explicitly insert a value into an IDENTITY column after setting MOREINFO="NONE"identity_insert on for the column's base table. A user can turn the MOREINFO="NONE"identity_insert option on for one table in a database at a time. When MOREINFO="NONE"identity_insert is turned on, each MOREINFO="NONE"insert statement must include a column list and must specify an explicit value for the IDENTITY column.REMAP="UN--Under"Inserting a value into the IDENTITY column allows you to specify a "seed" value for the column or to restore a row that was deleted in error. Unless you have created a unique index on the IDENTITY column, SQL Server does not verify the uniqueness of the value; you can insert any positive integer.The maximum value that can be inserted into an IDENTITY column is 10 precision - 1. Once an IDENTITY column reaches this value, all further MOREINFO="NONE"insert statements return an error that aborts the current transaction.REMAP="UN--Under"When this happens, use the MOREINFO="NONE"create table statement to create a new table identical to the old, but with a larger precision for the IDENTITY column. Once you have created the new table, use either the MOREINFO="NONE"insert statement or the MOREINFO="NONE"bcp utility to copy the data from the old table to the new.Use theID="IN4426-911259"@@identity global variableatatidentity global variable;identity global variable
 @@identity global variable to retrieve the last value that was inserted into an IDENTITY column. If the last MOREINFO="NONE"insert or MOREINFO="NONE"select into statement affected a table with no IDENTITY column, @@identity returns the value 0.An IDENTITY column selected into a result table observes the following rules with regard to inheritance of the IDENTITY property:MARK="DASH" REMAP="BS--BulletSub"If an IDENTITY column is selected more than once, it is defined as NOT NULL in the new table. It does not inherit the IDENTITY property.If an IDENTITY column is selected as part of an expression, the resulting column does not inherit the IDENTITY property. It is created as NULL if any column in the expression allows nulls, and NOT NULL otherwise.If the select statement contains a MOREINFO="NONE"group by clause or aggregate function, the resulting column does not inherit the IDENTITY property. Columns that include an aggregate of the IDENTITY column are created NULL; others, NOT NULL. An IDENTITY column that is selected into a table with a union or join does not retain the IDENTITY property. If the table contains the union of the IDENTITY column and a NULL column, the new column is defined as NULL. Otherwise, it is defined as NOT NULL.To insert an explicit value into an IDENTITY column,
the table owner, Database Owner, or System Administrator must set MOREINFO="NONE"identity_insert onID="IN4416-1411760"IDENTITY columnsinsert and
ID="IN4414-1912261"insert commandIDENTITY columns and
 for the column's base table, not for the view through which it is being inserted.ID="IN4414-2212562"insert commandviews and
ID="IN445-2212563"Viewsinserting data throughInserting Data through ViewsID="IN445-2512864"Viewswith check optionMARK="BULL" REMAP="BU--Bullet"If a view is created MOREINFO="NONE"with check option, each row that is inserted through the view must meet the selection criteria of the view. REMAP="UN--Under"For example, the stores_cal view includes all rows of the stores table for which state has a value of "CA":REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create view stores_calas select * from storeswhere state = "CA"with check optionREMAP="UN--Under"The MOREINFO="NONE"with check option clause checks each MOREINFO="NONE"insert statement against the view's selection criteria. Rows for which state has a value other than "CA" are rejected.If a view is created MOREINFO="NONE"with check option, all views derived from the "base" view must satisfy the view's selection criteria. Each new row inserted through a derived view must be visible through the base view.REMAP="UN--Under"Consider the view stores_cal30, which is derived from stores_cal. The new view includes information about stores in California with payment terms of "Net 30":REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create view stores_cal30as select * from stores_calwhere payterms = "Net 30"REMAP="UN--Under"Because stores_cal was created MOREINFO="NONE"with check option, all rows inserted or updated through stores_cal30 must be visible through stores_cal. Any row with a state value other than "CA" is rejected.REMAP="UN--Under"Notice that stores_cal30 does not have a MOREINFO="NONE"with check option clause of its own. This means that it is possible to insert or update a row with a payterms value other than "Net 30" through stores_cal30. The following MOREINFO="NONE"update statement would be successful, even though the row would no longer be visible through stores_cal30:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update stores_cal30set payterms = "Net 60"where stor_id = "7067"MOREINFO="NONE"insert statements are not allowed on join views created MOREINFO="NONE"with check option.ID="IN445-2813165"Viewswith check optionID="IN4414-3113466"insert commandviews and
If you insert or update a row through a join view, all affected columns must belong to the same base table.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89MOREINFO="NONE"SQL(@COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantEntry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The following are Transact-SQL 
extensions:

A MOREINFO="NONE"union operator in the MOREINFO="NONE"select 
portion of an MOREINFO="NONE"insert statement

Qualification of a table or column 
name by a database name

 Insertion through a view that 
contains a join (Note: this is not 
detected by the FIPS flaggger.)PermissionsREMAP="BO--Body"MOREINFO="NONE"insert permission defaults to the table or view owner, who can transfer it to other users. REMAP="BO--Body"MOREINFO="NONE"insert permission for a table's IDENTITY column is limited to the table owner, Database Owner, and System Administrator.See AlsoCommands     LINKEND="X81463"create default
MOREINFO="NONE", LINKEND="X58868"create index
MOREINFO="NONE", LINKEND="X43186"create rule
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X19955"create trigger
MOREINFO="NONE", LINKEND="X45593"delete
MOREINFO="NONE", LINKEND="X35229"select
MOREINFO="NONE", LINKEND="X54355"updateTopics     LINKEND="X84316"DatatypesSystem procedures     LINKEND="X84736"sp_bindefault
MOREINFO="NONE", LINKEND="X38718"sp_bindrule
MOREINFO="NONE", LINKEND="X87638"sp_unbindefault
MOREINFO="NONE", LINKEND="X37191"sp_unbindrule
ID="IN4414-3513870"insert command
ID="IN446-3613971"Addingrows to a table or viewUtility programs     BOOK="unix" LINKEND="X12769"bcpID="X67442"killID="IN4512-4014473"kill command
ID="IN4524-4114574"Processes (Server tasks)killing
ID="IN4541-4615076"spid number. See Processes (Server tasks)
ID="IN4547-4915377"Current processes. See Processes (Server tasks)
ID="IN4524-5215678"Processes (Server tasks)Processes (Server tasks)See also Servers!see also
ID="IN4554-5515979"Server process ID number. See Processes (Server tasks)
ID="IN457-5816280"ServersServersSee also Processes (Server tasks); Remote servers!see also
ID="IN4547-6116581"Current processes. See Processes (Server tasks)
Kills a process. FORMAT="LINESPECIFIC"kill MOREINFO="NONE"spid Keywords and OptionsREMAP="RI--RefIndent"ID="IN4524-6116584"Processes (Server tasks)ID number;Constants:identification number
spid - is the identification number of the process you want to kill. spid must be a constant; it cannot be passed as a parameter to a stored procedure or used as a local variable. Use MOREINFO="NONE"sp_who to see a list of processes and other information.ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"kill 1378 CommentsID="IN4524-6516987"Processes (Server tasks)sp_who report on;Reports:sp_whoMARK="BULL" REMAP="BU--Bullet"To get a report on the current processes, execute the system procedure MOREINFO="NONE"sp_who. Here's a typical report: REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC" spid status    loginame hostname blk dbname cmd   ---- --------  -------- -------- --- ------ --------------   1 recv sleep  bird     jazzy    0   master AWAITING COMMAND   2 sleeping    NULL              0   master NETWORK HANDLER   3 sleeping    NULL              0   master MIRROR HANDLER   4 sleeping    NULL              0   master AUDIT PROCESS   5 sleeping    NULL              0   master CHECKPOINT SLEEP   6 recv sleep  rose     petal    0   master AWAITING COMMAND   7 running     sa       helos    0   master SELECT   8 send sleep  daisy    chain    0   pubs2  SELECT   9 alarm sleep lily     pond     0   master WAITFOR  10 lock sleep  viola    cello    7   pubs2  SELECTREMAP="UN--Under"The spid column contains the process identification numbers used in the Transact-SQL MOREINFO="NONE"kill command. The blkID="IN4516-6516988"Blocking process
 column contains the process ID of a blocking process, if there is one. A blocking process (which may have an exclusive lock) is one that is holding resources that another process needs. In this example, process 10 (a MOREINFO="NONE"select on a table) is blocked by process 7 (a MOREINFO="NONE"begin transaction followed by an MOREINFO="NONE"insert on the same table). REMAP="BO--Body"The status column reports the state of the command. These are the status values and the effects of MOREINFO="NONE"sp_who:sMOREINFO="NONE":TOCENTRY="1"LBL="Table 1-17: "Status values reported by sp_who COLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="15*"COLNAME="C3" COLWIDTH="16*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ConditionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Effects of kill CommandVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"recv sleepCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"waiting on a network readCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"immediateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"send sleepCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"waiting on a network sendCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"immediateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"alarm sleepCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"waiting on an alarm, such as 
MOREINFO="NONE"waitfor delay 
"10:00"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"immediateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lock sleepCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"waiting on a lock acquisitionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"immediateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sleepingCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"waiting disk I/O, or some 
other resource. Probably 
indicates a process that is 
running, but doing 
extensive disk I/OCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"killed when it "wakes up", 
usually immediate; a few 
sleeping processes do not 
wake up, and require a Server 
reboot to clearCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"runnableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"in the queue of runnable 
processesCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"immediateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"runningCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"actively running on one on 
the Server enginesCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"immediateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"infectedCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server has detected serious 
error condition; extremely 
rareCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"kill command not 
recommended. Server reboot 
probably required to clear 
processCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"backgroundCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"a process, such as a 
threshold procedure, run by 
SQL Server rather than by a 
user processCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"immediate; use kill with 
extreme care. Recommend a 
careful check of sysprocesses 
before killing a background 
processCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"log suspendCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"processes suspended by 
reaching the last-chance 
threshold on the logCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"killed when it "wakes up": 1) 
when space is freed in the log 
by a MOREINFO="NONE"dump transaction command or 2) when an SA 
uses the MOREINFO="NONE"lct_admin function to 
wake up "log suspend" 
processesID="IN4539-6717189"Current locks, sp_lock system procedureREMAP="BO--Body"To get a report on the current locks and the spids of the processes holding them, use the system procedure MOREINFO="NONE"sp_lock. Here's a typical report: REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"MOREINFO="NONE"   spid    locktype    table_id        page    dbname  ------    ----------- -----------     ------  --------       1    Sh_intent   16003088        0       master       1    Ex_page     16003088        761     master       4    Sh_table    112003430       0       pubs2       4    Ex_table    240003886       0       pubs2 REMAP="UN--Under"In this example, process 4 has an exclusive table lock and a shared table lock. Process 1 has an exclusive page lock and an intent lock. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"kill permission defaults to System Administrators, and is not transferable. See AlsoCommands     LINKEND="X73794"shutdownSystem procedures     LINKEND="X34217"sp_lock
MOREINFO="NONE", LINKEND="X89868"sp_who
ID="IN4512-7117594"kill command
ID="IN4524-7217695"Processes (Server tasks)killingREMAP="BO--Body"ID="X28090"load databaseID="IN43988146"RestoringRestoringdatabase with load databasedatabase with load database
Loads a backup copy of a user database, including its transaction log, that was created with MOREINFO="NONE"dump database. The MOREINFO="NONE"listonly and MOREINFO="NONE"headeronlyID="IN43787157"Backupsloading
 options display information about the dump files without loading them. Dumps and loads are performed through a Backup Server.FORMAT="LINESPECIFIC"load database
MOREINFO="NONE"database_name from
stripe_device [at backup_server_name ]    [density = density_value,     blocksize = number_bytes,    dumpvolume = volume_name,     file = file_name][stripe on stripe_device [at backup_server_name ]         [density = density_value,      blocksize = number_bytes,     dumpvolume = volume_name,      file = file_name][stripe on stripe_device [at backup_server_name ]     [density = density_value,      blocksize = number_bytes,      dumpvolume = volume_name,     file = file_name]...][with {    density = density_value,     blocksize = number_bytes,    dumpvolume = volume_name,     file = file_name,    [dismount | nodismount],    [nounload | unload],    listonly [= full],    headeronly,     notify = {client | operator_console}    }]Keywords and OptionsREMAP="RI--RefIndent"database_name - is the name of the database that will receive the backup copy. It can be either a newly created database or an existing database. Loading dumped data to an existing database overwrites all existing data. The receiving database must be at least as large as the dumped database. The database can be specified as a literal, a local variable, or a stored procedure parameter.ID="IN4321851710"load database commandload striping
MOREINFO="NONE"from stripe_device - is the device from which data is being loaded. See LINKEND="X32485""Specifying Dump Devices"
 for information about what form to use when specifying a dump device. See the System Administration Guide Supplement for a list of supported dump devices.MOREINFO="NONE"at backup_server_name - is the name of a remote Backup Server running on the machine to which the dump device is attached. For platforms that use interfaces files, the backup_server_name must appear in the interfaces file.MOREINFO="NONE"density = density_value - this option is ignored.MOREINFO="NONE"blocksize = number_bytes - overrides the default blocksize for a dump device. Do not specify a blocksize on OpenVMS systems. If you specify a blocksize on UNIX systems, it should be identical to that used to make the dump. ID="IN4314851711"Load, databasevolume name
MOREINFO="NONE"dumpvolume = volume_name - is the volume name field of the ANSI tape label. MOREINFO="NONE"load database checks this label when the tape is opened and generates an error message if the wrong volume is loaded.ID="IN4314851712"Load, databaseload striping
MOREINFO="NONE"stripe on stripe_device - is an additional dump device. You can use up to 32 devices, including the device named in the MOREINFO="NONE"to stripe_device clause. The Backup Server loads data from all devices concurrently, reducing the time and the number of volume changes required. See LINKEND="X68735""Specifying Dump Devices"
 for information about how to specify a dump device.ID="IN4314851713"Load, databasedismounting tapes after
MOREINFO="NONE"dismount | MOREINFO="NONE"nodismount - on platforms that support logical dismount (such as OpenVMS), determines whether tapes remain mounted. By default, all tapes used for a load are dismounted when the load completes. Use MOREINFO="NONE"nodismount to keep tapes available for additional loads or dumps.ID="IN4314851714"Load, databaserewinding tapes after
MOREINFO="NONE"nounload | MOREINFO="NONE"unload - determines whether tapes rewind after the load completes. By default, tapes do not rewind, allowing you to make additional loads from the same tape volume. Specify MOREINFO="NONE"unload for the last dump file to be loaded from a multi-dump volume. This rewinds and unloads the tape when the load completes.ID="IN4314851715"Load, databasefile name
MOREINFO="NONE"file = MOREINFO="NONE"file_name  -  is the name of a particular database dump on the tape volume. If you did not record the dump file names at the time you made the dump, usMOREINFO="NONE"e listonly to display information about all dump files.ID="IN4314851716"Load, databasefile name, listing
MOREINFO="NONE"listonly [MOREINFO="NONE" = full] - displays information about all dump files on a tape volume, but does not load the database. MOREINFO="NONE"listonly identifies the database and device, the date and time the dump was made, and the date and time it can be overwritten. MOREINFO="NONE"listonly = full provides additional details about the dump. Both reports are sorted by ANSI tape label. REMAP="UN--Under"After listing the files on a volume, the Backup Server sends a volume change request. The operator can either mount another tape volume or terminate the list operation for all dump devices.Do not use load database with listonly on quarter inch cartridge tape.ID="IN4314851717"Load, databaseheader, listing
ID="IN4314851718"Load, databasemessage destination
MOREINFO="NONE"headeronly - displays header information for a single dump file, but does not load the database. MOREINFO="NONE"headeronly displays information about the first file on the tape unless you use the MOREINFO="NONE"file = file_name option to specify another file name. The dump header indicates whether the file contains a database or transaction log dump, the database ID, the file name, the date the dump was made, the character set, sort order, page count and next object ID. ID="IN4314851719"Load, databasemessage destination
MOREINFO="NONE"notify = {MOREINFO="NONE"client |MOREINFO="NONE" operator_console} - overrides the default message destination. MARK="DASH" REMAP="BS--BulletSub"On operating systems (such as OpenVMS) that offer an operator terminal feature, volume change messages are always sent to the operator terminal on the machine on which the Backup Server is running. UseMOREINFO="NONE" client to route other Backup Server messages to the terminal session that initiated the MOREINFO="NONE"dump database.On operating systems (such as UNIX) that do not offer an operator terminal feature, messages are sent to the client that initiated the MOREINFO="NONE"dump database. Use MOREINFO="NONE"operator_console to route messages to the terminal on which the Backup Server is running.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"load database pubs2from
"/dev/nrmt0"REMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"load database pubs2from "MTA0:"REMAP="BO--Body"Reloads the database pubs2 from a tape device.For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"load database pubs2from "/dev/nrmt4" at REMOTE_BKP_SERVERstripe on "/dev/nrmt5" at REMOTE_BKP_SERVERstripe on "/dev/nrmt0" at REMOTE_BKP_SERVERREMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"load database pubs2from "MTA0:" at REMOTE_BKP_SERVERstripe on "MTA1:" at REMOTE_BKP_SERVERstripe on "MTA2:" at REMOTE_BKP_SERVERREMAP="UN--Under"Loads the pubs2 database, using the Backup Server REMOTE_BKP_SERVER. This command names 3 devices.CommentsID="IN4314851722"Load, databasecommands used for;Load, transaction log:commands used forCommands Used to Restore Databases from DumpsREMAP="BO--Body"LINKEND="XA23427"Table 1-18
 describes the commands and system procedures used to restore databases from backups:TOCENTRY="1"LBL="Table 1-18: " ID="XA23427"commands used to restore databases from dumpsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="2*"COLNAME="C2" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Use This CommandCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ToVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create database for loadCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Create a database for the purpose of loading a 
dumpCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load databaseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Restore a database from a dumpCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Apply recent transactions to a databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load { database | transaction } 
with headeronly, listonly COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Identify the dump files on a tapeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Respond to the Backup Server's volume 
change messagesID="IN4314851723"Load, databaserestrictionsMOREINFO="NONE"load database RestrictionsID="IN4314851724"Load, databasecross-platform not supportedMARK="BULL" REMAP="BU--Bullet"You cannot load a dump that was made on a different platform or with an earlier version of SQL Server.If a database has cross-database referential integrity constraints, the sysreferences system table stores the name-not the ID number-of the external database. SQL Server cannot guarantee referential integrity if you use MOREINFO="NONE"load database to change the database name or to load it onto a different server.Before dumping a database in order to load it with a different name or move it to anotherSQL Server, use alter table to drop all external referential integrity constraints.To recover a database, first load the most recent database dump, and then load all the transaction log dumps made since the last database dump, in orderID="IN4342851725"Timestamps, order of transaction log dumps
. SQL Server checks timestamp on each dump to make sure that it is being loaded to the correct database, and in the correct sequence.MOREINFO="NONE"load database overwrites any existing data in the database.ID="IN4314851726"Load, databasesize requiredThe receiving database must be as large as, or larger than, the database to be loaded. If the receiving database is too small, SQL Server displays an error message that gives the required size.ID="IN4314851727"Load, databaseupdates prohibited during
You cannot load from the "null device" (on UNIX, /dev/null; on OpenVMS, any device name beginning with NL).You cannot use the MOREINFO="NONE"load database command in a user-defined transaction.Each time you add or remove a cross-database constraint, or drop a table that contains a cross-database constraint, dump both of the affected databases. Loading earlier dumps of these databases could cause database corruption.Locking Users Out During LoadsID="IN4314851728"Load, databaserestricting useMARK="BULL" REMAP="BU--Bullet"While you are loading a database, it cannot be in use. If database commands are issued while a MOREINFO="NONE"load database or MOREINFO="NONE"load transaction command is running, users get a message telling them that the database is in the process of being loaded. ID="IN4316831929"Transaction logsload database andIf you need to load transaction log dumps as well as the database dump, you should set the following MOREINFO="NONE"sp_dboption options to TRUE before running MOREINFO="NONE"load database: MOREINFO="NONE"no chkpt on recovery, dbo use only andMOREINFO="NONE" read only. This ensures that no user can change the database between loads: transactions that write to the log make it impossible to load the next log dump. Reset these options to FALSE after the last MOREINFO="NONE"load. ID="X32485"Specifying Dump DevicesMARK="BULL" REMAP="BU--Bullet"You can specify the dump device as a literal, a local variable, or a parameter to a stored procedure. You can specify a local device as:MARK="DASH" REMAP="BS--BulletSub"A logical device name from the sysdevices system tableAn absolute pathnameA relative pathnameREMAP="UN--Under"The Backup Server resolves relative pathnames using SQL Server's current working directory.ID="IN4314831930"Load, databaseremote;Load, database:across networksWhen loading across the network, you must specify the absolute pathname of the dump device. The pathname must be valid on the machine on which the Backup Server is running. If the name includes any characters except letters, numbers or the underscore (_), you must enclose it in quotes.Ownership and permissions problems on the dump device may interfere with use of load commands.ID="IN4320831931"Number (quantity of)active dumps or loads
ID="IN4312831932"Dump devicesnumber requiredYou can run more than one load (or dump) at the same time as long as they use different physical devices.Backup ServersID="IN4316792333"sysservers tableload database andMARK="BULL" REMAP="BU--Bullet"You must have a Backup Server running on the same machine as your SQL Server. (On OpenVMS systems, the Backup Server can be running in the same cluster as the SQL Server, as long as all database devices are visible to both.) The Backup Server must be listed in the master..sysservers table. This entry is created during installation or upgrade, and should not be deleted.ID="IN4314792334"Load, databaseacross networksIf your backup devices are located on another machine, so that you load across a network, you must also have a Backup Server installed on the remote machine. ID="IN4314792335"Load, databaseBackup Server andVolume NamesID="IN436792336"Labelsdump volumesMARK="BULL" REMAP="BU--Bullet"Dump volumes are labeled according to the ANSI tape-labeling standard. The label includes the logical volume number and the position of the device within the stripe set. ID="IN4321772537"load database commandmessagesDuring loads, Backup Server uses the tape label to verify that volumes are mounted in the correct order. This allows you to load from a smaller number of devices than you used at dump time.When dumping and loading across the network, you must specify the same number of stripe devices for each operation.Changing Dump VolumesMARK="BULL" REMAP="BU--Bullet"If the Backup Server detects a problem with the currently mounted volume, it requests a volume change by sending messages to either the client or its operator console. After mounting another volume, the operator notifies the Backup Server by executing the MOREINFO="NONE"sp_volchanged system procedure on any SQL Server that can communicate with the Backup Server.On OpenVMS systems, the operating system requests a volume change when the specified drive is off-line. After mounting another volume, the operator uses the REPLY command to reply to these messages.Restoring the System DatabasesID="IN4315752738"master databaseloading a backupMARK="BULL" REMAP="BU--Bullet"Because the master, model, and sybsystemprocs databases do not store their transaction logs on a separate segment, you cannot use MOREINFO="NONE"dump transaction to make a copy of the transaction log. See the System Administration Guide for step-by-step instructions on restoring the system databases from dumps. ID="IN4314752739"Load, databasedisk mirroring and
ID="IN4314732940"Disk mirroringload database command andDisk MirroringMARK="BULL" REMAP="BU--Bullet"At the beginning of a load, SQL Server passes Backup Server the primary device name of each logical database and log device. If the primary device has been unmirrored, SQL Server passes the name of the secondary device instead. If any named device fails before Backup Server completes its data transfer, SQL Server aborts the load.If you attempt to unmirror any named device while a MOREINFO="NONE"load database is in progressMOREINFO="NONE", SQL Server displays a message. The user executing the MOREINFO="NONE"disk unmirror command can abort the load or defer the MOREINFO="NONE"disk unmirror until after the load completes.The Backup Server loads the data onto the primary device and thenMOREINFO="NONE" load database copies it to the secondary device. MOREINFO="NONE"load database takes longer to complete if any database device is mirrored.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"Only a System Administrator, Database Owner, or user with the Operator role can execute MOREINFO="NONE"load database. See AlsoCommands     LINKEND="X60179"dbcc
, LINKEND="X68345"dump database
, LINKEND="X47924"dump transaction
, LINKEND="X75212"load transactionSystem procedures     LINKEND="X11789"sp_helpdevice
, LINKEND="X94792"sp_volchanged
ID="IN4324693345"load transaction command
ID="IN4321683446"Load, transaction log
ID="IN439653747"Databasesload transaction command
ID="IN4321643848"Dump, transaction logloading
ID="IN4312614149"Transactionsload transaction commandID="X75212"load transactionID="IN447594451"Backupsloading;Transaction logs:loading
ID="IN447584552"Backupstransaction log
Loads a backup copy of the transaction log that was created with the dump transaction command. The listonly and headeronly options display information about the dump files without loading them. Dumps and loads are performed through a Backup Server. FORMAT="LINESPECIFIC"load tran[saction] MOREINFO="NONE"database_namefrom stripe_device [at backup_server_name]    [density = density_value,      blocksize = number_bytes,      dumpvolume = volume_name,     file = file_name][stripe on stripe_device [at backup_server_name]    [density = density_value,      blocksize = number_bytes,     dumpvolume = volume_name,     file = file_name][stripe on stripe_device [at backup_server_name]     [density = density_value,      blocksize = number_bytes,      dumpvolume = volume_name,     file = file_name]...][with {     density = density_value,     blocksize = number_bytes,     dumpvolume = volume_name,    file = file_name,    [dismount | nodismount],    [nounload | unload],    listonly [= full],    headeronly,    notify = {client | operator_console}}]Keywords and OptionsREMAP="RI--RefIndent"database_name - is the name of the database to receive data from a dumped backup copy. It can be either a newly created database with no data or an existing database. Loading dumped data to an existing database replaces existing data with the loaded data. The log segment of the receiving database must be at least as large as the log segment of the dumped database. The database can be specified as a literal, a local variable, or a parameter of a stored procedure.ID="IN4421584555"Load, transaction logload striping;Load, transaction log:dump devices
MOREINFO="NONE"from stripe_device - is the name of the dump device from which you are loading the transaction log. See LINKEND="X32485""Specifying Dump Devices"
 for information about what form to use when specifying a dump device. See the System Administration Guide Supplement for a list of supported dump devices.MOREINFO="NONE"at backup_server_name - is the name of a remote Backup Server running on the machine to which the dump device is attached. For platforms that use interfaces files, the backup_server_name must appear in the interfaces file.MOREINFO="NONE"density = density_value - overrides the default density for a tape device. This option is ignored.MOREINFO="NONE"blocksize = number_bytes - overrides the default blocksize for a dump device. Do not specify a blocksize on OpenVMS systems. If you specify a blocksize on UNIX systems, it should be identical to that used to make the dump. ID="IN4421584556"Load, transaction logvolume name
MOREINFO="NONE"dumpvolume = volume_name - is the volume name field of the ANSI tape label. MOREINFO="NONE"load database checks this label when the tape is opened and generates an error message if the wrong volume is loaded.MOREINFO="NONE"stripe on stripe_device - is an additional dump device. You can use up to 32 devices, including the device named in the MOREINFO="NONE"to stripe_device clause. The Backup Server loads data from all devices concurrently, reducing the time and the number of volume changes required. See LINKEND="X32485""Specifying Dump Devices"
 for information about how to specify a dump device.ID="IN4421584557"Load, transaction logdismounting tape after
MOREINFO="NONE"dismount | MOREINFO="NONE"nodismount - on platforms that support logical dismount (such as OpenVMS), determines whether tapes remain mounted. By default, all tapes used for a load are dismounted when the load completes. Use MOREINFO="NONE"nodismount to keep tapes available for additional loads or dumps.ID="IN4421584558"Load, transaction logrewinding tape after
MOREINFO="NONE"nounload | MOREINFO="NONE"unload - determines whether tapes rewind after the load completes. By default, tapes do not rewind, allowing you to make additional loads from the same tape volume. Specify MOREINFO="NONE"unload for the last dump file to be loaded from a multi-dump volume. This rewinds and unloads the tape when the load completes.ID="IN4421584559"Load, transaction logfile name
MOREINFO="NONE"file = file_name  -  is the name of a particular database dump on the tape volume. If you did not record the dump file names at the time you made the dump, usMOREINFO="NONE"e listonly to display information about all dump files.ID="IN4421584560"Load, transaction logfile name, listing
MOREINFO="NONE"listonly [ MOREINFO="NONE"= full]  - displays information about all dump files on a tape volume, but does not load the transaction log. MOREINFO="NONE"listonly identifies the database and device, the date and time the dump was made, and the date and time it can be overwritten. MOREINFO="NONE"listonly = full provides additional details about the dump. Both reports are sorted by ANSI tape label. REMAP="UN--Under"After listing the files on a volume, the Backup Server sends a volume change request. The operator can either mount another tape volume or terminate the list operation for all dump devicesDo not use load transaction with listonly on quarter inch cartridge tape.ID="IN4421584561"Load, transaction logheader, listing
MOREINFO="NONE"headeronly - displays header information for a single dump file, but does not load the database. MOREINFO="NONE"headeronly displays information about the first file on the tape unless you use the MOREINFO="NONE"file = file_name option to specify another file name. The dump header indicates whether the file contains a database or transaction log dump, the database ID, the file name, the date the dump was made, the character set, sort order, page count and next object ID, the checkpoint location in the log, the location of the oldest MOREINFO="NONE"begin transaction record and old and new sequence dates.ID="IN4421584562"Load, transaction logmessage destination
MOREINFO="NONE"notify = {MOREINFO="NONE"client |MOREINFO="NONE" operator_console} - overrides the default message destination. MARK="DASH" REMAP="BS--BulletSub"On operating systems (such as OpenVMS) that offer an operator terminal feature, volume change messages are always sent to the operator terminal on the machine on which the Backup Server is running. UseMOREINFO="NONE" client to route other Backup Server messages to the terminal session that initiated the MOREINFO="NONE"dump database.On operating systems (such as UNIX) that do not offer an operator terminal feature, messages are sent to the client that initiated the MOREINFO="NONE"dump database. Use MOREINFO="NONE"operator_console to route messages to the terminal on which the Backup Server is running.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"load transaction pubs2from "/dev/nrmt0"REMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"load transaction pubs2   from "MTA0:"REMAP="UN--Under"Loads the transaction log for the database pubs2 tape.For UNIX:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"load database pubs2from
"/dev/nrmt4" at REMOTE_BKP_SERVERstripe on "/dev/nrmt5" at REMOTE_BKP_SERVERstripe on "/dev/nrmt0" at REMOTE_BKP_SERVERREMAP="UN--Under"For OpenVMS:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"load database pubs2  from "MTA0:" at REMOTE_BKP_SERVERstripe on "MTA1:"at REMOTE_BKP_SERVERstripe on "MTA2:" at REMOTE_BKP_SERVERREMAP="UN--Under"Loads the transaction log for the pubs2 database, using the Backup Server REMOTE_BKP_SERVER.CommentsID="IN4414584565"Load, databasecommands used for;Load, transaction log:commands used forCommands Used to Restore Databases from DumpsREMAP="BO--Body"LINKEND="XA23427"Table 1-19
 describes the commands and system procedures used to restore databases from backups:TOCENTRY="1"LBL="Table 1-19: "Commands used to restore databases from dumpsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="2*"COLNAME="C2" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Use This CommandCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ToVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create database for loadCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Create a database for the purpose of loading a 
dumpCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load databaseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Restore a database from a dumpCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load transaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Apply recent transactions to a databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load { database | transaction } 
with headeronly, listonly COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Identify the dump files on a tapeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Respond to the Backup Server's volume 
change messagesMOREINFO="NONE"load transaction RestrictionsID="IN4421584566"Load, transaction logcross-platform not supportedMARK="BULL" REMAP="BU--Bullet"You cannot load a dump that was made on a different platform or with an earlier version of SQL Server.You cannot load from the "null device" (on UNIX, /dev/null; on OpenVMS, any device name beginning with NL).You cannot use the MOREINFO="NONE"load transaction command in a user-defined transaction.To recover a database, first load the most recent database dump, and then load all the transaction log dumps made since the last database dump, in orderID="IN4428544967"sp_dboption system procedureload transaction and
ID="IN448525168"Messagesload transaction
ID="IN4421525169"Load, transaction logTimestamps
. SQL Server checks timestamps on the dumped transaction log to make sure that it is being loaded to the correct database, and in the correct sequence. For more information on backup and recovery of SQL Server databases, see the System Administration Guide. ID="IN4414525170"Load, databasecross-platform not supported
ID="IN4414525171"Load, databaserestricting use
Each time you add or remove a cross-database constraint, or drop a table that contains a cross-database constraint, dump both of the affected databases. Loading earlier dumps of these databases could cause database corruption.Locking Users out During LoadsMARK="BULL" REMAP="BU--Bullet"While you are loading a database, it cannot be in use. If database commands are issued while a MOREINFO="NONE"load database or MOREINFO="NONE"load transaction command is running, users get a message telling them that the database is in the process of being loaded. Set the following MOREINFO="NONE"sp_dboption options to TRUE before running MOREINFO="NONE"load database: MOREINFO="NONE"no chkpt on recovery, dbo use only, andMOREINFO="NONE" read only. This ensures that no user can change the database between loads: transactions that write to the log make it impossible to perform the next load. Set these options to FALSE after the last MOREINFO="NONE"load transaction.ID="X68735"Specifying Dump DevicesMARK="BULL" REMAP="BU--Bullet"You can specify the dump device as a literal, a local variable, or a parameter to a stored procedure. When loading from a local device, you can specify the dump device as:MARK="DASH" REMAP="BS--BulletSub"An absolute pathnameA relative pathnameA logical device name from the sysdevices system tableREMAP="UN--Under"The Backup Server resolves relative pathnames using SQL Server's current working directory.When loading across the network, you must specify the absolute pathname of the dump device. (You cannot use a relative pathname or a logical device name from the sysdevices system table.) The pathname must be valid on the machine on which the Backup Server is running. If the name includes any characters except letters, numbers or the underscore (_), you must enclose it in quotes.Ownership and permissions problems on the dump device may interfere with use of load commands. The MOREINFO="NONE"sp_addumpdevice procedure adds the device to the system tables, but does not guarantee that you can load from that device or create a file as a dump device. ID="IN4420525172"Number (quantity of)active dumps or loadsYou can run more than one load (or dump) at the same time as long as they use different physical devices.Backup ServersMARK="BULL" REMAP="BU--Bullet"You must have a Backup Server running on the same machine as your SQL Server. (On OpenVMS systems, the Backup Server can be running in the same cluster as the SQL Server, as long as all database devices are visible to both.) The Backup Server must be listed in the master..sysservers table. This entry is created during installation or upgrade, and should not be deleted.If your backup devices are located on another machine, so that you load across a network, you must also have a Backup Server installed on the remote machine.Volume NamesID="IN446525173"Labelsdump volumesMARK="BULL" REMAP="BU--Bullet"Dump volumes are labeled according to the ANSI tape-labeling standard. The label includes the logical volume number and the position of the device within the stripe set. ID="IN4421505374"load database commandmessagesDuring loads, Backup Server uses the tape label to verify that volumes are mounted in the correct order. This allows you to load from a smaller number of devices than you used at dump time.When dumping and loading across the network, you must specify the same number of stripe devices for each operation.Changing Dump VolumesMARK="BULL" REMAP="BU--Bullet"If the Backup Server detects a problem with the currently mounted volume, it requests a volume change by sending messages to either the client or its operator console. After mounting another volume, the operator notifies the Backup Server by executing the MOREINFO="NONE"sp_volchanged system procedure on any SQL Server that can communicate with the Backup Server.On OpenVMS systems, the operating system requests a volume change when the specified drive is off-line. After mounting another volume, the operator uses the REPLY command to reply to these messages.Restoring the System DatabasesID="IN4415485575"master databaseloading a backupMARK="BULL" REMAP="BU--Bullet"Because the master, model, and sybsystemprocs databases do not store their transaction logs on a separate segment, you cannot use MOREINFO="NONE"dump transaction to make a copy of the transaction log. See the System Administration Guide for step-by-step instructions on restoring the system databases from dumps. ID="IN4421465776"Load, transaction logdisk mirroring and;Disk mirroring:load transaction command andDisk MirroringMARK="BULL" REMAP="BU--Bullet"At the beginning of a load, SQL Server passes the Backup Server the primary device name of each logical database device and each logical log device. If the primary device has been unmirrored, SQL Server passes the name of the secondary device instead. If any named device fails before the Backup Server completes its data transfer, SQL Server aborts the load.If you attempt to unmirror any of the named devices while a MOREINFO="NONE"load MOREINFO="NONE"transaction is in progressMOREINFO="NONE", SQL Server displays a message. The user executing the MOREINFO="NONE"disk unmirror command can abort the load or defer the MOREINFO="NONE"disk unmirror until after the load completes.The Backup Server loads the data onto the primary device and thenMOREINFO="NONE" load transaction copies it to the secondary device.MOREINFO="NONE" load transaction takes longer to complete if any database device is mirrored.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"load transaction permission defaults to the Database Owner and Operators, and is not transferable. See AlsoCommands     LINKEND="X45609"disk unmirror
, LINKEND="X68345"dump database
, LINKEND="X47924"dump transaction
,LINKEND="X28090"load databaseSystem procedures     LINKEND="X11789"sp_helpdevice
, LINKEND="X94792"sp_volchangedREMAP="UIW10--UserInputWide10pt" FORMAT="LINESPECIFIC"ID="X29776"openID="IN4379663"Cursorsopening
Opens a cursor for processing.FORMAT="LINESPECIFIC"open cursor_nameParametersREMAP="RI--RefIndent"cursor_name - the name of the cursor to openExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"open authors_crsrREMAP="UN--Under"FORMAT="LINESPECIFIC"Opens the cursor named 
authors_crsr.CommentsMARK="BULL" REMAP="BU--Bullet"SQL Server returns an error message if the cursor is already open or if the cursor has not been created with the MOREINFO="NONE"declare cursor statement. You must first open a cursor to use the MOREINFO="NONE"fetch, MOREINFO="NONE"update, and MOREINFO="NONE"delete statements.Opening the cursor causes SQL Server to evaluate the MOREINFO="NONE"select statement that defines the cursor (specified in the MOREINFO="NONE"declare cursor statement) and makes the cursor result set available for processing.When the cursor is first opened, it is positioned before the first row of the cursor result set.ID="IN43249488"Chained transaction modeopen andWhen you set the chained transaction mode, SQL Server implicitly begins a transaction with the MOREINFO="NONE"open statement if no transaction is currently active.PermissionsREMAP="BO--Body"MOREINFO="NONE"open permission defaults to all users.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantSee AlsoCommands     LINKEND="X78688"close
, LINKEND="X11816"declare cursor
, LINKEND="X18078"fetchTopics      LINKEND="X80039"Cursors
, LINKEND="X19352"Transactions
ID="IN4315861613"order by clauseorder by and sortingID="X14000"order by ClauseID="IN4445812215"Sequence. See order by clause; Sort order
ID="IN4410782516"Sort orderSort orderSee also Order!see also Order
ID="IN449752817"StructureStructureSee also Order!see also Order
Returns query results in the specified column(s) in sorted order.FORMAT="LINESPECIFIC"REMAP="BO--Body"[Start of MOREINFO="NONE"select statement]FORMAT="LINESPECIFIC"[orderMOREINFO="NONE" by {[MOREINFO="NONE"table_name.| MOREINFO="NONE"view_name.]MOREINFO="NONE"column_name     | MOREINFO="NONE"select_list_number | MOREINFO="NONE"expression} [asc | desc] [,{[MOREINFO="NONE"table_name.| MOREINFO="NONE"view_name.] MOREINFO="NONE"column_name       MOREINFO="NONE"select_list_number|eMOREINFO="NONE"xpression} [asc |desc]]...]REMAP="BO--Body"[End of MOREINFO="NONE"select statement] Keywords and OptionsREMAP="RI--RefIndent"MOREINFO="NONE"order by - sorts the results by columns. In Transact-SQL, you can MOREINFO="NONE"order by items that do not appear in the select list. You can sort by a column heading, a column name, an expression, an alias name (if it was specified in the select list), or a number representing the position of the item in the select list (the select_list_number). ID="IN4410752820"Sort orderascending or descending
ID="IN4428733021"Ascending order, asc keywordascending sort
MOREINFO="NONE"asc - sorts the results in ascending order. If you do not specify MOREINFO="NONE"asc or MOREINFO="NONE"desc, MOREINFO="NONE"asc is assumed. ID="IN4431713222"Descending order (desc keyword)descending
MOREINFO="NONE"desc - sorts the results in descending order. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select title, type, price from titles where price > $9.99 order by title select type, price, advance from titles order by type desc compute avg(price), avg(advance) by type select title_id, advance/total_salesfrom titlesorder by advance/total_salesselect title as BookName, type as Typefrom titlesorder by TypeCommentsRestrictionsMARK="BULL" REMAP="BU--Bullet"Use MOREINFO="NONE"order by to display your query results in a meaningful order. Without an MOREINFO="NONE"order by clause, you cannot control the order in which results are returned by SQL Server.ID="IN4417693425"Number of columnsNumber of columnsin an order by clauseorder by clauseThe maximum number of columns allowed in an MOREINFO="NONE"order by clause is 16. MOREINFO="NONE"order by cannot be used on text or image datatype columns. ID="IN4410693426"Sort orderchoices and effects
ID="IN4410673627"Subqueriesorder by andSubqueries and view definitions cannot include an MOREINFO="NONE"order by clause (or a MOREINFO="NONE"compute clause or the keyword MOREINFO="NONE"into). Conversely, you cannot use a subquery, an aggregate, a variable, or a constant expression in an MOREINFO="NONE"order by list. ID="IN447653828"Cursorsorder by andYou cannot update the result set of a Server or Language type cursor if it contains an MOREINFO="NONE"order by clause in MOREINFO="NONE"its select statement. See "LINKEND="X80039"Cursors
" for more information about the restrictions applied to updatable cursors.ID="IN4414574629"compute clauseorder by and;order by clause:compute by andIf you use MOREINFO="NONE"compute by, you must also use an MOREINFO="NONE"order by clause. The expressions listed after MOREINFO="NONE"compute by must be identical to or a subset of those listed after MOREINFO="NONE"order by, must be in the same left-to-right order, start with the same expression, and not skip any expressions. For example, suppose that the MOREINFO="NONE"order by clause is: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"order by a, b, c REMAP="UN--Under"The MOREINFO="NONE"compute by clause can be any (or all) of these: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"compute by a, b, c compute by a, b compute by a ID="IN446554830"Totalscompute commandREMAP="UN--Under"The keyword MOREINFO="NONE"compute can be used without MOREINFO="NONE"byID="IN4412535031"Grand totalsorder by
 to generate grand totals, grand counts, etc. In this case, MOREINFO="NONE"order by is optional. Collating SequencesID="IN4411535032"Null valuesOrdersort order of;Order:of null valuesnull valuesMARK="BULL" REMAP="BU--Bullet"With MOREINFO="NONE"order by, null values come before all others. ID="IN4434505333"Collating sequence. See Sort orderThe sort order (collating sequence) on your SQL Server determines how your data is sorted. The sort order choices are: binary, dictionary, case-insensitive, case-insensitive with preference, and case- and accent-insensitive. Sort orders that are particular to specific national languages may also be provided.TOCENTRY="1"LBL="Table 1-20: "Effect of sort order choicesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="13*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL Server's Sort 
OrderCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Effects on order byMOREINFO="NONE" ResultsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Binary orderCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sorts all data according to the numeric byte-value 
of each character in the character set. Binary 
order sorts all uppercase letters before lowercase 
letters. Binary sort order is the only option for 
multibyte character sets.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dictionary orderCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sorts uppercase letters before their lowercase 
counterparts (case-sensitive). Dictionary order 
recognizes the various accented forms of a letter 
and sorts them after the unaccented form.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dictionary order, 
case-insensitiveCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sorts data in dictionary order but does not 
recognize case differences. Uppercase letters are 
equivalent to their lowercase counterparts and 
will be sorted as described below.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dictionary order, 
case-insensitive with 
preferenceCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sorts an uppercase letter in the preferred 
position, before its lowercase version. It does not 
recognize case difference when performing 
comparisons (for example, in MOREINFO="NONE"where clauses).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dictionary order, 
case- and accent-
insensitive COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sorts data in dictionary order but does not 
recognize case differences; treats accented forms 
of a letter as equivalent to the associated 
unaccented letter. It intermingles accented and 
unaccented letters in sorting results.The system procedure MOREINFO="NONE"sp_helpsortID="IN4426485534"Ties, rules for sort orderRulesfor sort order tiessort order ties
 reports the sort order installed on your server. When two rows have equivalent values in the Server's sort order, the following rules are used to order the rows:MARK="DASH" REMAP="BS--BulletSub"The values in the columns named in the MOREINFO="NONE"order byID="IN4416475635"Comparing valuesComparing valuesfor sort ordersort order
 clause are compared.If two rows have equivalent column values, the binary value of the entire rows is compared byte by byte. This comparison is performed on the row in the order in which the columns are stored internally, not the order of the columns as they are named in the query or in the originalID="IN4420455836"create table commandcolumn order and
MOREINFO="NONE" create table ID="IN4411455837"Rows, tableOrdercomparison order of;Order:of columns (fixed and variable length)columns (fixed and variable length)
ID="IN4437455838"Fixed-length columns, stored order of
ID="IN447455839"Columnsvariable-length, and sort order;Variable-length columns:stored order of
clause. (In brief, data is stored with all the fixed-length columns in order, then all the variable length columns in order.)If rows are equal, row IDs are compared.REMAP="UN--Under"Given this table:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table sortdemo (lname varchar(20),                       init char(1) not null)REMAP="UN--Under"And this data:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"lname      init ---------- ---- Smith      B SMITH      Csmith      A REMAP="UN--Under"You get these results when you order by lname:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"lname      init ---------- ---- smith      A Smith      B SMITH      CID="IN4413436040"char datatyperow sort order andREMAP="UN--Under"Since the fixed-length char data (the init column) is stored first internally, the MOREINFO="NONE"order by sorts these rows based on the binary values "Asmith", "BSmith" and "CSMITH".REMAP="UN--Under"If init is a varchar instead, the lname column is stored first internally, then the init column, and the comparison takes place on the binary values "SMITHCID="IN4426416241"Ties, rules for sort orderRulesfor sort order tiessort order ties
ID="IN4416406342"Comparing valuesComparing valuesfor sort ordersort order
", "SmithB" and "smithA", and the rows are returned in that order. Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantEntry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Specifying new column headings 
in the MOREINFO="NONE"order by clause of a MOREINFO="NONE"select 
statement when the MOREINFO="NONE"union operator 
is used is a Transact-SQL extension.See AlsoCommands     LINKEND="X48334"compute Clause,
 LINKEND="X40303"declare
, LINKEND="X96182"group by and having Clauses
, LINKEND="X35229"select
, LINKEND="X30827"where Clause
ID="IN4415327146"order by clauseorder by and sorting
 Topics     LINKEND="X80039"Cursors
, LINKEND="X20204"Expressions
ID="IN4412327147"Transactionspreparing
ID="IN4427267748"prepare transaction commandprepare transactionID="IN4519248050"DB-Library programsprepare transaction
Used by DB-Library in a two-phase commit application to see if a server is prepared to commit a transaction. FORMAT="LINESPECIFIC"prepare transaction Comments MARK="BULL" REMAP="BU--Bullet"See the Open Client DB-Library Reference Manual for more information. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X53982"begin transaction
MOREINFO="NONE", LINKEND="X89531"commit
MOREINFO="NONE", LINKEND="X91510"rollback
MOREINFO="NONE", LINKEND="X69417"save transaction
ID="IN4527188656"prepare transaction command
MOREINFO="NONE",Topics      LINKEND="X19352"Transactions
ID="IN4513149057"print commandID="X69372"printID="IN4610149159"Retrievingerror message text
ID="IN468119460"Messagesprinting user-defined;Messages:screen;Printing user-defined messages
Prints a user-defined message on the user's screen. FORMAT="LINESPECIFIC"print {MOREINFO="NONE"format_string | @MOREINFO="NONE"local_variable |MOREINFO="NONE"@@global_variable}    [, MOREINFO="NONE"arg_list] Keywords and OptionsREMAP="RI--RefIndent"ID="IN462199663"String message, print
format_string - may be either a variable or a string of characters. The maximum length of format_string is 255 bytes. ID="IN461379864"Place holdersprint messageREMAP="UN--Under"Format strings can contain up to 20 unique place holders in any order. These placeholders are replaced with the formatted contents of any arguments that follow format_string when the text of the message is sent to the client. ID="IN46979865"Argumentsnumbered place holders for
ID="IN464979866"Grammatical structure, numbered place holders and
ID="IN467310267"Numbersnn! (place holder format)place holder (%nn!);%nn! (place holder format)REMAP="UN--Under"To allow reordering of the arguments when format strings are translated to a language with a different grammatical structure, the place holders are numbered. A place holder for an argument appears in this format: "%nn!"ID="IN4616310268"% (percent sign)in error messages;% (percent sign):place holder;Percent sign (%):in messages;Percent sign (%):place holder in error message
, a percent sign (%), followed by an integer from 1 to 20, followed by an exclamation point (!). The integer represents the argument number in the string in the argument list. "%1!" is the first argument in the original version, "%2!" is the second argument, and so on. ID="IN4620310269"Languages, alternateTranslationstructure and translation;Translation:of argumentsarguments
ID="IN465310270"OrderOrderof arguments in translated stringsarguments in translated strings
ID="IN465310271"Ordererror message arguments;Sentence order and numbered place holdersREMAP="UN--Under"Indicating the position of the argument in this way makes it possible to translate correctly, even when the order in which the arguments appear in the target language is different. REMAP="UN--Under"For example, assume the following is an English message: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"%1! is not allowed in %2!.  ID="IN4637310272"German language print message exampleREMAP="UN--Under"The German version of this message is: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"%1! ist in %2! nicht zulassig.ID="IN4623310273"Japanese character setsprint message exampleREMAP="UN--Under"The Japanese version of this message is:FLOAT="0"FORMAT="UNKNOWN" FILEREF="fig1_1_5.xwd"REMAP="UN--Under"In this example, "%1!" in all three languages represents the same argument, and " %2!" also represents a single argument in all three languages. This example shows the reordering of the arguments that is sometimes necessary in the translated form. ID="IN469110474"VariablesVariablesin print messagesprint messages
ID="IN4615110475"Local variablesLocal variablesin screen messagesscreen messages
@local_variable - must be of type char, nchar, varchar, or nvarchar, and must be declared within the batch or procedure in which it is used. @@global_variable - must be of type char or varchar or automatically convertible to these types, such as MOREINFO="NONE"@@versionID="IN4625-110676"@@version global variableatatversion global variable;version global variable
. Currently, @@version is the only character-type global variable. ID="IN469-310877"ArgumentsArgumentsin print commandprint command
arg_list - may be a series of either variables or constants separated by commas. arg_list is optional unless a format string containing place holders of the form %nn! is provided. In that case the arg_list must have at least as many arguments as the highest numbered place holder. An argument can be any datatype except text or image; it is converted to a character datatype before being included in the final message. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"if exists (select postalcode from authors where postalcode = '94705') print "Berkeley author" declare @msg char(50) select @msg = "What's up, doc?" print @msg REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"What's up, doc? declare @tabname varchar(30) select @tabname = "titles"  declare @username varchar(30) select @username = "ezekiel" print "The table '%1!' is not owned by the user '%2!'.", @tabname, @usernameREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"The table 'titles' is not owned by the user 'ezekiel.' CommentsID="IN4620-511080"Number (quantity of)arguments and place holders;Size limit:print commandMARK="BULL" REMAP="BU--Bullet"The maximum output string length of format_string plus all arguments after substitution is 512 bytes. ID="IN4620-511081"Number (quantity of)place holders in a format stringIf you use place holders in a format string, keep this in mind: for each place holder n in the string, the place holders 1 through n-1 must also exist in the same string (although they do not have to be in numerical order). For example, you cannot have place holders 1 and 3 in a format string without having the place holder 2 in the same string. If you do omit a number in a format string, an error message is generated when MOREINFO="NONE"print is executed. The arg_list must include an argument for each placeholder in the format_string, or the transaction is aborted. It is permissible to have more arguments than placeholders. ID="IN4616-511082"% (percent sign)literal in error messages;Percent sign (%):literal in error messagesTo include a literal percent sign as part of the error message, use two percent signs ("%%") in the format_string. If you include a single percent sign ("%") in the format_string which is not used as a placeholder, SQL Server returns an error message.If an argument evaluates to NULLID="IN466-511083"Outputzero-length string;Zero-length string output
ID="IN4622-911484"isnull system functionprint and
, it is converted into a zero-length character string. If you do not want zero-length strings in the output, use the MOREINFO="NONE"isnull function (see "LINKEND="X80972"System Functions
"). For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"declare @arg varchar(30) select @arg = isnull(col1, "nothing") from table_a where ...REMAP="UI--UserInput" FORMAT="LINESPECIFIC"print "I think we have %1! here", @arg REMAP="UN--Under"prints: REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"I think we have nothing here. REMAP="UN--Under"if @arg is null. ID="IN466-1111685"Addingmessages to sysusermessagesUser-defined messages can be added to the system table sysusermessages for use by any application. Use MOREINFO="NONE"sp_addmessage to add messages to sysusermessages; use MOREINFO="NONE"sp_getmessage to retrieve messages for use by MOREINFO="NONE"print and MOREINFO="NONE"raiserror. ID="IN4614-1111686"Error messagesprinting user-defined
ID="IN4613-1912487"print commandusing raiserror or;raiserror command:using print orUse MOREINFO="NONE"raiserror instead of MOREINFO="NONE"printID="IN4623-2112688"@@error global variableataterror global variable;error global variable
 if you want to print a user-defined error message and have the error number stored in @@error. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X40303"declare
MOREINFO="NONE", LINKEND="X60573"raiserrorTopics     LINKEND="X44102"Variables (Local and Global)System procedures     LINKEND="X36529"sp_addmessage
MOREINFO="NONE", LINKEND="X61947"sp_getmessage
ID="IN4613-2513092"print command
ID="IN468-2813393"Messagesprinting user-defined;Messages:screen;Printing user-defined messages
ID="IN4617-3213794"raiserror command
ID="IN4614-3313895"Error messagesuser-definedID="X60573"raiserrorID="IN476-3614297"ErrorsErrorsSee also Error messages!see also Error messages
ID="IN4744-3914598"User errors. See Errors; Severity levels
ID="IN4770-4214899"Information messages (Server). See Error messages; Severity levels
ID="IN4726-45151100"Mistakes, user. See Errors
Prints a user-defined error message on the user's screen and sets a system flag to record that an error condition has occurred. FORMAT="LINESPECIFIC"raiserror MOREINFO="NONE"error_number [{MOREINFO="NONE"format_string | @MOREINFO="NONE"local_variable}] [, MOREINFO="NONE"arg_list][extended_value = extended_value [{, extended_value = extended_value}...]]Keywords and OptionsREMAP="RI--RefIndent"ID="IN476-45151103"Errorsnumbers for user-defined
error_number - is an integer with a value greater than 17,000. If the error_number is between 17,000 and 19,999, and format_stringID="IN4717-49155104"sysmessages tableraiserror and
 is missing or empty (""), SQL Server retrieves error message text from the sysmessages table in the master database. These error messages are used chiefly by system procedures.REMAP="UN--Under"If error_number is 20,000 or greater and format_string is missing or empty, MOREINFO="NONE"raiserrorID="IN4721-53159105"sysusermessages tableraiserror and
 retrieves the message text from the sysusermessages table in the database from which the query or stored procedure originates. SQL Server attempts to retrieve messages from either sysmessages or sysusermessagesID="IN4724-55161106"@@langid global variablelangid global variable;atatlangid global variable
 in the language defined by the current setting of @@langid.ID="IN4746-55161107"Format strings, in user-defined error messages
format_string - is a string of characters with a maximum length of 255 bytes. Optionally, you can declare format_string in a local variable and use that variable with MOREINFO="NONE"raiserror (see @local_variable).REMAP="UN--Under"MOREINFO="NONE"raiserror recognizes place holders in the character string that is to be printed out. Format strings may contain up to 20 unique place holders in any order. These placeholders are replaced with the formatted contents of any arguments that follow format_string when the text of the message is sent to the client. REMAP="UN--Under"To allow reordering of the arguments when format strings are translated to a language with a different grammatical structure, the place holders are numbered. A place holder for an argument appears in this format: %nn!
, a percent sign (%), followed by an integer from 1 to 20, followed by an exclamation point (!). The integer represents the argument number in the string in the argument list. "%1!" is the first argument in the original version, "
%2!" is the second argument, and so on. REMAP="UN--Under"Indicating the position of the argument in this way makes it possible to translate correctly even when the order in which the arguments appear in the target language is different from their order in the source language. REMAP="UN--Under"For example, assume the following is an English message: REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"%1! is not allowed in %2!.  REMAP="UN--Under"The German version of this message is: REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"%1! ist in %2! nicht zulassig. REMAP="UN--Under"The Japanese version of this message is:FLOAT="0"FORMAT="UNKNOWN" FILEREF="fig1_1_5.xwd"REMAP="UN--Under"In this example, "%1!" in all three languages represents the same argument, and "
%2!" 
also represents a single argument in both languages. This example shows the reordering of the arguments that is sometimes necessary in the translated form. ID="IN4715-55161108"Local variablesLocal variablesin user-defined error messagesuser-defined error messagesID="IN4715-57163109"Local variablesraiserror and
@local_variable - is a local variable containing the format_string value. It must be of type char or varchar and must be declared within the batch or procedure in which it is used. ID="IN479-57163110"ArgumentsArgumentsin user-defined error messagesuser-defined error messagesarg_list - is a series of variables or constants separated by commas. arg_list is optional unless a format string containing place holders of the form %nn! is provided. An argument can be any datatype except text or image; it is converted to the char datatype before being included in the final string. REMAP="UN--Under"If an argument evaluates to NULL, SQL Server converts it into a zero-length char string. ID="IN4745-57163111"Extended data, in user-defined error messagesextended_value - is a string of characters with a maximum length of 255 bytes. Optionally, you can use a global or local variable in place of an extended_value. REMAP="UN--Under"When SQL Server detects certain errors, it attempts to return the names of the tables and columns involved with the error message to the Open-Client application. These errors include duplicate key violations, rule violations, and integrity constraint violations. Client applications can use these values (called extended error data) to indicate which columns are involved in the error or other information related to error message.REMAP="UN--Under"MOREINFO="NONE"raiserror extends this capability to user-defined error messages. For example, you can specify the extended error data with an error message in a trigger or stored procedure to indicate which table column is involved. When the trigger or stored procedure detects that error, SQL Server passes the table column value to your client application.REMAP="UN--Under"The names of each extended error data value specified for user-defined error messages must be known by the client application to access its information. For more information, see your Open-Client documentation.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create procedure showtable_sp @tabname varchar(18) as if not exists (select name from sysobjects     where name = @tabname)     begin      raiserror 99999 "Table %1! not found.",        @tabname     end else     begin       select sysobjects.name, type, crdate, indid       from sysindexes, sysobjects       where sysobjects.name = @tabname       and sysobjects.id = sysindexes.id     endREMAP="UN--Under"This stored procedure example returns an error if it does not find the table supplied with the @tabname parameter variable.sp_addmessage 25001,"There is already a remote user named '%1!'for remote server '%2!'." raiserror 25001, jane, myserverREMAP="UN--Under"This example adds a message to sysusermessages, then tests the message with MOREINFO="NONE"raiserror, providing the substitution arguments.raiserror 20100 "Login must be at least 5    characters long" "column" = "login",    "server" = @@servernameREMAP="UN--Under"This example returns the extended error data column and transtate to a client application to indicate which column was involved and to indicate which server was used.CommentsMARK="BULL" REMAP="BU--Bullet"User-defined messages can be generated ad hoc, as in the example above, or they can be added to the system table sysusermessages for use by any application. Use MOREINFO="NONE"sp_addmessage to add messages to sysusermessages; use MOREINFO="NONE"sp_getmessage to retrieve messages for use by MOREINFO="NONE"print and MOREINFO="NONE"raiserror. Error numbers for user-defined error messages must be greater than 20,000. The maximum value is 2,147,483,647 (231 -1). ID="IN4722-57163114"Severity levels, errorSeverity levels, errorand user-defined messagesuser-defined messagesThe severity level of all user-defined error messages is 16. This level indicates that the user has made a a non-fatal mistake.The maximum output string length of format_string plus all arguments after substitution is 512 bytes. If you use place holders in a format string, keep this in mind: for each place holder n in the string, the place holders 1 through n-1 must also exist in the same string (although they do not have to be in numerical order). For example, you cannot have place holders 1 and 3 in a format string without having the place holder 2 in the same string. If you do omit a number in a format string, an error message is generated when MOREINFO="NONE"raiserror is executed. If there are too few arguments relative to the number of placeholders in format_string
, an error message displays and the transaction is aborted. It is permissible to have more arguments than placeholders in format_string
. To include a literal percent sign as part of the error message, use two per cent signs ("%%") in the format_string. If you include a single per cent sign ("%") in the format_string
 which is not used as a placeholder, SQL Server returns an error message.If an argument evaluates to NULL, it is converted into a zero-length char string. If you do not want zero-length strings in the output, use the MOREINFO="NONE"isnull function (see the section "LINKEND="X80972"System Functions
" in this chapter). When MOREINFO="NONE"raiserrorID="IN4723-59165115"@@error global variableerror global variable;ataterror global variable
 is executed, the error number is placed in the global variable @@error, which stores the error number most recently generated by the system. ID="IN4717-63169116"raiserror commandcompared to printUse MOREINFO="NONE"raiserror instead of MOREINFO="NONE"print if you want an error number stored in @@error. To include an arg_list with MOREINFO="NONE"raiserror, put a comma after error_number or format_string before the first argument. To include extended error data, separate the first extended_value from error_number, format_string, or arg_list using a space (not a comma).Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X40303"declare
MOREINFO="NONE", LINKEND="X69372"printTopics     LINKEND="X44102"Variables (Local and Global)System procedures     LINKEND="X36529"sp_addmessage
MOREINFO="NONE", LINKEND="X61947"sp_getmessage
ID="IN4717-67173120"raiserror command
ID="IN4714-68174121"Error messagesuser-defined
ID="IN4716-72178122"readtext commandID="X28630"readtext
Reads textID="IN4814-76183124"image datatypepointer values in readtext
 and image values, starting from a specified offset and reading a specified number of bytes or characters. FORMAT="LINESPECIFIC"readtext [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name.MOREINFO="NONE"column_nametext_pointer MOREINFO="NONE"offset MOREINFO="NONE"size [holdlock][using {bytes | chars | characters}] Keywords and OptionsREMAP="RI--RefIndent"table_name.column_name - the name of the text or image column must include the table name. The database name and owner name are optional. text_pointer- a varbinary(16)ID="IN4830-80187127"Pointers, text or image column
 value that stores the pointer to the text or imageID="IN4816-84191128"textptr functionreadtext and
 data. Use the MOREINFO="NONE"textptrID="IN4814-88195129"image datatypestorage on separate devices;text datatype:separate storage of
 function to determine this value, as shown in the example below. Text and image data is not stored in the same set of linked pages as other table columns. It is stored in a separate set of linked pages. A pointer to the actual location is stored with the data; MOREINFO="NONE"textptr returns this pointer.ID="IN4815-90197130"Offset positionreadtext commandoffset - specifies the number of bytes or characters to skip before starting to read text or image data. ID="IN484-92199131"Sizereadtext datasize - specifies the number of bytes or characters of data to read. ID="IN4816-96203132"holdlock keywordreadtext
MOREINFO="NONE"holdlockID="IN487-96203133"Lockingtext for reads
 - causes the text value to be locked for reads until the end of the transaction. Other users can read the value but they cannot modify it. ID="IN4822-100207134"using option, readtext
MOREINFO="NONE"using - specifies whether MOREINFO="NONE"readtext interprets the MOREINFO="NONE"offset and MOREINFO="NONE"sizeID="IN4822-104211135"bytes option, readtext
 parameters as a number of bytes (MOREINFO="NONE"bytesID="IN4836-110217136"chars or characters option, readtext
) or as a number of characters (MOREINFO="NONE"chars or MOREINFO="NONE"characters are synonymous). This option has no effect when used with a single-byte character set or with image values (MOREINFO="NONE"readtext reads image values only on a byte-by-byte basis). If the MOREINFO="NONE"using option is not given, MOREINFO="NONE"readtext interprets the size and offset arguments as bytes. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table texttest (title_id varchar(6), blurb text null,     pub_id char(4))REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert texttest values ("BU1032", "The Busy Executive's Database Guide is anoverview of available database systems withemphasis on common business applications. Illustrated.", "1389") REMAP="UI--UserInput" FORMAT="LINESPECIFIC"declare @val varbinary(16) select @val = textptr(blurb) from texttest  where title_id = "BU1032" readtext texttest.blurb @val 1 5 using chars REMAP="UN--Under"After creating the table texttest and entering values into it, this example selects the second through the sixth character of the blurb column. CommentsID="IN484-112219139"Sizereadtext data;Number (quantity of):bytes in returned text
ID="IN4816-114221140"textptr functionMARK="BULL" REMAP="BU--Bullet"The MOREINFO="NONE"textptr function returns a 16-byte binary string (text pointer) to the text or image column in the specified row, or to the text or image column in the last row returned by the query, if more than one row is returned. It is best to declare a local variable to hold the text pointer, and then use the variable with MOREINFO="NONE"readtext. ID="IN4826-118225141"@@textsize global variableatattextsize global variablereadtext andreadtext and;textsize global variable:readtext andThe value in the global variable @@textsize, which is the limit on the number of bytes of data to be returned, supersedes the size specified for MOREINFO="NONE"readtext if it is less than that size. Use MOREINFO="NONE"set MOREINFO="NONE"textsize to change the value of @@textsize. ID="IN4819-118225142"?? (question marks)for partial characters;Partial characters, reading;Question marks (??):for partial charactersWhen using bytes as the offset and size, SQL Server may find partial characters at the beginning or end of the text data to be returned. If it does and character set conversion is on, the server replaces each partial character with a question mark (?) before returning the text to the client. SQL Server has to determine the number of bytes to send to the client in response to a MOREINFO="NONE"readtextID="IN4822-122229143"using option, readtext
 command. When the offset and size are in bytes, determining the number of bytes in the returned text is simple. When the offset and size are in characters, the server must take an extra step to calculate the number of bytes being returned to the client. As a result, performance may be slower when using characters as the offset and size. MOREINFO="NONE"using characters ID="IN4824-124231144"Multibyte character setsreadtext and
is only useful when SQL Server is using a multibyte character set: this option insures that MOREINFO="NONE"readtext will not return partial characters. ID="IN485-126233145"Viewsreadtext andYou cannot use MOREINFO="NONE"readtext on text and image columns in views. ID="IN4835-130237146"dbcc (Database Consistency Checker)readtext andIf you attempt to use MOREINFO="NONE"readtext on textID="IN4824-132239147"Multibyte character setsreadtext using characters for
 values after changing to a multibyte character set and have not run MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text, the command fails and an error message is generated instructing you to run MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text on the table. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance levelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"readtext requires MOREINFO="NONE"select permission on the table. MOREINFO="NONE"readtext permission is transferred when MOREINFO="NONE"select permission is transferred.See AlsoCommands     LINKEND="X64136"set
MOREINFO="NONE", LINKEND="X97484"writetextFunctions     LINKEND="X29354"text and image FunctionsTopics     LINKEND="X39672"text and image Datatypes
ID="IN4816-136243151"readtext command
ID="IN4819-140247152"reconfigure commandID="X18140"reconfigureID="IN4923-140248154"Configuration variables
ID="IN4911-140248155"Performance
Sets configuration variables that control various aspects of SQL Server's memory allocation, performance, and options. Used with the system procedure MOREINFO="NONE"sp_configureID="IN4929-144252156"sp_configure system procedurereconfigure and
ID="IN4957-147255157"Current configuration values. See Configuration variables
. FORMAT="LINESPECIFIC"reconfigure [with override] Keywords and OptionsREMAP="RI--RefIndent"ID="IN4920-151259160"with override optionreconfigure
MOREINFO="NONE"with MOREINFO="NONE"override - instructs SQL Server to accept the values for system variables supplied by the user (with MOREINFO="NONE"sp_configure). If the user supplies values to MOREINFO="NONE"sp_configure that SQL Server cannot accept, an error message is displayed. REMAP="UN--Under"The MOREINFO="NONE"with MOREINFO="NONE"override clause must always be used when you set MOREINFO="NONE"sp_configure's MOREINFO="NONE"allow updates variable to "1." ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"reconfigure REMAP="UN--Under"ID="IN4931-151259162"Dynamic configuration variablesdynamic and staticFORMAT="LINESPECIFIC"The dynamic values in the system table ID="IN4919-155263163"sysconfigures tablereconfigure andmaster..sysconfiguresID="IN4927-155263164"Static configuration valuesID="IN4916-155263165"Restarts, Server go into effect immediately. The static values take effect the next time you restart SQL Server. CommentsID="IN4954-158266167"Parameters, configuration. See Configuration variables
ID="IN496-158266168"Valuesconfiguration variable;Variables:configurationMARK="BULL" REMAP="BU--Bullet"To display a list of the configuration variables along with their current values and the range of permissible values, execute MOREINFO="NONE"sp_configure without specifying any parameters.ID="IN498-158266169"Changingconfiguration variablesTo change a configuration variable, execute MOREINFO="NONE"sp_configure with its parameters optname (the name of the configuration variable) and optvalue (a legal value). Then issue the MOREINFO="NONE"reconfigure command. Include the MOREINFO="NONE"with MOREINFO="NONE"override clause if you are turning the MOREINFO="NONE"allow updates variable on. SQL Server checks to make sure that the new values in sysconfigures are acceptable (SQL Server is able to run) and reasonable (SQL Server will run optimally). ID="IN4910-158266170"Sort orderchanges to defaultDo not use MOREINFO="NONE"reconfigure to change the default sort order of SQL Server. See the System Administration Guide for information about changing sort order. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"reconfigure permission defaults to System Administrators, and is not transferable. See AlsoSystem procedures     LINKEND="X60334"sp_configure
ID="IN4919-162270174"reconfigure command
ID="IN4914-166274175"return commandID="X44808"returnID="IN5016-170279177"Batch processingreturn status;Exit:unconditional, and return command
ID="IN5013-170279178"Return statusstored procedure;Stored procedures:return status
Exits from a batch or procedure unconditionally, optionally providing a return status. Statements following MOREINFO="NONE"returnID="IN5040-175284179"Stopping a procedure. See return command
ID="IN5039-180289180"Leaving a procedure. See return command
 are not executed. FORMAT="LINESPECIFIC"return [MOREINFO="NONE"integer_expression] Keywords and OptionsREMAP="RI--RefIndent"integer_expression - is the integer value returned by the procedure. Stored procedures can return an integer value to a calling procedure or application program. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create procedure findrules @nm varchar(30) = null as if @nm is null begin   print "You must give a user name"   return end else begin    select sysobjects.name, sysobjects.id,   sysobjects.uid  from sysobjects, master..syslogins    where master..syslogins.name = @nm    and sysobjects.uid = master..syslogins.suid    and sysobjects.type = "R" end REMAP="UN--Under"If no user name is given as a parameter, the MOREINFO="NONE"return command causes the procedure to exit after a message has been sent to the user's screen. If a user name is given, the names of the rules created by this user in the current database are retrieved from the appropriate system tables. print "Begin update batch"update titles    set price = price + $3    where title_id = 'BU2075'update titles    set price = price + $3    where title_id = 'BU1111'if (select avg(price) from titles        where title_id like 'BU%') > $15begin      print "Batch stopped; average price over $15"    returnendupdate titles    set price = price + $2      where title_id = 'BU1032'REMAP="UN--Under"If the updates cause the average price of business titles to exceed $15, the MOREINFO="NONE"return command terminates the batch before any more updates are performed on titles.create proc checkcontract @param varchar(11) as declare @status int if (select contract from titles where title_id = @param) = 1    return 1 else    return 2 REMAP="UN--Under"This procedure creates two user-defined status codes: a value of 1 is returned if the contract column contains a 1; a value of 2 is returned for any other condition (a value of 0 on contract, or a title_id that did not match a row). CommentsMARK="BULL" REMAP="BU--Bullet"The return status value can be used in subsequent statements in the batch or procedure that executed the current procedure, but must be given in the form: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"execute @MOREINFO="NONE"retvalMOREINFO="NONE" = MOREINFO="NONE"procedure_nameMOREINFO="NONE" REMAP="UN--Under"See "LINKEND="X30305"execute
" for more information. ID="IN506-180289185"Errorsreturn status values;List:error return values;List:reserved return status values;Reserved return status values
ID="IN507-180289186"Numberserror return values (Server)SQL Server reserves 0 to indicate a successful return, and negative values in the range -1 to -99 to indicate different reasons for failure. If no user-defined return value is provided, the SQL Server value is used. User-defined return status values must not conflict with those reserved by SQL Server. Numbers 0 and -1 to -14 are currently in use: TOCENTRY="1"LBL="Table 1-21: "SQL Server error return valuesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="12*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ValueCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0" 0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Procedure executed without error COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Missing object COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Datatype error COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-3COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Process was chosen as deadlock victim COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Permission error COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-5COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Syntax error COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-6 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Miscellaneous user error COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-7COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Resource error, such as out of space COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-8COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Non-fatal internal problem COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-9COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"System limit was reached COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-10COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fatal internal inconsistency COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-11COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fatal internal inconsistency COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-12COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table or index is corrupt COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-13COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database is corrupt COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-14COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Hardware error REMAP="UN--Under"Values -15 to -99 are reserved for future SQL Server use. ID="IN5010-180289187"PrecedencePrecedenceof user-defined return valuesuser-defined return valuesIf more than one error occurs during execution, the status with the highest absolute value is returned. User-defined return values always take precedence over SQL Server-supplied return values. The MOREINFO="NONE"return command can be used at any point where you want to exit from a batch or procedure. Return is immediate and complete: statements after MOREINFO="NONE"return are not executed. ID="IN5011-180289188"Null valuesstored procedures cannot returnA stored procedure cannot return a NULL return status. If a procedure attempts to return a null value, for example, using MOREINFO="NONE"return @MOREINFO="NONE"status where @MOREINFO="NONE"status is NULL, a warning message is generated, and a value in the range of 0 to -14 is returned. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X55146"begin...end,
 LINKEND="X30305"execute
MOREINFO="NONE", LINKEND="X74736"if...else
MOREINFO="NONE", LINKEND="X37548"while
ID="IN5016-184293192"Batch processingreturn status;Exit:unconditional, and return command
ID="IN5014-188297193"return command
ID="IN5014-192301194"revoke commandID="X29921"revokeID="IN5111-195305196"Permissionsrevoke command
Revokes permissions from users. FORMAT="LINESPECIFIC"REMAP="BO--Body"To revoke permission to access database objects:FORMAT="LINESPECIFIC"revoke [grant option for] {all [privileges] | MOREINFO="NONE"permission_list} on {MOREINFO="NONE" table_name [(MOREINFO="NONE"column_list)]     | MOREINFO="NONE"view_name [(MOREINFO="NONE"column_list)]     | stored_MOREINFO="NONE"procedure_name}from {public | MOREINFO="NONE"name_list | role_name}[cascade]REMAP="BO--Body"To revoke permission to create database objects:FORMAT="LINESPECIFIC"revoke {all [privileges] | MOREINFO="NONE"command_list} from {public | MOREINFO="NONE"name_list | role_name}Keywords and OptionsREMAP="RI--RefIndent"ID="IN5111-199309199"all keywordrevoke
MOREINFO="NONE"all - when used to revoke permission to access database objects (the first syntax format), MOREINFO="NONE"all specifies that all permissions applicable to the specified object are revoked. All object owners can use MOREINFO="NONE"revoke MOREINFO="NONE"all with an object name to revoke permissions on their own objects. REMAP="UN--Under"Only the System Administrator or the Database Owner can revoke permission to revoke create database objects (the second syntax format). When used by the System Administrator, MOREINFO="NONE"revoke all revokes all MOREINFO="NONE"create permissions (MOREINFO="NONE"create database, MOREINFO="NONE"create default, MOREINFO="NONE"create procedure, MOREINFO="NONE"create rule, MOREINFO="NONE"create table, and MOREINFO="NONE"create view). When the Database Owner uses MOREINFO="NONE"revoke all, SQL Server revokes all MOREINFO="NONE"create permissions except MOREINFO="NONE"create database, and prints an informational message. permission_list - is a list of permissions to be revoked. If more than one permission is listed, separate them with commas. The following table illustrates the access permissions that can be granted and revoked on each type of object:TOCENTRY="1"LBL="Table 1-22: "Object access permissionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="2*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ObjectCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"permission_list Can Include:VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table or viewCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select, insert, delete, update, referencesCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"columnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select, update, references 
Column names can be specified in either 
permission_list or column_list (see example 2).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"stored procedureCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"executeREMAP="UN--Under"Permissions can only be revoked by the user who granted them.ID="IN5119-199309200"Command permissionsrevokingcommand_list - is a list of object creation permissions to be revoked. If more than one command is listed, separate them with commas. The command list can include MOREINFO="NONE"create database, MOREINFO="NONE"create default, MOREINFO="NONE"create procedure, MOREINFO="NONE"create rule, MOREINFO="NONE"create table, and MOREINFO="NONE"create view. MOREINFO="NONE"create database permission can be revoked only by a System Administrator and only from the master database.table_name - is the name of the table on which you are revoking permissions. The table must be in your current database. Only one object can be listed for each MOREINFO="NONE"revoke statement. column_list - is a list of columns, separated by commas, to which the privileges apply. If columns are specified, only MOREINFO="NONE"select and MOREINFO="NONE"update permissions can be revoked. view_name - is the name of the view on which you are revoking permissions. The view must be in your current database. Only one object can be listed for each MOREINFO="NONE"revoke statement. stored _procedure_name - is the name of the stored procedure on which you are revoking permissions. The stored procedure must be in your current database. Only one object can be listed for each MOREINFO="NONE"revoke statement. ID="IN5114-203313201""public" grouppublic group];public keywordrevoke
MOREINFO="NONE"public - is all users. For object access permissions, MOREINFO="NONE"public excludes the object owner. For object creation permissions, MOREINFO="NONE"public excludes the Database Owner (who "owns" object creation permissions within the database).name_list - is a list of user and/or group names, separated by commas. role_name -  is the name of a SQL Server role. This allows you to revoke permissions from all users who have been granted a specific role. The roles are MOREINFO="NONE"sa_role (System Administrator)MOREINFO="NONE", sso_role (System Security Officer)MOREINFO="NONE", and MOREINFO="NONE"oper_role (Operator). Roles are granted with MOREINFO="NONE"sp_role.ID="IN5131-207317202"grant option for option, revoke
MOREINFO="NONE"grant option for - revokes MOREINFO="NONE"with grant option permissions, so that the user(s) specified in name_list can no longer grant the specified permissions to other users. If those other users have granted permissions to other users, you must use the MOREINFO="NONE"cascade option to revoke permissions from them as well. The user specified in name_list retains permission to access the object, but can no longer grant access to other users. MOREINFO="NONE"grant option for applies only to object access permissions, not to object creation permissions.ID="IN5122-211321203"cascade option, revoke
MOREINFO="NONE"cascade - for use with MOREINFO="NONE"grant option for: revokes the specified object access permissions from all users to whom the revokee granted permissions. Applies only to object access permissions, not to object creation permissions. (When you use MOREINFO="NONE"revoke without MOREINFO="NONE"grant option for, permissions granted to other users by the revokee are also revoked: the cascade occurs automatically.)ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"revoke insert, delete on titles from mary, salesREMAP="UN--Under"Revokes MOREINFO="NONE"insert and MOREINFO="NONE"delete permissions on the titles table from Mary and the "sales" group.revoke updateon titles (price, advance)from publicREMAP="UN--Under"or:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"revoke update (price, advance)on titlesfrom publicREMAP="UN--Under"Two ways to revoke MOREINFO="NONE"update permission on the price and advance columns of the titles table from "public".revoke create database, create table from mary, john REMAP="UN--Under"Revokes permission to use the MOREINFO="NONE"create database and MOREINFO="NONE"create table commands from Mary and John. Because MOREINFO="NONE"create database permission is being revoked, this command must be executed by a System Administrator from within the master database. Mary and John's MOREINFO="NONE"create table permission will be revoked only within the master database.revoke allfrom maryREMAP="UN--Under"Revokes all object creation permissions from Mary in the current database.revoke allon titlesfrom mary REMAP="UN--Under"Revokes all object access permissions on the titles table from Mary.revoke referenceson titles (price, advance)from tomREMAP="UN--Under"or:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"revoke references (price, advance)on titlesfrom tomREMAP="UN--Under"Two ways to revoke Tom's permission to create a referential integrity constraint on another table that refers to the price and advance columns of the titles table.revoke execute on new_sprocfrom oper_roleREMAP="UN--Under"Revokes permission to execute the new_sproc stored procedure from all users who have been granted the Operator role.revoke grant option forinsert, update, deleteon authorsfrom johncascadeREMAP="UN--Under"Revokes John's permission to grant MOREINFO="NONE"insert, update, and MOREINFO="NONE"delete permissions on the authors table to other users. Also revokes from other users any such permissions that John has granted.ID="IN5111-211321205"Permissionsgroups andID="X48199"CommentsMARK="BULL" REMAP="BU--Bullet"See the LINKEND="X69087"grant
 command for a table covering permissions. ID="IN5117-211321207"Stored procedurespermissions revokedYou can only grant or revoke permissions on objects in your current database.You can only revoke permissions that were granted by you.ID="IN5110-211321208"Precedenceorder-sensitive commands and
ID="IN518-211321209"Commandsorder sensitive;Order of commands
MOREINFO="NONE"grant and MOREINFO="NONE"revoke commands are order-sensitive. When there is a conflict, the command issued most recently takes effect. ID="IN519-215325210"to optionrevokeThe word MOREINFO="NONE"to can be substituted for the word MOREINFO="NONE"from in the MOREINFO="NONE"revoke syntax.Permissions granted to roles override permissions granted to individual users or groups. Therefore, if you revoke a permission from a user who has been granted a role, and the role has that same permission, the user will retain it. For example, say John has been granted the System Security Officer role, and MOREINFO="NONE"sso_role has been granted permission on the sales table. If John's individual permission on sales is revoked, he is still able to access sales because his role permissions override his individual permissions.Revoking a specific permission from "public" or from a group also revokes it from users who were individually granted the permission. ID="IN5143-218328211"User groups. See Groups; "public" group
ID="IN5114-220330212""public" grouppublic group];Groupsrevoke andDatabase user groups allow you to MOREINFO="NONE"grant or MOREINFO="NONE"revoke permissions to more than one user at a time. A user can only be a member of one group and is always a member of the default group, "public". SQL Server's installation script assigns a set of permissions to "public".REMAP="UN--Under"Groups are created with the system procedure MOREINFO="NONE"sp_addgroup and removed with MOREINFO="NONE"sp_dropgroup. New users can be added to a group with MOREINFO="NONE"sp_adduser. A user`s group membership can be changed with MOREINFO="NONE"sp_changegroup. To display the members of a group, use MOREINFO="NONE"sp_helpgroup. If you do not specify MOREINFO="NONE"grant option for in a MOREINFO="NONE"revoke statement, MOREINFO="NONE"with grant option permissions are revoked from the user along with the specified object access permissions. In addition, if the user has granted the specified permissions to any other users, all of those permissions are revoked. In other words, the MOREINFO="NONE"revoke automatically cascades.ID="IN5122-224334213"cascade option, revokeMOREINFO="NONE"revoke grant option revokes the user's ability to grant the specified permission to other users, but does not revoke the permission itself from that user. If the user has granted that permission to others, you must use the MOREINFO="NONE"cascade option or you receive an error message and the MOREINFO="NONE"revoke fails.REMAP="UN--Under"For example, say you revoke the MOREINFO="NONE"with grant option from the user Bob on titles, with this statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"revoke grant option for allfor selecton titlesfrom bobcascadeMARK="DASH" REMAP="BS--BulletSub"If Bob has not granted this permission to other users, this command revokes his ability to grant this permission to others, but he retains MOREINFO="NONE"select permission on the titles table.If Bob has granted this permission to other users, you must use the MOREINFO="NONE"cascade option. If you do not, you receive an error message and the MOREINFO="NONE"revoke fails. MOREINFO="NONE"cascade revokes this MOREINFO="NONE"select ID="IN518-226336214"Messagesrevoke
permission from all users to whom Bob has granted it, as well as their ability to grant it to others.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X69087"grant
MOREINFO="NONE", LINKEND="X97464"setuserTopics     LINKEND="X96191"RolesSystem procedures     LINKEND="X65925"sp_addgroup
MOREINFO="NONE", LINKEND="X68639"sp_adduser
MOREINFO="NONE", LINKEND="X78355"sp_changedbowner
MOREINFO="NONE", LINKEND="X18596"sp_changegroup
MOREINFO="NONE", LINKEND="X17416"sp_dropgroup
MOREINFO="NONE", LINKEND="X46789"sp_dropuser
MOREINFO="NONE", LINKEND="X25329"sp_helpgroup
MOREINFO="NONE", LINKEND="X22708"sp_helprotect
MOREINFO="NONE", LINKEND="X28192"sp_helpuser
MOREINFO="NONE", LINKEND="X39296"sp_roleREMAP="BO--Body"ID="X91510"rollbackID="IN434079235"Changes, canceling. See rollback command
ID="IN434374286"Transaction canceling. See rollback command
ID="IN431269337"TransactionsTransactionsSee also Batch processing; rollback command; User-defined transactions!see also
ID="IN433764388"Undoing changes. See rollback command
ID="IN431861419"Checkpoint processCheckpoint processSee also Recovery; Savepoints!see also Recovery; Savepoints
ID="IN4356584410"Markers, user-defined. See Place holders; Savepoints
Rolls a user-defined transaction back to the last savepoint inside the transaction or to the beginning of the transaction. FORMAT="LINESPECIFIC"rollback {transaction | tran | work}[MOREINFO="NONE"transaction_name |MOREINFO="NONE" savepoint_name]Keywords and OptionsREMAP="RI--RefIndent"transaction_name - is the name assigned to the transaction. It must conform to the rules for identifiers. ID="IN4310564613"Savepointsrollback and
savepoint_name - is the name assigned to the savepoint in the MOREINFO="NONE"save transaction statement. The name must conform to the rules for identifiers. CommentsMARK="BULL" REMAP="BU--Bullet"See "LINKEND="X19352"Transactions
" in Chapter 3 for full information on using transaction management statements and on the effects of MOREINFO="NONE"rollback on stored procedures, triggers and batches. MOREINFO="NONE"rollback, without a savepoint name, cancels an entire transaction. All of the transaction's statements or procedures are undone. To cancel part of a transaction, use MOREINFO="NONE"rollback with a savepoint_name. A savepoint is a marker set by the user within a transaction using the command MOREINFO="NONE"save transaction. All of the statements or procedures between the savepoint and the MOREINFO="NONE"rollback are undone.REMAP="UN--Under"After a transaction is rolled back to a savepoint, it can proceed to completion (executing any SQL statements after that MOREINFO="NONE"rollbackID="IN4314525015"commit commandrollback and
) using MOREINFO="NONE"commit, or it can be canceled altogether using MOREINFO="NONE"rollback without a savepoint. There is no limit on the number of savepoints within a transaction. ID="IN4325485416"begin transaction commandrollback toIf no savepoint_name or transaction_name is given with the MOREINFO="NONE"rollback command, the transaction is rolled back to the first MOREINFO="NONE"begin transaction in the batch. This also includes transactions started through an implicit MOREINFO="NONE"begin transaction using the chained transaction mode.REMAP="UN--Under"In triggers or stored procedures, MOREINFO="NONE"rollback statements, without transaction or savepoint names, roll back all statements to the first explicit or implicit MOREINFO="NONE"begin transaction in the batch that called the procedure or fired the trigger. The MOREINFO="NONE"rollback command must appear within a transaction. You cannot roll back a transaction after MOREINFO="NONE"commit has been entered. ID="IN438465617"Triggersrollback inWhen a trigger contains a MOREINFO="NONE"rollback command without a savepoint name, the rollback aborts the entire batch, and any statements in the batch following the rollback will not be executed. If no transaction is currently active, the MOREINFO="NONE"commit or MOREINFO="NONE"rollback statement has no effect.ID="IN4322445818"Remote procedure callsrollback andA remote procedure call (RPC) is executed independently from any transaction in which it is included. In a standard transaction (that is, not using Open Client DB-Library two-phase commit), commands executed via an RPC by a remote server are not rolled back with MOREINFO="NONE"rollback, and do not depend on MOREINFO="NONE"commit to be executed.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantEntry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The MOREINFO="NONE"rollback MOREINFO="NONE"transaction and 
MOREINFO="NONE"rollback MOREINFO="NONE"tran forms of the statement 
and the use of a transaction name 
are Transact-SQL extensions.PermissionsREMAP="BO--Body"MOREINFO="NONE"rollback permission defaults to "public". No permission is required to use it. See AlsoCommands     LINKEND="X53982"begin transaction
MOREINFO="NONE", LINKEND="X89531"commit
MOREINFO="NONE", LINKEND="X19955"create trigger
MOREINFO="NONE", LINKEND="X69417"save transaction
ID="IN4316406223"rollback command
MOREINFO="NONE",Topics     LINKEND="X19352"Transactions
ID="IN4324366624"rollback trigger commandID="X80111"rollback triggerID="IN448366726"Triggersrolling back
Rolls back the work done in a trigger, including the data modification that caused the trigger to fire, and issues an optional MOREINFO="NONE"raiserror statement.FORMAT="LINESPECIFIC"rollback trigger[with raiserror_statement]Keywords and OptionsREMAP="RI--RefIndent"ID="IN4430327129"with keyword, rollback trigger
MOREINFO="NONE"with raiserror_statement -
specifies a MOREINFO="NONE"raiserror statement which prints a
user-defined error message and sets a system flag to record that an error condition has occurred. This provides the ability to raise an error to the client when the MOREINFO="NONE"rollback trigger is executed, so that the transaction state in the error reflects the rollback. For information about the syntax and rules defining raiserror_statement, see LINKEND="X60573"raiserror in this chapter.ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"rollback trigger with raiserror 25002    "title_id does not exist in titles table."REMAP="UN--Under"FORMAT="LINESPECIFIC"Rolls back a trigger and issues the user-defined error message 25002.CommentsMARK="BULL" REMAP="BU--Bullet"When the MOREINFO="NONE"rollback trigger is executed, SQL Server aborts the currently executing command and halts execution of the rest of the trigger.ID="IN448307332"Triggersnested, and rollback triggerIf the trigger that issues the MOREINFO="NONE"rollback trigger is nested within other triggers, SQL Server rolls back all work done in these triggers up to and including the update which caused the first trigger to fire.SQL Server ignores a MOREINFO="NONE"rollback trigger executed outside of a trigger and does not issue a MOREINFO="NONE"raiserror associated with the statement. However, a MOREINFO="NONE"rollback trigger executed outside of a trigger but inside a transaction generates an error which causes SQL Server to roll back the transaction and abort the current statement batch.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"rollback trigger permission defaults to "public". No permission is required to use it. See AlsoCommands     LINKEND="X19955"create trigger
MOREINFO="NONE", LINKEND="X60573"raiserror
MOREINFO="NONE", LINKEND="X91510"rollbackTopics     LINKEND="X19352"Transactions
ID="IN4412277637"Transactionssave transaction and
ID="IN4424238038"save transaction commandID="X69417"save transaction
Sets a savepoint within a transaction. FORMAT="LINESPECIFIC"save transaction MOREINFO="NONE"savepoint_name Keywords and OptionsREMAP="RI--RefIndent"savepoint_name - is the name assigned to the savepoint. It must conform to the rules for identifiers. CommentsMARK="BULL" REMAP="BU--Bullet"See LINKEND="X19352""Transactions" in this chapter for full information on using transaction statements. ID="IN4510218343"Savepointssetting using save transactionA savepoint is a user-defined marker within a transaction that allows portions of a transaction to be rolled back. The command MOREINFO="NONE"rollback savepoint_name rolls back to the indicated savepoint; all of the statements or procedures between the savepoint and the MOREINFO="NONE"rollback are undone. REMAP="UN--Under"Statements preceding the savepoint are not undone-but neither are they committed. After a transaction is rolled back to a savepoint, it can proceed to completion (executing any statements after that MOREINFO="NONE"rollbackID="IN4514178744"commit commandrollback and
) using MOREINFO="NONE"commit, or it can be canceled altogether using MOREINFO="NONE"rollback without a savepoint. There is no limit on the number of savepoints within a transaction. To cancel an entire transaction, use MOREINFO="NONE"rollback without a transaction name. All of the transaction's statements or procedures are undone, back to the first MOREINFO="NONE"begin transaction in the batch. If no savepoint_name or transaction_name is given with the MOREINFO="NONE"rollback command, all statements back to the first MOREINFO="NONE"begin transaction in a batch are rolled back and the transaction is cancelled. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"save MOREINFO="NONE"transaction permission defaults to "public." No permission is required to use it. See AlsoCommands     LINKEND="X53982"begin transaction
MOREINFO="NONE", LINKEND="X89531"commit
MOREINFO="NONE", LINKEND="X91510"rollbackTopics     LINKEND="X19352"Transactions
ID="IN4524139149"save transaction command
ID="IN4512109450"Transactionssave transaction and
 ID="IN4514310151"select commandID="X35229"selectID="IN4611-210753"Rows, tableRows, tableSee also select command!see also
ID="IN4660-811354"Nested select statements. See select command; Subqueries
Retrieves rows from database objects. FORMAT="LINESPECIFIC"select [all | distinct]
MOREINFO="NONE"select_list [into
[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name]
[from
[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name |MOREINFO="NONE"view_name}        [holdlock | noholdlock] [shared]    [,[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name |MOREINFO="NONE"view_name}        [holdlock | noholdlock] [shared]]... ]  [where MOREINFO="NONE"search_conditions]  [group by [all] MOREINFO="NONE"aggregate_free_expression    [, MOREINFO="NONE"aggregate_free_expression]... ][having MOREINFO="NONE"search_conditions] [order by {[[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name.|MOREINFO="NONE"view_name.}]    MOREINFO="NONE"column_name |MOREINFO="NONE" select_list_number |MOREINFO="NONE" expression}        [asc | desc][,{[[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name|MOREINFO="NONE"view_name.}]MOREINFO="NONE"    column_name |MOREINFO="NONE" select_list_number | MOREINFO="NONE"expression}         [asc | desc]]...] [compute MOREINFO="NONE"row_aggregate(MOREINFO="NONE"column_name)        [, MOREINFO="NONE"row_aggregate(MOREINFO="NONE"column_name)]...    [by MOREINFO="NONE"column_name [, MOREINFO="NONE"column_name]...]]  [for {read only | update [of column_name_list]}] [for browse]REMAP="BO--Body"The keywords in the MOREINFO="NONE"select statement, as in all other SQL statements, must be used in the order shown in the syntax statement. Keywords and OptionsREMAP="RI--RefIndent"ID="IN4611-1211757"all keywordselect
MOREINFO="NONE"all - includes all rows in the results. MOREINFO="NONE"all is the default. ID="IN4616-1612158"distinct keywordselect
MOREINFO="NONE"distinct - includes only unique rows in the results. Null values are considered equal for the purposes of the keyword MOREINFO="NONE"distinct: only one NULL is selected no matter how many are encountered. MOREINFO="NONE"distinct must be the first word in the select list. ID="IN4611-2012559"Select listselect_listselect_list - is one or more of the following items: ID="IN4631-2312860"* (asterisk). See Asterisks (*)MARK="BULL" REMAP="BU--Bullet""*", representing all columns inMOREINFO="NONE" create table order.A list of column names in the order in which you want to see them. When selecting an existing IDENTITY column, you can substitute the MOREINFO="NONE"syb_identity keyword, qualified by the table name where necessary, for the actual column name.A specification to add a new IDENTITY column to the result table:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    column_name = identity(precision)ID="IN4611-2412961"Column namespecifying in select;Columns:headingsA replacement for the default column heading (the column name), in the form:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"    column_heading = column_name REMAP="UN--Under"or:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    column_name column_headingREMAP="UN--Under"or: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    column_name as column_headingREMAP="UN--Under"The column heading may be enclosed in quotation marks for any of these forms. The heading must be enclosed in quotation marks if it is not a valid identifier (that is, if it is a reserved word, if it begins with a special character, or if it contains spaces or punctuation marks).An expression (a column name, constant, function, or any combination of column names, constants, and functions connected by arithmetic or bitwise operators, or a subquery).A built-in function or an aggregate Any combination of the items listed aboveREMAP="UN--Under"The select_list can also perform variable assignment, in the form: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"    @variable = expression                           [, @variable = expression ...]REMAP="UN--Under"You cannot combine variable assignment with any of the other select_list options.ID="IN4611-2813362"Select listselect_listREMAP="UN--Under"For more information, see LINKEND="X20204""Expressions", LINKEND="X56300""Functions" and LINKEND="X45943""Subqueries". REMAP="RI--RefIndent"ID="IN4644-3614163"into clause, select. See select into command
ID="IN4619-3914464"select into command
MOREINFO="NONE"intoID="IN468-3914465"Creatingnew tables;Tables:creating new
 - creates a new table based on the columns specified in the select list and the rows chosen in the MOREINFO="NONE"where clause. ID="IN4612-4314866"from keywordselect
MOREINFO="NONE"from - indicates which tables and views to use in the MOREINFO="NONE"select statement. It is always required except when the select list contains no column names (that is, constants and arithmetic expressions only): REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"select 5 x, 2 y, "the product is", 5*2 Result ID="IN465-4715267"Viewsallowed in a from clause;Number (quantity of):tables allowed in a query;Tables:allowed in a from clauseREMAP="UN--Under"At most, a query can reference 16 tables. This maximum includes:MARK="DASH" REMAP="BS--BulletSub"Tables (or views on tables) listed in the MOREINFO="NONE"from clauseEach instance of multiple references to the same table (self-joins)Tables referenced in subqueriesAny work tables created as a result of the query (such as using vector aggregate functions with a MOREINFO="NONE"group by clause)table_name, view_name - lists tables and views used in the MOREINFO="NONE"select statement. If there is more than one table or view in the list, separate their names by commas. The order of the tables and views after the keyword MOREINFO="NONE"from does not affect the results. REMAP="UN--Under"You can query tables in different databases in the same statement. ID="IN467-4915468"Aliasesselect;Names:aliasREMAP="UN--Under"Table names and view names can be given correlation names, either for clarity or to distinguish the different roles that a table or view play in a self-join or subquery. Give the table or view name, then a space, then the correlation name, like this: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"select pub_name, title_id    from publishers pu, titles t    where t.pub_id = pu.pub_idREMAP="UN--Under"All other references to that table, for example in a MOREINFO="NONE"where clause, must use the correlation name.ID="IN4616-5315869"holdlock keywordselect
MOREINFO="NONE"holdlock - makes a shared lock on a specified table or view more restrictive by holding it until the completion of a transaction (instead of releasing the shared lock as soon as the required data page is no longer needed, whether or not the transaction has been completed). REMAP="UN--Under"The MOREINFO="NONE"holdlock option applies only to the table or view for which it is specified, and only for the duration of the transaction defined by the statement in which it is used. Setting MOREINFO="NONE"transaction isolation level 3 option of the MOREINFO="NONE"set command implicitly applies a MOREINFO="NONE"holdlock for each MOREINFO="NONE"select within a transaction. The keyword MOREINFO="NONE"holdlock is not permitted in a MOREINFO="NONE"select statement that includes the MOREINFO="NONE"for MOREINFO="NONE"browse option. You cannot specify both a MOREINFO="NONE"holdlock and MOREINFO="NONE"noholdlock option in a query.ID="IN4626-5716270"noholdlock keyword, select
MOREINFO="NONE"noholdlock - prevents the server from holding any locks acquired during the execution of this MOREINFO="NONE"select statement, regardless of the transaction isolation level currently in effect. You cannot specify both a MOREINFO="NONE"holdlock and MOREINFO="NONE"noholdlock option in a query.ID="IN4614-6116671"shared keywordselect
MOREINFO="NONE"shared - instructs SQL Server to use a shared lock (instead of an update lock) on a specified table or view. This allows other clients to obtain an update lock on that table or view. You can use the MOREINFO="NONE"shared keyword only with a MOREINFO="NONE"select included as part of a MOREINFO="NONE"declare cursor statement. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"declare shared_crsr cursorfor select title, title_id from titles sharedwhere title_id like "BU%"REMAP="UN--Under"You can use the MOREINFO="NONE"holdlock keyword in conjunction with MOREINFO="NONE"shared after each table or view name, but MOREINFO="NONE"holdlock must precede MOREINFO="NONE"shared.ID="IN4617-6316872"Search conditionsselect
search_conditions - used to set the conditions for the rows that are retrieved. A search condition can include column names, expressions, arithmetic operators, comparison operators, the keywords MOREINFO="NONE"not, MOREINFO="NONE"like, MOREINFO="NONE"is null, MOREINFO="NONE"and, MOREINFO="NONE"or, MOREINFO="NONE"between,MOREINFO="NONE" in, MOREINFO="NONE"exists, MOREINFO="NONE"any, and MOREINFO="NONE"all, subqueries, or any combination of these items. Although there is no limit to the number of search conditions that can be included in a statement, a MOREINFO="NONE"where clause can include a maximum of 128 search conditions per table. MOREINFO="NONE"where search conditions and MOREINFO="NONE"having search conditions are identical with one exception: MOREINFO="NONE"where clauses cannot contain aggregates and MOREINFO="NONE"having clauses can. See the sections on MOREINFO="NONE"where Clause," LINKEND="X20204""Expressions," and LINKEND="X45943""Subqueries" for more information. ID="IN4615-6817373"group by clauseselect
MOREINFO="NONE"group by - finds a value for each group. These values appear as new columns in the results, rather than as new rows. REMAP="UN--Under"When MOREINFO="NONE"group by is used with standard SQL, each item in the select list must either have a fixed value in every row in the group or be used with aggregate functions, which produce a single value for each group. Transact-SQL has no such restrictions on the items in the select list. Also, Transact-SQL allows you to group by any expression (though not by a column alias), while with standard SQL you can only group by a column. REMAP="UN--Under"You can use these aggregates with MOREINFO="NONE"group by (expression is almost always a column name): TOCENTRY="1"LBL="Table 1-23: "Results of using aggregates with group byCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="17*"COLNAME="C2" COLWIDTH="23*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Aggregate FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Result VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sum([MOREINFO="NONE"all | MOREINFO="NONE"distinct] 
MOREINFO="NONE"expression)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Total of the values in the numeric column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"avg([MOREINFO="NONE"all | MOREINFO="NONE"distinct] 
MOREINFO="NONE"expression)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Average of the values in the numeric 
column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"count([MOREINFO="NONE"all | MOREINFO="NONE"distinct] 
MOREINFO="NONE"expression)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of (distinct) non-null values in the 
column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"count(*)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of selected rows COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"max(MOREINFO="NONE"expression)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Highest value in the column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"min(MOREINFO="NONE"expression)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Lowest value in the column REMAP="UN--Under"(SeeLINKEND="X96182" "group by and having Clauses" and "Aggregates" for more information.) REMAP="UN--Under"A table can be grouped by any combination of columns-that is, groups can be nested within each other. You cannot group by a column heading; you must use a column name, an expression, or a number representing the position of the item in the select list. ID="IN4615-7317874"group by clauseselectMOREINFO="NONE"group by all - includes all groups in the results, even those that don't have any rows that meet the search conditions. REMAP="UN--Under"(See "MOREINFO="NONE"group by and MOREINFO="NONE"having Clauses" for an example.) aggregate_free_expression - is an expression that includes no aggregates.ID="IN4613-7718275"having clauseselect
MOREINFO="NONE"having - sets conditions for the MOREINFO="NONE"group by clause, similar to the way that MOREINFO="NONE"where sets conditions for the MOREINFO="NONE"select clause. There is no limit on the number of conditions that can be included. REMAP="UN--Under"You can use a MOREINFO="NONE"having clause without a MOREINFO="NONE"group by clause. REMAP="UN--Under"If there are columns in the select list that neither have aggregate functions applied to them nor are included in the query's MOREINFO="NONE"group by clause (illegal in standard SQL), the meanings of MOREINFO="NONE"having and MOREINFO="NONE"where are somewhat different. REMAP="UN--Under"In this situation, a MOREINFO="NONE"where
clause restricts the rows that are included in the calculation of the aggregate, but does not restrict the rows returned by the query. Conversely, a MOREINFO="NONE"having clause restricts the rows returned by the query, but does not affect the calculation of the aggregate. See "LINKEND="X96182"group by and having Clauses" for examples. ID="IN4615-8118676"order by clauseselect
MOREINFO="NONE"order byID="IN467-8318877"Columnsorder by
 - sorts the results by columns. In Transact-SQL, you can MOREINFO="NONE"order byID="IN467-8318878"Numbersselect list;Select list
 items that do not appear in the select list. You can sort by a column name, a column heading (or alias), an expression, or a number representing the position of the item in the select list (the select_list_number). If you sort by select list number, the columns to which the MOREINFO="NONE"order by clause refers must be included in the select list, and the select list cannot be * (asterisk).ID="IN4628-8519079"Ascending order, asc keywordascending sort
MOREINFO="NONE"asc - sorts results in ascending order (the default). ID="IN4631-8719280"Descending order (desc keyword)descending sort
MOREINFO="NONE"desc - sorts results in descending order. ID="IN4614-9119681"compute clauseselect
MOREINFO="NONE"compute - used with row aggregates (MOREINFO="NONE"sum, MOREINFO="NONE"avg, MOREINFO="NONE"min, MOREINFO="NONE"max, and MOREINFO="NONE"count) to generate control break summary values. The summary values appear as additional rows in the query results, allowing you to see detail and summary rows with one statement. ID="IN4619-9520082"select into commandnot allowed with computeREMAP="UN--Under"You cannot use a MOREINFO="NONE"select MOREINFO="NONE"into clause with MOREINFO="NONE"compute. ID="IN4615-10320883"order by clausecompute by and;compute clause:order by andREMAP="UN--Under"If you use MOREINFO="NONE"compute by, you must also use an MOREINFO="NONE"order by clause. The columns listed after MOREINFO="NONE"compute by must be identical to or a subset of those listed after MOREINFO="NONE"order by, and must be in the same left-to-right order, start with the same expression, and not skip any expressions. REMAP="UN--Under"For example, if the MOREINFO="NONE"order by clause is: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"order by a, b, c REMAP="UN--Under"the MOREINFO="NONE"compute by clause can be any (or all) of these: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"compute by a, b, c compute by a, b compute by a REMAP="UN--Under"The keyword MOREINFO="NONE"compute can be
used withoutMOREINFO="NONE" by to generate grand totals, grand counts, etc. MOREINFO="NONE"order by is optional if you use MOREINFO="NONE"compute without MOREINFO="NONE"by. (See "LINKEND="X48334"compute Clause" for details and examples.) MOREINFO="NONE"for {MOREINFO="NONE"read only | MOREINFO="NONE"update} - specifies that a cursor result set is read-only or updatable. You can use this option only within a stored procedure, and only when the procedure defines a query for a cursor. In this case, the MOREINFO="NONE"select is the only statement allowed in the procedure, and it defines the MOREINFO="NONE"for read only or MOREINFO="NONE"for update option (instead of the MOREINFO="NONE"declare cursor statement). This method of declaring cursors provides the advantage of page-level locking while fetching rows.REMAP="UN--Under"If the MOREINFO="NONE"select in the stored procedure is not used to define a cursor, SQL Server ignores this option. See the Embedded SQL documentation for more information about declaring cursors using stored procedures. For information about read-only or updatable cursors, see LINKEND="X80039""Cursors" in Chapter 3,  "Transact-SQL Topics"
.MOREINFO="NONE"of column_name_list - is the list of columns from a cursor result set defined as updatable with the MOREINFO="NONE"for update option.ID="IN4611-10521084"Browse modeselectID="IN4625-10921485"for browse option, select
MOREINFO="NONE"for MOREINFO="NONE"browseID="IN4619-10921486"DB-Library programsbrowse mode
 - must be attached to the end of a SQL statement sent to SQL Server in a DB-Library browse application. (See "Browse Mode" and the DB-Library Reference Manual for details.) ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select * from publishers select pub_id, pub_name, city, state from publishers select "The publisher's name is", Publisher = pub_name, pub_id from publishers select type as Type, price as Pricefrom titlesselect pub_id, total = sum (total_sales)     into #advance_rptfrom titles where advance < $10000     and total_sales is not null group by pub_id having count(*) > 1 select "Author_name" = au_fname + " " + au_lname    into #tempnames    from authorsselect type, price, advance from titles order by type desc compute avg(price), sum(advance) by type compute sum(price), sum(advance) select type, price, advance from titles compute sum(price), sum(advance) select * into coffeetabletitles from titles where price > $20 select * into newtitles from titles where price > $25 and price < $20 select sales_east.syb_identity, sales_west.syb_identityfrom sales_east, sales_westselect *, row_id = identity(10)into newtitles from titlesID="X60399"CommentsMARK="BULL" REMAP="BU--Bullet"The keywords in the MOREINFO="NONE"select statement, as in all other statements, must be used in the order shown in the syntax statement. ID="IN4611-11321890"all keywordselectThe keyword MOREINFO="NONE"all can be used after MOREINFO="NONE"select for compatibility with other implementations of SQL. MOREINFO="NONE"all is the default. Used in this context, MOREINFO="NONE"allID="IN4616-11722291"distinct keywordselect
 is the opposite of MOREINFO="NONE"distinct: all retrieved rows are included in the results, whether or not some are duplicates. ID="IN4611-11922492"IdentifiersselectExcept in MOREINFO="NONE"create table, MOREINFO="NONE"create view, and MOREINFO="NONE"select into statements, column headings may include any characters, including blanks and SQL Server keywords, if the column heading is enclosed in quotes. If the heading is not enclosed in quotes, it must conform to the rules for identifiers. Column headings in MOREINFO="NONE"create table, MOREINFO="NONE"create view, and MOREINFO="NONE"select into statements, table aliases, and MOREINFO="NONE"select statements in stored procedures called by APT-SQL, must conform to the rules for identifiers. ID="IN4615-12322893"Not null valuesselect statements and;Null values:select statements and
To insert data with MOREINFO="NONE"select from a table that has null values in some fields into a table which does not allow null values, you must provide a substitute value for any NULL entries in the original table. For example, to insert data into an advances table that won't allow null values, this example substitutes "0" for the NULL fields:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert advancesselect pub_id, isnull(advance, 0) from titlesID="IN4622-12723294"isnull system functionselect andREMAP="UN--Under"Without the MOREINFO="NONE"isnull function, this command would insert all the rows with non-null values into advances, and produce error messages for all the rows where the advance column in titles contained NULL.REMAP="UN--Under"If this kind of substitution cannot be made for your data, it is not possible to insert the data containing null values into the columns with the NOT NULL specification.REMAP="UN--Under"Two tables may be identically structured, but differ in whether null values are permitted in some fields. You can use MOREINFO="NONE"sp_help to see the null types of the columns in your table.ID="IN4616-13223795"IDENTITY columnsselect andTo select an IDENTITYID="IN4620-13624196"syb_identity keywordselect and
 column into a result table, include the column name (or the MOREINFO="NONE"syb_identity keyword) in the MOREINFO="NONE"select statement's column_list. The new column observes the following rules:MARK="DASH" REMAP="BS--BulletSub"If an IDENTITY column is selected more than once, it is defined as NOT NULL in the new table. It does not inherit the IDENTITY property.If an IDENTITY column is selected as part of an expression, the resulting column does not inherit the IDENTITY property. It is created as NULL if any column in the expression allows nulls, and NOT NULL otherwise.If the select statement contains a MOREINFO="NONE"group by clause or aggregate function, the resulting column does not inherit the IDENTITY property. Columns that include an aggregate of the IDENTITY column are created NULL; others, NOT NULL. An IDENTITY column that is selected into a table with a union or join does not retain the IDENTITY property. If the table contains the union of the IDENTITY column and a NULL column, the new column is defined as NULL. Otherwise, it is defined as NOT NULL.The default length of text or image data returned with a MOREINFO="NONE"select statement is 32K. Use MOREINFO="NONE"set textsize to change the value. The size for the current session is stored in the global variable @@textsize. Certain client software may issue a MOREINFO="NONE"set textsize command on logging into the server.ID="IN4614-13624197"Remote serversData from remote SQL Servers can be retrieved through
the use of remote procedure calls. See LINKEND="X52197"create
procedure and LINKEND="X30305"execute for more information. ID="IN467-13824398"Cursorsselect andA MOREINFO="NONE"select used in a cursor definition (through MOREINFO="NONE"declare cursor) must contain a MOREINFO="NONE"from clause, but it cannot contain the MOREINFO="NONE"compute, MOREINFO="NONE"for browse, or MOREINFO="NONE"into clauses. If the MOREINFO="NONE"select contains any of the following constructs:MARK="DASH" REMAP="BS--BulletSub"MOREINFO="NONE"distinct optionMOREINFO="NONE"group by clauseAggregate functionsMOREINFO="NONE"union operatorREMAP="UN--Under"the cursor is considered "read-only" and not "updatable". If you declare a cursor inside a stored procedure with a MOREINFO="NONE"select containing an MOREINFO="NONE"order by clause, that cursor is also considered read-only. Even if it is considered updatable, you cannot delete a row using a cursor which is defined by a MOREINFO="NONE"select containing a join of two or more tables. See the section "MOREINFO="NONE"declare cursor" for more information.The name of the new table must be unique in the database and must conform to the rules for identifiers. You can also select into temporary tables. See examples 5, 6 and 9. 
ID="IN466-13824399"TablesTablescreating duplicate;Tables:with no datano data
ID="IN4611-138243100"DuplicationDuplicationof a table with no datatable with no dataYou can use MOREINFO="NONE"select into to create a duplicate table with no data by having a false condition in the MOREINFO="NONE"where clause. See example 10.
. ID="IN467-138243101"ColumnsheadingsYou must provide a column heading for any column in the select list that contains an aggregate function or any expression. The use of any constant, arithmetic or character expression, the use of built-in functions, or concatenation in the select list requires a column heading for the affected item. The column heading must be a valid identifier, or must be enclosed in quotation marks. See examples 5
 and 6.You cannot use MOREINFO="NONE"select into inside a user-defined transaction, or in the same statement as a MOREINFO="NONE"compute clause.MOREINFO="NONE"select into is a two-step operation. The first step creates the new table. The second step inserts the specified rows into the new table. If the second step fails for any reason (hardware failure, exceeding a system resource, etc.), the entire statement is rolled back. All rows are deleted, and the new table is dropped.Any rules, constraints, or defaults associated with the base table are not carried over to the new table. You must bind those rules or defaults to the new table using MOREINFO="NONE"sp_bindrule and MOREINFO="NONE"sp_bindefault.ID="IN4636-140245102"select into/bulkcopy database optionThe MOREINFO="NONE"select into/bulkcopy option must be set on (by executing MOREINFO="NONE"sp_dboption) in order to be able to MOREINFO="NONE"select MOREINFO="NONE"into a permanent table. You do not have to set the MOREINFO="NONE"select into/bulkcopy option on in order to MOREINFO="NONE"select MOREINFO="NONE"into a temporary table, since the temporary database is never recovered. REMAP="UN--Under"Once you have used MOREINFO="NONE"select into in a database, you must perform a full database dump before you can use the MOREINFO="NONE"dump transaction command. MOREINFO="NONE"select into operations are not logged and changes are therefore not recoverable from transaction logs. In this situation, issuing the MOREINFO="NONE"dump transaction statement produces an error message instructing you to use MOREINFO="NONE"dump database instead. REMAP="UN--Under"By default, the MOREINFO="NONE"select into/bulkcopy option is off in newly created databases. To change the default situation, turn this option on in the modelID="IN4619-143248103"select into command
 database. ID="IN4621-149254104"dump database commandselect into and;Performance:select into and
MOREINFO="NONE"select into runs more slowly while a MOREINFO="NONE"dump database is taking place.You cannot useMOREINFO="NONE" select into to create a new table with multiple IDENTITY columns. If the MOREINFO="NONE"select statement includes both an existing IDENTITY column and a new IDENTITY specification of the form column_name = identity(precisionID="IN4616-154259105"IDENTITY columnsselect and
), the statement fails.For information about the Embedded SQL command MOREINFO="NONE"select into MOREINFO="NONE"host_var_list, see the Open Client Embedded SQL Reference Manual. Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantEntry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The following are Transact-SQL 
extensions:
name='bull' font='symbol' code='168'  charset='fontspecific' use of MOREINFO="NONE"select into to create a new 
table
name='bull' font='symbol' code='168'  charset='fontspecific' MOREINFO="NONE"compute clauses
name='bull' font='symbol' code='168'  charset='fontspecific' global and local variables
name='bull' font='symbol' code='168'  charset='fontspecific' the MOREINFO="NONE"holdlock, noholdlock, and MOREINFO="NONE"shared 
keywords, 
name='bull' font='symbol' code='168'  charset='fontspecific' the use of "column_heading = 
column_name"
name='bull' font='symbol' code='168'  charset='fontspecific' qualified table and column names
name='bull' font='symbol' code='168'  charset='fontspecific' the use of MOREINFO="NONE"select in a MOREINFO="NONE"for browse 
clause 
name='bull' font='symbol' code='168'  charset='fontspecific' the use within the select list of 
columns that are not in the MOREINFO="NONE"group by list and have no aggregate functionsPermissionsREMAP="BO--Body"MOREINFO="NONE"select permission defaults to the owner of the table or view, who can transfer it to other users. See AlsoCommands     LINKEND="X48334"compute Clause
,LINKEND="X19955"create trigger
, LINKEND="X45593"delete
, LINKEND="X96182"group by and having Clauses
, LINKEND="X91835"insert
,LINKEND="X56548"union Operator
, LINKEND="X54355"update
, LINKEND="X30827"where ClauseFunctions     LINKEND="X79130"Aggregate Functions
, LINKEND="X24911"Row Aggregate FunctionsTopics     LINKEND="X20204"Expressions
, LINKEND="X18218"Wildcard CharactersSystem procedures     LINKEND="X29657"sp_dboption
ID="IN4614-161266110"select command
 ID="IN4611-169274111"set commandset commandSee also individual set options!see also
ID="IN4617-176281112"datetime datatypedatetime datatypeSee also set command!see also
ID="IN4611-180285113"set commandID="X64136"setID="IN477-181287115"Queriesexecution settings
ID="IN4717-185291116"System activitiessetting query-processing options for;Work session, set options for
ID="IN478-187293117"Triggersset commands in
ID="IN4717-189295118"Stored proceduresset commands in
Sets SQL Server query-processing options for the duration of the user's work session. Can be used to set some options inside a trigger or stored procedure. FORMAT="LINESPECIFIC"set ansinull {on | off}FORMAT="LINESPECIFIC"set ansi_permissions {on | off}FORMAT="LINESPECIFIC"set arithabort [arith_overflow | numeric_truncation]{on | off}FORMAT="LINESPECIFIC"set arithignore [arith_overflow] {on | off}FORMAT="LINESPECIFIC"set {chained, close on endtran, nocount, noexec, parseonly, procid, self_recursion, showplan}{on | off}FORMAT="LINESPECIFIC"set char_convert {off | on [with {error | no_error}] |charset [with {error | no_error}]}FORMAT="LINESPECIFIC"set cursor rows number for cursor_nameFORMAT="LINESPECIFIC"set {datefirst MOREINFO="NONE"number, dateformat MOREINFO="NONE"format,language MOREINFO="NONE"language}FORMAT="LINESPECIFIC"set dup_in_subquery {on | off}FORMAT="LINESPECIFIC"set fipsflagger {on | off}FORMAT="LINESPECIFIC"set flushmessage {on | off}FORMAT="LINESPECIFIC"set identity_insert [database.[owner.]]table_name{on | off}FORMAT="LINESPECIFIC"set offsets {MOREINFO="NONE"select, from, order, compute, table,procedure, statement, param, execute} {on | off}FORMAT="LINESPECIFIC"set quoted_identifier {on | off}FORMAT="LINESPECIFIC"set role {"sa_role" | "sso_role" | "oper_role"} {on | off}FORMAT="LINESPECIFIC"set {rowcount MOREINFO="NONE"number, textsize MOREINFO="NONE"number}FORMAT="LINESPECIFIC"set statistics {io, time} {on | off}FORMAT="LINESPECIFIC"set string_rtruncation {on | off}FORMAT="LINESPECIFIC"set textsize {number}FORMAT="LINESPECIFIC"set transaction isolation level {1 | 3}Keywords and OptionsREMAP="RI--RefIndent"ID="IN4720-193299122"ansinull option, set
MOREINFO="NONE"ansinull -ID="IN4711-193299123"Null valuescomparing
ID="IN4710-193299124"Comparisonnull-valued operands
 determines whether or not evaluation of NULL-valued operands in SQL equality (=) or inequality (!=) comparisons or aggregate functions, also called set functions, is ANSI-compliant. When set MOREINFO="NONE"on, SQL Server generates a warning each time an aggregate function eliminates a null-valued operand from calculation. This option does not affect how SQL Server evaluates NULL values in other kinds of SQL statements, such as MOREINFO="NONE"create table.MOREINFO="NONE"ansi_permissions - determines whether ANSI-compliant permissions requirements for MOREINFO="NONE"delete and MOREINFO="NONE"update statements are checked. The default value is off. The following table summarizes these requirements:TOCENTRY="1"LBL="Table 1-24: "Permissions required for update and deleteCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="15*"COLNAME="C3" COLWIDTH="17*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommandCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Permissions Required with
set ansi_permissions offCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Permissions Required with
set ansi_permissions onVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"updateCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"name='bull' font='symbol' code='168'  charset='fontspecific' MOREINFO="NONE"update permission on 
columns where values are being setCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific' MOREINFO="NONE"update permission on 
columns where values are 
being setAnd...name='bull' font='symbol' code='168'  charset='fontspecific' MOREINFO="NONE"select permission on all 
columns appearing in MOREINFO="NONE"where 
clause
name='bull' font='symbol' code='168'  charset='fontspecific' MOREINFO="NONE"select permission on all 
columns on right side of MOREINFO="NONE"set 
clauseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"deleteCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"name='bull' font='symbol' code='168'  charset='fontspecific' MOREINFO="NONE"delete permission on tableCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"name='bull' font='symbol' code='168'  charset='fontspecific' MOREINFO="NONE"delete permission on table 
from which rows are being 
deletedAnd...name='bull' font='symbol' code='168'  charset='fontspecific' MOREINFO="NONE"select permission on all 
columns appearing in MOREINFO="NONE"where 
clauseMOREINFO="NONE"arithabortID="IN4715-195301125"Overflow errorsset arithabort and
 - determines how SQL Server behaves when an arithmetic error occurs. The two MOREINFO="NONE"arithabort options, MOREINFO="NONE"arithabort arith_overflow and MOREINFO="NONE"arithabort numeric_truncation, handle different types of arithmetic errors. You can set each option independently, or set both options with a singleMOREINFO="NONE" set arithabort on orMOREINFO="NONE" set arithabort off statement. MARK="BULL" REMAP="BU--Bullet"ID="IN4722-201307126"arithabort option, setarith_overflow and
MOREINFO="NONE"arithabort arith_overflow specifies behavior following a divide-by-zero error or a loss of precision during either an explicit or an implicit datatype conversion. This type of error is considered serious. The default setting,MOREINFO="NONE" arithabort arith_overflow on, rolls back the entire transaction or batch in which the error occurs. If you set MOREINFO="NONE"arithabort arith_overflow off, SQL Server aborts the statement that causes the error but continues to process other statements in the transaction or batch.MOREINFO="NONE"arithabort numeric_truncation specifies behavior following a loss of scale by an exact numeric type during an implicit datatype conversion. (When an explicit conversion results in a loss of scale, the results are truncated without warning.) The default setting, MOREINFO="NONE"arithabort numeric_truncation on, aborts the statement that causes the error but continues to process other statements in the transaction or batch. If you set MOREINFO="NONE"arithabort numeric_truncation off, SQL Server truncates the query results and continues processing.REMAP="RI--RefIndent"ID="IN4723-207313127"arithignore option, setarith_overflow and
MOREINFO="NONE"arithignore arith_overflow- determines whether SQL Server displays a message after a divide-by-zero error or a loss of precision. The default setting,MOREINFO="NONE" off, displays a warning message after these errors. Setting MOREINFO="NONE"arithignore arith_overflow on suppresses warning messages after these errors. The optional MOREINFO="NONE"arith_overflow keyword can be omitted without any effect. ID="IN4719-211317128"chained option, set
MOREINFO="NONE"chained - begins a transaction just before the first data retrieval or data modification statement at the beginning of a session and after a transaction ends. In chained mode, SQL Server implicitly executes a MOREINFO="NONE"begin transaction before the following statements: MOREINFO="NONE"delete, MOREINFO="NONE"fetch, MOREINFO="NONE"insert,MOREINFO="NONE" open, MOREINFO="NONE"select, and MOREINFO="NONE"update. You cannot execute MOREINFO="NONE"set chained within a transaction.ID="IN4724-215321129"char_convert option, set
MOREINFO="NONE"char_convertID="IN4710-218324130"ConversionConversionSee also Character set conversion!see also Character set conversion
ID="IN4769-221327131"Incompatibility of data. See Character set conversion; Conversion
ID="IN4724-223329132"Character set conversionbetween client and server;Character set conversion:set char_convert
ID="IN476-223329133"Clientcharacter set conversion
 - turns character set conversion off and on between SQL Server and a client. If the client is using a 4.6 or later release of Open Client DB-Library, conversion is turned on during the login process (if the client and server use different character sets) and set to a default based on the character set that the client is using. MOREINFO="NONE"set MOREINFO="NONE"char_convert charset can also be used to start conversion between the server character set and a different client character set.charset can be either the character set's ID or name from syscharsets where type is less than 2000.ID="IN4710-224330134"Charactersnot converted with char_convert
MOREINFO="NONE"set MOREINFO="NONE"char_convert MOREINFO="NONE"off turns conversion off so that characters are sent and received unchanged. MOREINFO="NONE"set MOREINFO="NONE"char_convert MOREINFO="NONE"onID="IN476-226332135"Loginschar_convert setting for
 turns conversion on if it is turned off. If character set conversion was not previously turned on during the login process or by theMOREINFO="NONE" set char_convert charset command, MOREINFO="NONE"set MOREINFO="NONE"char_convert MOREINFO="NONE"on generates an error message. ID="IN4738-232338136"with no_error option, set char_converton or off setting (for char_convert)
ID="IN4714-232338137"Error handlingError handlingin character set conversioncharacter set conversionREMAP="UN--Under"When the MOREINFO="NONE"with MOREINFO="NONE"no_error option is included, SQL Server does not notify an application when characters from SQL Server cannot be converted to the client's character set. Error reporting is initially set on when a client connects with SQL Server: if you do not want error reporting, you must turn it off for each session with MOREINFO="NONE"set char_convert {on | charset} with no_error. To turn error reporting back on within a session, use MOREINFO="NONE"set char_convert {on | charset} with error.REMAP="UN--Under"Whether or not error reporting is turned on, the bytes which cannot be converted are replaced with ASCII question marks (?). (See the System Administration Guide for a more complete discussion of error handling in character set conversion.) ID="IN4728-236342138"close on endtran option, set
MOREINFO="NONE"close on endtran- causes SQL Server to close
all cursors opened within a transaction at the end of that transaction. A transaction ends by using either the Transact-SQL MOREINFO="NONE"commit or MOREINFO="NONE"rollback statements. However, only cursors declared within the scope (stored procedure, trigger, etc.) that sets this option are affected. See "LINKEND="X80039"Cursors" for more information cursor scopes.ID="IN4723-240346139"cursor rows option, set
MOREINFO="NONE"cursor rows - causes SQL Server to return the number of rows for each cursor MOREINFO="NONE"fetch request from a client application. You can MOREINFO="NONE"set the MOREINFO="NONE"cursor rows option for a cursor whether it is open or closed. However, this option does not affect a MOREINFO="NONE"fetch request containing an MOREINFO="NONE"into clause. cursor_name specifies the cursor for which to MOREINFO="NONE"set the number of rows returned.ID="IN4721-244350140"datefirst option, set
MOREINFO="NONE"datefirstID="IN475-244350141"Datesdisplay formats;Weekday date value:names and numbers;Numbers:weekday names and
 - sets the first week day to a number from 1 to 7. The us_english default is 1 (Sunday).ID="IN4722-248354142"dateformat option, set
MOREINFO="NONE"dateformatID="IN4710-248354143"Date partsOrderorder of;Order:of date partsdate parts
 - sets the order of the date parts MOREINFO="NONE"month/day/year for entering datetime or smalldatetime data. Valid arguments are mdy, dmy, ymd, ydm, myd, or dym. The us_english default is mdy. MOREINFO="NONE"dup_in_subquery - ControlsID="IN4727-251357144"dup_in_subquery option, set
 whether a subquery using an MOREINFO="NONE"in clause returns duplicate values. The default is off; duplicate rows are not returned. Prior to Release 10.0, SQL Server returned a row for each matching row in the subquery. ANSI specifies removing duplicate values from the result set. This option is provided as a workaround until you can re-write your queries for 10.0 behavior; it will not be supported in future releases.ID="IN4723-255361145"fipsflagger option, set
MOREINFO="NONE"fipsflagger - determines whether SQL Server displays a warning message when Transact-SQL extensions to entry level SQL92 are used. By default, SQL Server does not tell you when you use non-standard SQL. ID="IN4724-259365146"flushmessage option, set
MOREINFO="NONE"flushmessage - determines when SQL Server returns messages to the user. By default messages are stored in a buffer until the query that generated them completes or the buffer is filled to capacity. Use MOREINFO="NONE"set flushmessage on to return messages to the user immediately, as they are generated.ID="IN4727-263369147"identity_insert option, set
MOREINFO="NONE"identity_insert -  determines whether inserts into a table's IDENTITY column are allowed. (Note that updates to an IDENTITY column are never allowed.) This option can be used only with base tables. It cannot be used with views or set within a trigger. REMAP="UN--Under"Setting MOREINFO="NONE"identity_insert on allows the table owner, Database Owner, or System Administrator to explicitly insert a value into an IDENTITY column. Setting MOREINFO="NONE"identity _insert off restores the default behavior by prohibiting inserts to IDENTITY columns. At any given time, you can turn on the MOREINFO="NONE"identity_insert option for a single table in a database.REMAP="UN--Under"Inserting a value into the IDENTITY column allows you to specify a "seed" value for the column or to restore a row that was deleted in error. Unless you have created a unique index on the IDENTITY column, SQL Server does not verify the uniqueness of the inserted value; you can insert any positive integer. ID="IN4737-266372148"System messages, language setting forSystem messages, language setting forSee also Error messages; Messages!see also
ID="IN4720-270376149"language option, set
ID="IN478-270376150"Languagesetting system messages;Messages:language setting for;System messages, language setting for
MOREINFO="NONE"language - is the official name of the language that displays system messages. The language must be available on the server. us_english is the default. ID="IN4719-274380151"nocount option, set
MOREINFO="NONE"nocountID="IN477-274380152"Displaysetting for command-affected rows;Rows, table:displaying command-affected
ID="IN4726-276382153"@@rowcount global variableatatrowcount global variable;rowcount global variable
 - turns off the display of rows affected by a statement. The global variable @@rowcount is updated even when MOREINFO="NONE"nocount is on. ID="IN477-276382154"Queriescompilation without execution
ID="IN479-278384155"Compilingwithout execution (noexec)
ID="IN4718-282388156"noexec option, set
MOREINFO="NONE"noexec - compiles each query but does not execute it. MOREINFO="NONE"noexec is often used with MOREINFO="NONE"showplan. Once MOREINFO="NONE"noexec is turned on, no subsequent commands are executed (including other MOREINFO="NONE"set commands) until MOREINFO="NONE"noexec is turned off. ID="IN4735-282388157"Open Client DB-Library applicationskeywords
ID="IN4719-286392158"offsets option, set
MOREINFO="NONE"offsetsID="IN477-286392159"Querieskeywords list
 - returns the position of specified keywords (with relation to the beginning of the query) in Transact-SQL statements. The keyword list is a comma-separated list that can include any of the following Transact-SQL constructs: MOREINFO="NONE"select, MOREINFO="NONE"from, MOREINFO="NONE"order, MOREINFO="NONE"compute, MOREINFO="NONE"table, MOREINFO="NONE"procedure, MOREINFO="NONE"statement, param, and MOREINFO="NONE"executeID="IN4719-290396160"DB-Library programsset options for;Open Client DB-Library applications:set options for
. This option is used in Open Client DB-Library only. ID="IN477-290396161"Queriescompilation without execution
ID="IN477-292398162"Queriessyntax check (set parseonly)
ID="IN4721-296402163"parseonly option, set
MOREINFO="NONE"parseonlyID="IN476-298404164"Syntaxcheck using set parseonly
 - checks the syntax of each query and returns any error messages without compiling or executing the query. Returns offsets if the MOREINFO="NONE"offsets option is set onID="IN4717-302408165"Stored proceduresparseonly not used with;Triggers:parseonly not used with
 and there are no errors. MOREINFO="NONE"parseonly should not be used inside a stored procedure or trigger. ID="IN479-304410166"IDs, userstored procedure (procid)
ID="IN477-306412167"Numbersprocid setting
ID="IN4718-310416168"procid option, set
ID="IN4735-312418169"Open Client DB-Library applicationsprocid setting
MOREINFO="NONE"procidID="IN4717-312418170"Stored proceduresID numbers
ID="IN4717-314420171"Stored proceduresprocid option
 - returns the ID number of the stored procedure to Open Client DB-Library/C (not to the user) before sending rows generated by the stored procedure.ID="IN4729-318424172"quoted_identifier option, set
MOREINFO="NONE"quoted_identifier - determines whether SQL Server recognizes delimited identifiers. By default, MOREINFO="NONE"quoted_identifier is set MOREINFO="NONE"off and all identifiers must conform to the rules for valid identifiers. If you MOREINFO="NONE"set quoted_identifier on, you can use table, view, and column names that begin with a non-alphabetic character, include characters that would not otherwise be allowed, or are reserved words by enclosing the identifiers within double quotation marks. Delimited identifiers cannot exceed 28 bytes, cannot be used as parameters to system procedures, and may not be recognized by all front-end products.REMAP="UN--Under"WhenMOREINFO="NONE" quoted_identifier is MOREINFO="NONE"on, all character strings enclosed within double quotes are treated as identifiers. Use single quotes around character or binary strings.ID="IN4716-322428173"role option, set
MOREINFO="NONE"role - turns the specified role on or off during the current session. When you log in, all roles that have been granted to you are automatically turned on. Use MOREINFO="NONE"set role to turn any roles off, and back on again if desired. The roles are MOREINFO="NONE"sa_role, sso_role, and MOREINFO="NONE"oper_role. If you are not a user in the current database, and if there is no "guest" user, you will be unable to turn off MOREINFO="NONE"sa_role, because there is no server user ID for you to assume.ID="IN4731-328434174"Canceling a command at rowcountCanceling a command at rowcountSee also rollback command!see alsoID="IN475-330436175"Rangeset rowcountID="IN4720-334440176"rowcount option, setID="IN4711-336442177"Rows, tablerowcount settingID="IN478-338444178"Commandsrowcount range forID="IN4731-340446179"Canceling a commandat rowcountMOREINFO="NONE"rowcount - causes SQL Server to stop processing the query (MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"update or MOREINFO="NONE"delete) after the specified number of rows are affected. To turn this option off, use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set rowcount 0 ID="IN4726-344450180"self_recursion option, set
MOREINFO="NONE"self_recursion - determines whether or not SQL Server allows triggers to cause themselves to fire again (called self recursion). By default, SQL Server does not allow self recursion in triggers. You can turn this option on only for the duration of a current client session; its effect is limited by the scope of the trigger that sets it. For example, if the trigger that sets MOREINFO="NONE"self_recursion MOREINFO="NONE"on returns or causes another trigger to fire, this option reverts to MOREINFO="NONE"off.ID="IN477-346452181"Queriesshowplan setting
ID="IN4720-350456182"showplan option, set
MOREINFO="NONE"showplan - generates a description of the processing plan for the query and immediately processes it unless MOREINFO="NONE"noexec is set. This option may indicate whether or not an index is being used in a retrieval. The results of MOREINFO="NONE"showplanID="IN4711-352458183"Performanceshowplan and diagnostics
 are of use in performance diagnostics. Do not use MOREINFO="NONE"showplan inside a stored procedure or trigger. ID="IN477-354460184"Numbersstatistics io
ID="IN4725-358464185"statistics io option, set
MOREINFO="NONE"statistics MOREINFO="NONE"ioID="IN4720-360466186"Number (quantity of)scans (statistics io)
ID="IN4732-362468187"Scans, number of (statistics io)
ID="IN4720-364470188"Number (quantity of)logical reads (statistics io)
ID="IN4728-366472189"Logical reads, statistics io
ID="IN4715-370476190"Number of pagesstatistics io and;Pages (data):statistics io and
ID="IN4720-372478191"Number (quantity
of)physical reads (statistics io)ID="IN4730-374480192"Physical reads (statistics io)ID="IN478-376482193"Commandsstatistics io forID="IN4715-378484194"Number of pageswritten (statistics io) - displays the number of scans, the number of logical reads (pages accessed), and the number of physical reads (database device accesses) for each table referenced in the statement; for each command, it displays the number of pages written. ID="IN4727-382488195"statistics time option, set
MOREINFO="NONE"statistics MOREINFO="NONE"timeID="IN479-384490196"Compilingtime (statistics time)
ID="IN478-386492197"Commandsstatistics time information on
ID="IN4713-388494198"Time intervalelapsed execution (statistics time)
 - displays the time it took to parse and compile for each command; for each step of the command, it displays the time it took to execute. Times are given in timeticks, the exact value of which is machine-dependent. ID="IN4710-390496199"Truncationset string_rtruncation and
ID="IN4730-394500200"string_rtruncation option, set
MOREINFO="NONE"string_rtruncation- determines if SQL Server raises a SQLSTATE exception when an MOREINFO="NONE"insert or MOREINFO="NONE"update truncates a char or varcharID="IN4717-394500201"Character stringstruncation
 string. If the truncated characters consist only of spaces, no exception is raised. The default setting,MOREINFO="NONE" off, does not raise the SQLSTATE exception and the character string is silently truncated. ID="IN4720-398504202"textsize option, set
MOREINFO="NONE"textsizeID="IN474-400506203"Sizeset textsize function
ID="IN4713-404510204"text datatypetextsize setting
 - specifies the size in bytes of text or image type data to be returned with aID="IN4716-412518205"select statementsize of text data to be returned with;Size:text data to be returned with select
 MOREINFO="NONE"selectID="IN4726-414520206"@@textsize global variableatattextsize global variable;textsize global variable
 statement. The @@textsize global variable stores the current setting. To reset to the default size (32K), use the command: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"set textsize 0 ID="IN4734-418524207"transaction isolation level optionset
MOREINFO="NONE"transaction isolation level - causes SQL Server to automatically apply a MOREINFO="NONE"holdlock to all MOREINFO="NONE"select ID="IN4712-418524208"Transactionsisolation levels
operations in a transaction when set to isolation level 3. If you also set chained mode, that isolation level remains in effect for any data retrieval or modification statement that implicitly begins a transaction. By default, SQL Server's transaction isolation level is 1, which allows shared locks on data. You cannot change an isolation level within a transaction.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"set showplan, noexec on go select * from publishers go REMAP="UN--Under"For each query, SQL Server returns a description of the processing plan but does not execute it.set textsize 100 REMAP="UN--Under"Sets the limit on text or image data returned with a MOREINFO="NONE"select statement to 100 bytes. set rowcount 10 REMAP="UN--Under"For each MOREINFO="NONE"insert, MOREINFO="NONE"update, MOREINFO="NONE"delete, or MOREINFO="NONE"select, SQL Server stops processing the query after it affects the first ten rows. set char_convert on with error REMAP="UN--Under"SQL Server turns character set conversion on, setting it to a default based on the character set the client is using. SQL Server also notifies the client or application when characters cannot be converted to the client's character set. set cursor rows 5 for test_cursorREMAP="UN--Under"Once set, SQL Server returns five rows for each succeeding MOREINFO="NONE"fetch statement requested by a client using test_cursor.set identity_insert stores_south ongoinsert stores_south (syb_identity)values (100)goset identity_insert stores_south offgoREMAP="UN--Under"Allows the table owner or the Database Owner to insert a value of 100 into the IDENTITY column of the stores_south table, then prohibits further inserts to this column. Note the use of the MOREINFO="NONE"syb_identity keyword; SQL Server replaces this with the actual name of the IDENTITY column. set transaction isolation level 3REMAP="UN--Under"Automatically implements read-locks with each MOREINFO="NONE"select in a transaction for the duration of that transaction.set role "sa_role" offREMAP="UN--Under"Deactivates the user's System Administrator role for the current session.set flipsflagger onREMAP="UN--Under"Tells SQL Server to display a warning message if you use a Transact-SQL extension. If you then use non-standard SQL, like this:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"use pubs2goREMAP="UN--Under"SQL Server displays:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"SQL statement on line number 1 contains Non-ANSI text. The error is caused due to the use of use database. set ansinull onREMAP="UN--Under"Tells SQL Server to evaluate NULL-valued operands of equality (=) and inequality (!=) comparisons and aggregate functions in compliance with the entry level SQL92 standard. REMAP="UN--Under"When MOREINFO="NONE"set ansinull is MOREINFO="NONE"on, aggregate functions and row aggregates raise the following SQLSTATE warning upon encountering null values in one or more columns or rows:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Warning - null value eliminated in set functionREMAP="UN--Under"If the value of either of the equality or inequality operands is NULL, the comparison's result is UNKNOWN. For example, the following query returns no rows in MOREINFO="NONE"ansinull mode:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select * from titles where price = nullREMAP="UN--Under"If you setMOREINFO="NONE" ansinull mode off:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set ansinull offREMAP="UN--Under"the same query returns rows in which price is NULL.sMOREINFO="NONE"et string_rtruncationMOREINFO="NONE" onREMAP="UN--Under"Causes SQL Server to generate an exception when truncating a char or nchar string. If an MOREINFO="NONE"insert or MOREINFO="NONE"update would truncate a string, SQL Server displays:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"string data, right truncationset quoted_identifier ongocreate table "!*&strange_table" ("emp's_name"char(10), age int)goset quoted_identifier offgoREMAP="UN--Under"Tells SQL Server to treat any character string enclosed in double quotes as an identifier. The table name "!*&strange_table" and the column name "emp's_name" are legal identifier names while MOREINFO="NONE"quoted_identifier is set MOREINFO="NONE"on.ID="IN4727-421527211"dup_in_subquery option, setset dup_in_subquery ongoselect pub_name from publishers    where pub_id in (select pub_id from titles)goREMAP="UN--Under"With MOREINFO="NONE"dup_in_subquery set to MOREINFO="NONE"on, this query returns 18 rows, one for each matching pub_id in titles. With the default setting, MOREINFO="NONE"off, the query returns three rows, one for each pub_id in the outer query that matches a row in the inner query.CommentsMARK="BULL" REMAP="BU--Bullet"If you use the MOREINFO="NONE"set command inside a trigger or stored procedure, the option reverts to its former setting after the trigger or procedure executes. If you specify more than one option, the first syntax error causes all following options to be ignored. The options specified before the error are, however, executed, and the new option values are set.The MOREINFO="NONE"ansinull option affects equality (=) and inequality (!=) comparisons, and aggregate functions (also called set functions). SQL92 requires that if either one of the two operands of an equality comparison is NULL, the result is UNKNOWN.REMAP="UN--Under"Transact-SQL treats NULL values differently. If one of the operands is a column, parameter, or variable, and the other operand is the NULL constant or a parameter or variable whose value is NULL, the result is either TRUE or FALSE.ID="IN478-425531214"Defaultsset command options;set command:defaultsThe MOREINFO="NONE"set options can be divided into these categories: MARK="DASH" REMAP="BS--BulletSub"MOREINFO="NONE"parseonly, MOREINFO="NONE"noexec, MOREINFO="NONE"showplan, MOREINFO="NONE"rowcount, and MOREINFO="NONE"nocount control the way a query is executed. It doesn't make sense to set both MOREINFO="NONE"parseonly and MOREINFO="NONE"noexec on. The default setting for MOREINFO="NONE"rowcount is 0 (return all rows); the default for the others is MOREINFO="NONE"off. The MOREINFO="NONE"statistics options display performance statistics after each query. The default setting for these options is MOREINFO="NONE"off. MOREINFO="NONE"arithabort determines whether SQL Server aborts queries with arithmetic overflow and numeric truncation errors. MOREINFO="NONE"arithignore determines whether SQL Server prints a warning message if a query results in an arithmetic overflow. By default, both options are turnedMOREINFO="NONE" on.The MOREINFO="NONE"arithabort and MOREINFO="NONE"arithignore options have been redefined for Release 10.0. If you use these options in your applications, examine them to be sure they are still producing the desired effect.ID="IN4719-429535215"DB-Library programsset options for;Open Client DB-Library applications:set options for
MOREINFO="NONE"offsets and MOREINFO="NONE"procid are used in DB-Library to interpret results from SQL Server. The default setting for these options is MOREINFO="NONE"on. MOREINFO="NONE"datefirst, MOREINFO="NONE"dateformat, and MOREINFO="NONE"language affect date functions, date order, and message display. In the default language, us_english, MOREINFO="NONE"datefirst is 7 (Saturday), MOREINFO="NONE"dateformat is mdy, and messages are displayed in us_english. MOREINFO="NONE"set MOREINFO="NONE"language implies that SQL Server should use the first weekday and date format of the language it specifies, but it will not override an explicit MOREINFO="NONE"set MOREINFO="NONE"datefirst or MOREINFO="NONE"set MOREINFO="NONE"dateformat command issued earlier in the current session. MOREINFO="NONE"textsize controls the size of text type data returned with a MOREINFO="NONE"select statement. The default setting is 32K in MOREINFO="NONE"isql. Some client software sets other default values. Setting MOREINFO="NONE"textsize to 0 restores the default value of 32K.MOREINFO="NONE"char_convert controls character set conversion between SQL Server and a client. MOREINFO="NONE"cursor rows and MOREINFO="NONE"close on endtran affect the way SQL Server handles cursors. The default setting for MOREINFO="NONE"cursor rows with all cursors is 1. The default setting for MOREINFO="NONE"close on endtran is MOREINFO="NONE"off.MOREINFO="NONE"identity_insert allows or prohibits inserts that affect a table's MOREINFO="NONE"IDENTITY column.MOREINFO="NONE"chained andMOREINFO="NONE" transaction isolation level allow SQL Server to handle ANSI-compliant transactionsMOREINFO="NONE".MOREINFO="NONE"self_recursion allows SQL Server to handle triggers that cause themselves to fire. The default setting for MOREINFO="NONE"self_recursion is MOREINFO="NONE"off.MOREINFO="NONE"fipsflagger MOREINFO="NONE"on causes SQL Server to flag the use of nonstandard SQL.MOREINFO="NONE"string_rtruncation MOREINFO="NONE"on causes SQL Server to raise an exception error when truncating a char or nchar string.MOREINFO="NONE"quoted_identifier MOREINFO="NONE"on causes SQL Server to treat character strings enclosed in double quotes as identifiers.All MOREINFO="NONE"set options except MOREINFO="NONE"showplan and MOREINFO="NONE"char_convert take effect immediately. MOREINFO="NONE"showplan takes effect in the following batch. Here are two examples using MOREINFO="NONE"set MOREINFO="NONE"showplan MOREINFO="NONE"on:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set showplan onselect * from publishers go REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"pub_id  pub_name                 city        state------- -----------------------  ----------- ----- 0736    New Age Books            Boston      MA 0877    Binnet & Hardley         Washington  DC 1389    Algodata Infosystems     Berkeley    CA  (3 rows affected) REMAP="UN--Under"But:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set showplan on go select * from publishers goREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"MOREINFO="NONE"STEP 1 The type of query is select from table publishers Nested iteration Table Scan pub_id  pub_name                 city        state ------  --------------------     ----------  ----0736    New Age Books            Boston      MA 0877    Binnet & Hardley         Washington  DC 1389    Algodata Infosystems     Berkeley    CA  (3 rows affected) When you log in, all roles granted to you are automatically enabled. Use MOREINFO="NONE"set role to turn any of these options off or back on again. For example, if you have been granted the System Administrator role, you assume the identity (and user ID) of Database Owner within the current database. If you wish to assume your "real" user identity, execute this command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set role "sa_role" offREMAP="UN--Under"If you are not a user in the current database, and if there is no "guest" user, you will be unable to turn off MOREINFO="NONE"sa_role. ID="IN4718-432538216"ANSI compatibilityset options for
SQL92 ComplianceREMAP="BO--Body"The SQL92 standard specifies behavior that differs from Transact-SQL behavior in earlier SQL Server releases. Compliant behavior is enabled by default for all Embedded-SQL precompiler applications. Other applications needing to match this standard behavior can use the following MOREINFO="NONE"set options.TOCENTRY="1"LBL="Table 1-25: "set options for entry level SQL92 complianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="2*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OptionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SettingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ansi_permissionsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"onCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ansinullCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"onCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"arithabort COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"offCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"arithabort MOREINFO="NONE"numeric_truncationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"onCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"arithignoreCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"offCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"chainedCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"onCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"close MOREINFO="NONE"on MOREINFO="NONE"endtranCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"onCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"fipsflaggerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"onCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"quoted_identifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"onCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"string_rtruncationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"onCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"transaction MOREINFO="NONE"isolation MOREINFO="NONE"levelCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"3Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X19955"create trigger
, LINKEND="X18078"fetch
, LINKEND="X91835"insertFunctions     LINKEND="X13154"Datatype Conversion FunctionsTopics     LINKEND="X25196"Batch Queries
, LINKEND="X80039"Cursors
, LINKEND="X84316"Datatypes
, LINKEND="X96191"Roles
, LINKEND="X19352"Transactions
ID="IN4711-436542219"set command
ID="IN4717-440546220"System activitiessetting query-processing options for;Work session, set options for
ID="IN477-441547221"Queriesexecution settings
 ID="IN4715-445551222"setuser commandID="X97464"setuserID="IN485-447554224"Namessetuser
ID="IN4841-452559225"Impersonating a user. See setuser command
ID="IN4851-457564226"Original identity, resuming an. See setuser command
ID="IN486-460567227"LoginsLoginsSee also Remote logins; Users!see also Remote logins; Users
Allows a Database Owner to impersonate another user. FORMAT="LINESPECIFIC"setuser ["MOREINFO="NONE"user_name"] ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"setuser "mary" go grant select on authors to joe setuser go ID="IN4852-463570230"Identity of user. See Aliases; Logins; UsersREMAP="UN--Under"The Database Owner temporarily adopts Mary's identity in the database in order to grant Joe permissions on authors, a table owned by Mary. CommentsID="IN4810-465572232"Identitiessetuser commandMARK="BULL" REMAP="BU--Bullet"The Database Owner uses MOREINFO="NONE"setuser to adopt the identity of another user in order to use another user's database object, to grant permissions, to create an object, or for some other reason. ID="IN4811-467574233"Permissionschanging with setuserWhen the Database Owner uses the MOREINFO="NONE"setuser command, SQL Server checks the permissions of the user being impersonated instead of the permissions of the Database Owner. The user being impersonated must be listed in the sysusers table of the database. The MOREINFO="NONE"setuser command remains in effect until another MOREINFO="NONE"setuser command is given, or until the current database is changed with the MOREINFO="NONE"use command. Executing the MOREINFO="NONE"setuser command with no user name re-establishes the Database Owner's original identity. System Administrators can use MOREINFO="NONE"setuser to create objects that will be owned by another user. However, since a System Administrator operates outside the permissions system, she or he cannot use MOREINFO="NONE"setuser to acquire another user's permissions. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"setuser permission defaults to the Database Owner, and is not transferable. See AlsoCommands     LINKEND="X69087"grant
MOREINFO="NONE", LINKEND="X29921"revoke
MOREINFO="NONE", LINKEND="X39034"use
ID="IN4815-471578238"setuser commandREMAP="BO--Body"ID="X73794"shutdownID="IN43179483"System activitiesshutdown
Shuts down the SQL Server from which the command is issued, its local Backup Server, or a remote Backup Server. This command can only be issued by a System Administrator. FORMAT="LINESPECIFIC"shutdown [srvname] [with {wait | nowait}] Keywords and OptionsREMAP="RI--RefIndent"srvname - is the logical name by which the Backup Server is known in the SQL Server's sysservers system table. This parameter is not required when shutting down the local SQL Server.ID="IN432186166"wait option, shutdown
MOREINFO="NONE"with MOREINFO="NONE"wait- is the default. This brings the SQL Server or Backup Server down gracefully.ID="IN432378247"nowait option, shutdown
MOREINFO="NONE"with MOREINFO="NONE"nowaitID="IN431878248"Immediate shutdown
- shuts down the SQL Server or Backup Server immediately, without waiting for currently executing statements to finish.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"shutdownREMAP="UN--Under"Gracefully shuts down the SQL Server from which the MOREINFO="NONE"shutdown command is issued.shutdown with nowaitREMAP="UN--Under"Shuts down the SQL Server immediately.shutdown SYB_BACKUPREMAP="UN--Under"Shuts down the local Backup Server.sp_helpserverREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"name        network_name   status                             id ----------  -------------  ------------------------------------ --  REM_BACKUP  whale_backup   timeouts, no net password encryption 3SYB_BACKUP  slug_backup    timeouts, net password encryption    1 eel         eel                                              0 whale       whale         timeouts, no net password encryption 2   (return status = 0)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"shutdown REM_BACKUPREMAP="UN--Under"Uses MOREINFO="NONE"sp_helpserver to determine the  whale_backup Backup Server's  name within SQL Server. Shuts down this remote Backup Server by specifying this name in the MOREINFO="NONE"shutdown command. CommentsID="IN4320762611"Waiting for shutdownMARK="BULL" REMAP="BU--Bullet"Unless you use the MOREINFO="NONE"nowait option, MOREINFO="NONE"shutdown attempts to bring SQL Server down gracefully by: ID="IN436762612"LoginsdisablingMARK="DASH" REMAP="BS--BulletSub"Disabling logins (except for the System Administrator) Performing a checkpoint in every databaseWaiting for currently executing SQL statements or stored procedures to finish.REMAP="UN--Under"Shutting down the server gracefully (without the MOREINFO="NONE"nowait option) minimizes the amount of work that must be done by the automatic recovery process. Unless you use the MOREINFO="NONE"nowait option, MOREINFO="NONE"shutdown backup_server waits for active dumps and/or loads to complete. Once you issue a MOREINFO="NONE"shutdown command to a Backup Server, no new dumps or loads that use this Backup Server can start.Use MOREINFO="NONE"shutdown with nowait only in extreme circumstances. On SQL Server, issue a MOREINFO="NONE"checkpoint command before executing a MOREINFO="NONE"shutdown with nowait.You can only halt the local SQL Server with MOREINFO="NONE"shutdown; you cannot halt a remote SQL Server.You can only halt a Backup Server if:MARK="DASH" REMAP="BS--BulletSub"It is listed in your sysservers table. The system procedure MOREINFO="NONE"sp_addserver adds entries to sysservers.It is listed in the interfaces file for the SQL Server where you execute the command. Use the MOREINFO="NONE"sp_helpserver system procedure to determine the name by which a Backup Server is known to the SQL Server. Specify the Backup Server's name-not its network_name-as MOREINFO="NONE"shutdown's srv_name parameter.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"shutdownID="IN4316723016"shutdown command
 permission defaults to System Administrators, and is not transferable.See AlsoCommands     LINKEND="X68400"checkpointSystem procedures     LINKEND="X18765"sp_addserver
MOREINFO="NONE", LINKEND="X45409"sp_helpserver
ID="IN4322683418"truncate table commandID="X16531"truncate table
Removes all rows from a table. FORMAT="LINESPECIFIC"truncate table [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"truncate table authors REMAP="UN--Under"Removes all data in the authors table. CommentsID="IN4411643923"Rows, tabledeleting with truncate table;Dropping:rows from a table using truncate tableMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"truncate table ID="IN447624124"Indexestruncate table and
deletes all rows from a table. The table structure and all of the indexes continue to exist until you issue a MOREINFO="NONE"drop table command. The rules and defaults that are bound to the columns remain bound, and triggers remain in effect. ID="IN445604325"Spacefreeing with truncate table
ID="IN4412584526"Pages (data)truncate table and
MOREINFO="NONE"truncate table deallocates the distribution pages for all indexes; remember to run MOREINFO="NONE"update statistics after adding new rows to the table. ID="IN4414544927"Speed (Server)Speed (Server)of truncate table compared to deletetruncate table compared to delete
ID="IN4414505328"delete commandtruncate table compared to
MOREINFO="NONE"truncate MOREINFO="NONE"table is equivalent-to but faster than-a MOREINFO="NONE"delete without a MOREINFO="NONE"where clause. MOREINFO="NONE"delete removes rows one at a time and logs each deleted row as a transaction;MOREINFO="NONE" truncate table deallocates whole data pages and makes fewer log entries. Both MOREINFO="NONE"delete and MOREINFO="NONE"truncate table reclaim the space occupied by the data and its associated indexes. ID="IN448485529"Triggerstruncate table command andAlthough a MOREINFO="NONE"truncate table statement is, in effect, like a MOREINFO="NONE"delete without a MOREINFO="NONE"where clause,MOREINFO="NONE" truncate table cannot "fire" a trigger, because the deletion of the individual rows is not logged. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"truncate MOREINFO="NONE"table permission defaults to the table owner, and is not transferable. See AlsoCommands     LINKEND="X19955"create trigger
MOREINFO="NONE", LINKEND="X45593"delete
MOREINFO="NONE", LINKEND="X58548"drop table
ID="IN4414445934"union operatorID="X56548"union OperatorID="IN457416336"Queriesunion
Returns a single result set that combines the results of two or more queries. Duplicate rows are eliminated from the result set unless theMOREINFO="NONE" all keyword is specified.ID="IN4514376737"select commandunion operation withFORMAT="LINESPECIFIC"       select MOREINFO="NONE"select_list [MOREINFO="NONE"into clause]MOREINFO="NONE"         [MOREINFO="NONE"from clause] [MOREINFO="NONE"where clause]MOREINFO="NONE"         [MOREINFO="NONE"group by clause] [MOREINFO="NONE"having clause] [union [all]      select MOREINFO="NONE"select_list         [MOREINFO="NONE"from clause] [MOREINFO="NONE"where clause]MOREINFO="NONE"         [MOREINFO="NONE"group by clause] [MOREINFO="NONE"having clause] ]MOREINFO="NONE"... [MOREINFO="NONE"order by clause]MOREINFO="NONE" [MOREINFO="NONE"compute clause]Keywords and OptionsREMAP="RI--RefIndent"MOREINFO="NONE"union - creates the union of data specified by two MOREINFO="NONE"select statements. ID="IN4511337140"all keywordunion
MOREINFO="NONE"all - includes all rows in the results; duplicates are not removed. ID="IN4512297541"into keywordunion
MOREINFO="NONE"into - creates a new table based on the columns specified in the select list and the rows chosen in the MOREINFO="NONE"where clause. The first query in the union operation is the only one that can contain an MOREINFO="NONE"into clause. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select stor_id, stor_name from sales union select stor_id, stor_name from sales_east REMAP="UN--Under"The result set includes the contents of the stor_id and stor_name columns of both the sales and sales_east tables. select pub_id, pub_name, city into resultsfrom publishers union select stor_id, stor_name, city from stores union select stor_id, stor_name, city from stores_east REMAP="UN--Under"The MOREINFO="NONE"into clause in the first query specifies that table results hold the final result set of the union of the specified columns of the publishers, stores, and stores_east tables. select au_lname, city, state from authors union ((select stor_name, city, state from sales union select stor_name, city, state from sales_east) union select pub_name, city, state from publishers) REMAP="UN--Under"First the MOREINFO="NONE"union of the specified columns in the sales and sales_east tables is generated, and then the MOREINFO="NONE"union of that result with publishers is generated. Finally, the MOREINFO="NONE"union of the second result and authors is generated. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"order by and MOREINFO="NONE"compute clauses are allowed only at the end of the MOREINFO="NONE"union statement to define the order of the final results or to compute summary values. MOREINFO="NONE"group by and MOREINFO="NONE"having clauses can be used only within individual queries and cannot be used to affect the final result set. ID="IN4516297544"Evaluation orderevaluation order in
ID="IN455297545"OrderOrderof evaluationevaluationThe default evaluation order of a SQL statement containing MOREINFO="NONE"union operators is left-to-right. ID="IN4523277746"Binary operation, unionSince MOREINFO="NONE"union is a binary operation, parentheses must be added to an expression involving more than two queries to specify valuation order. The first query in the MOREINFO="NONE"union statement may contain an MOREINFO="NONE"into clause that creates a table to hold the final result set. The MOREINFO="NONE"into statement must be in the first query or you will receive an error message. (See Example 2.) The MOREINFO="NONE"union operator cannot appear within a MOREINFO="NONE"create MOREINFO="NONE"view statement. The MOREINFO="NONE"union operator cannot appear within a subquery. The MOREINFO="NONE"for MOREINFO="NONE"browse clause cannot be specified in queries involving the MOREINFO="NONE"union operator. The MOREINFO="NONE"union operator can appear within an MOREINFO="NONE"insert-MOREINFO="NONE"select statement. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert into sales.all   select * from sales   union   select * from sales_east ID="IN4511257947"Select listunion statementsAll select lists in the SQL statement must have the same number of expressions (column names, arithmetic expressions, aggregate functions, etc.). For example, this statement is invalid because the first select list is longer than the second: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_id, title_id, au_ord from titleauthor union select stor_id, date from sales ID="IN457238148"Columnsunion ofCorresponding columns in the select lists of MOREINFO="NONE"union statements must occur in the same order, because MOREINFO="NONE"union compares the columns one-to-one in the order given in the individual queries. ID="IN4511218349"Column nameunion result setThe column names in the table resulting from a MOREINFO="NONE"union are taken from the first individual query in the MOREINFO="NONE"union statement. If you want to define a new column heading for the result set, you must do it in the first query. In addition, if you want to refer to a column in the result set by a new name, for example in an MOREINFO="NONE"order by statement, it must be referred to in that way in the first MOREINFO="NONE"select statement. For example, the following query is correct: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select Cities = city from stores union select city from stores_east order by Cities You cannot use MOREINFO="NONE"union in the MOREINFO="NONE"select statement of an updatable cursor.ID="IN459198550"Datatypescomparison in union operationsThe descriptions of the columns that are part of a MOREINFO="NONE"union operation do not have to be identical. Here are the rules for comparing the datatypes and options of corresponding columns: TOCENTRY="1"LBL="Table 1-26: "Comparing datatypes in union operationsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="17*"COLNAME="C2" COLWIDTH="21*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Datatype of Column in union 
OperationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Datatype of Corresponding Column in 
Result Table VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Not datatype-compatible (data 
conversion not handled 
implicitly by SQL Server). COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Error returned by SQL Server. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Both fixed length char with 
lengths L1 and L2. COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fixed length char with length equal to 
the greater of L1 and L2. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Both fixed length binary with 
lengths L1 and L2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fixed length binary with length equal to 
the greater of L1 and L2. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Either or both are variable 
length char. COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Variable length char with length equal to 
the maximum of the lengths specified 
for the column in the union. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Either or both variable length 
binary. COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Variable length binary with length equal 
to the maximum of the lengths specified 
for the columns in the union. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Both are numeric datatypes (for 
example, smallint, int, float, 
money). COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A datatype equal to the maximum 
precision of the two columns. For 
example, if a column of table A is of 
type int and the corresponding column 
of table B is of type float, then the 
datatype of the corresponding column 
of the result table is float, because float is 
more precise than int. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Both columns' descriptions 
specify NOT NULL. COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Specifies NOT NULL. Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The following are Transact-SQL 
extensions:COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name='bull' font='symbol' code='168'  charset='fontspecific' The use of MOREINFO="NONE"union in the MOREINFO="NONE"select clause 
of an MOREINFO="NONE"insert statement

name='bull' font='symbol' code='168'  charset='fontspecific' Specifying new column headings 
in the MOREINFO="NONE"order by clause of a MOREINFO="NONE"select 
statement when the MOREINFO="NONE"union operator 
is present in the MOREINFO="NONE"select statementCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"See AlsoCommands     LINKEND="X48334"compute Clause
MOREINFO="NONE", LINKEND="X40303"declare
MOREINFO="NONE", LINKEND="X96182"group by and having Clauses
MOREINFO="NONE", LINKEND="X14000"order by Clause
MOREINFO="NONE", LINKEND="X35229"select
MOREINFO="NONE", LINKEND="X30827"where ClauseFunctions     LINKEND="X13154"Datatype Conversion FunctionsTopics     LINKEND="X84316"Datatypes
ID="IN4514158954"update commandID="X54355"updateID="IN4611129356"Rows, tableupdate
Changes data in existing rows, either by adding data or by modifying existing data. FORMAT="LINESPECIFIC"update [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name | MOREINFO="NONE"view_name} set [[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name.|MOREINFO="NONE"view_name.}]MOREINFO="NONE"    column_name1 =        {MOREINFO="NONE"expression1|NULL|(MOREINFO="NONE"select_statement)}    [, MOREINFO="NONE"column_name2 =         {MOREINFO="NONE"expression2|NULL|(MOREINFO="NONE"select_statement)}]...[from [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name | MOREINFO="NONE"view_name}      [,[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name|MOREINFO="NONE"view_name}]...][where MOREINFO="NONE"search_conditions]FORMAT="LINESPECIFIC"update [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name | MOREINFO="NONE"view_name} set [[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name.|MOREINFO="NONE"view_name.}]MOREINFO="NONE"    column_name1 =       {MOREINFO="NONE"expression1|NULL|(MOREINFO="NONE"select_statement)}    [, MOREINFO="NONE"column_name2 =        {MOREINFO="NONE"expression2|NULL|(MOREINFO="NONE"select_statement)}]...where current of cursor_nameKeywords and OptionsREMAP="RI--RefIndent"ID="IN461189759"set commandwithin update
MOREINFO="NONE"set - specifies the column name and assigns the new value. The value can be an expression or a NULL. When more than one column name and value pair is listed, they must be separated by commas. ID="IN4612410160"from keywordupdate
MOREINFO="NONE"from - uses data from other tables or views to modify rows in the table or view you are updating. MOREINFO="NONE"where - is a standard MOREINFO="NONE"where clause. (See "LINKEND="X30827"where Clause
.") ID="IN4623010561"where current of clauseupdate
MOREINFO="NONE"where current of - causes SQL Server to update the row of the table or view indicated by the current cursor position for cursor_name.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"update authors set au_lname = "MacBadden" where au_lname = "McBadden" REMAP="UN--Under"All the McBaddens in the authors table are now MacBaddens.update titles set total_sales = total_sales + qty from titles, salesdetail, sales where titles.title_id = salesdetail.title_id     and salesdetail.stor_id = sales.stor_id     and salesdetail.ord_num = sales.ord_num     and sales.date in        (select max(sales.date) from sales) REMAP="UN--Under"Modifies the total_sales column to reflect the most recent sales recorded in the sales and salesdetail tables. This assumes that only one set of sales is recorded for a given title on a given date, and that updates are up to date! update titles set price = 24.95where current of title_crsrREMAP="UN--Under"Changes the price of the book in titles currently pointed at by title_crsr to $24.95.update titles set price = 18.95where syb_identity = 4REMAP="UN--Under"Finds the row for which the IDENTITY column equals 4 and changes the price of the book to $18.95. SQL Server replaces the MOREINFO="NONE"syb_identity keyword with the actual name of the IDENTITY column.CommentsMARK="BULL" REMAP="BU--Bullet"Use MOREINFO="NONE"update to change values in rows that have already been inserted. Use MOREINFO="NONE"insert to add new rows. MOREINFO="NONE"update interacts with the MOREINFO="NONE"ignore_dup_key, MOREINFO="NONE"ignore_dup_row, and MOREINFO="NONE"allow_dup_row options set with the MOREINFO="NONE"create index command. (See "LINKEND="X58868"create index
" for more information.) SQL Server treats two different designations for the same table in an MOREINFO="NONE"update as two tables. For example, the following MOREINFO="NONE"update issued in pubs2 specifies discounts as two tables (discounts and pubs2..discounts):REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update discountsset discount = 25from pubs2..discounts, pubs2..storeswhere pubs2..discounts.stor_id =    pubs2..stores.stor_idREMAP="UN--Under"In this case, the join does not include discounts, so the MOREINFO="NONE"where condition remains true for every row; SQL Server updates all rows in discounts (which is not the desired result). To avoid this problem, use the same designation for a table throughout the statement.ID="IN468-210764"Triggersupdate andYou can define a trigger that takes a specified action when an MOREINFO="NONE"update command is issued on a specified table or on a specified column of a table.MOREINFO="NONE"update and Transactions ID="IN4624-410965"Chained transaction modeupdate andMARK="BULL" REMAP="BU--Bullet"When you set chained transaction mode on, and there is no transaction currently active, SQL Server implicitly begins a transaction with the MOREINFO="NONE"update statement. To complete the update, you must either MOREINFO="NONE"commit the transaction or MOREINFO="NONE"rollback the changes. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update stores set city = 'Concord'    where stor_id = '7066'if exists (select t1.city, t2.city     from stores t1, stores t2     where t1.city = t2.city     and t1.state = t2.state     and t1.stor_id < t2.stor_id)        rollback transactionelse        commit transactionREMAP="UN--Under"This batch begins a transaction (using chained transaction mode) and updates a row in the stores table. If it updates a row containing the same city and state information as another store in the table, it rolls back the changes to stores and ends the transaction. Otherwise, it commits the updates and ends the transaction. For more information about the chained mode, see "LINKEND="X19352"Transactions
".ID="IN4629-410966"Empty string (" ") or (' ')updating an
ID="IN4612-611167"Transactionsupdate iteration within given
SQL Server does not prevent you from issuing an MOREINFO="NONE"update statement that updates a single row more than once in a given transaction. However, because of the way the MOREINFO="NONE"update is processed, updates from a single statement do not accumulate. That is, if an MOREINFO="NONE"update statement modifies the same row twice, the second update is not based on the new values from the first update but on the original values. The results are unpredictable since they depend on the order of processing.Updating Character DataMARK="BULL" REMAP="BU--Bullet"Updating variable-length character data or text columns with the empty string ("") inserts a single space. Fixed-length character columns are padded to the defined length. ID="IN4617-811368"Spaces, characterupdate of
ID="IN466-1011569"Blanksupdate andAll trailing spaces are removed from variable-length column data, except in the case of a string which contains only spaces. Strings that contain only spaces are truncated to a single space. Strings longer than the specified length of a char, nchar, varchar, or nvarcharID="IN4618-1411970"string_rtruncationupdate and
 column are silently truncated unless the MOREINFO="NONE"string_rtruncation option is set to MOREINFO="NONE"on.ID="IN4613-1812371"text datatypeinitializing with updateAn MOREINFO="NONE"update to a text column initializes the text column, assigns it a valid text pointer, and allocates at least one 2K data page. MOREINFO="NONE"update and Cursors ID="IN467-2012572"Cursorsupdate andMARK="BULL" REMAP="BU--Bullet"To update a row using a cursor, first define the cursor withMOREINFO="NONE" declare cursor, then MOREINFO="NONE"open it. The cursor name cannot be a Transact-SQL parameter or local variable, and it must be an updatable cursor or SQL Server returns an error. Any update to the cursor result set also affects the base table row that the cursor row is derived from.The table_name or view_name specified with an MOREINFO="NONE"update...MOREINFO="NONE"where current of must be the table or view specified in the first MOREINFO="NONE"from clause of the MOREINFO="NONE"select statement that defines the cursor. If that MOREINFO="NONE"from clause references more than one table or view (using a join), you can specify only the table or view actually being updated. REMAP="UN--Under"After the update, the cursor position remains unchanged. You can continue to update the row at that cursor position as long as another SQL statement does not move the position of that cursor.SQL Server allows you to update columns that are not specified in the list of columns of the cursor's select_statement, but that are part of the tables specified in the select_statement. However, when you specify a column_name_list with MOREINFO="NONE"for update when declaring the cursor, you can only update those specific columns.ID="IN4616-2212773"IDENTITY columnsupdates not allowed Updating MOREINFO="NONE"IDENTITY ColumnsID="IN4616-2613174"IDENTITY columnsupdate andMARK="BULL" REMAP="BU--Bullet"A column with the IDENTITY property cannot be updated, either through its base table or through a view. To determine whether a column was defined with the IDENTITY property, use theMOREINFO="NONE" sp_help system procedure on the column's base table.An IDENTITY column selected into a result table observes the following rules with regard to inheritance of the IDENTITY property:MARK="DASH" REMAP="BS--BulletSub"If an IDENTITY column is selected more than once, it is defined as NOT NULL in the new table. It does not inherit the IDENTITY property.If an IDENTITY column is selected as part of an expression, the resulting column does not inherit the IDENTITY property. It is created as NULL if any column in the expression allows nulls, and NOT NULL otherwise.If the select statement contains a MOREINFO="NONE"group MOREINFO="NONE"by clause or aggregate function, the resulting column does not inherit the IDENTITY property. Columns that include an aggregate of the IDENTITY column are created NULL; others, NOT NULL. An IDENTITY column that is selected into a table with a union or join does not retain the IDENTITY property. If the table contains the union of the IDENTITY column and a NULL column, the new column is defined as NULL. Otherwise, it is defined as NOT NULL.Updating Data Through ViewsID="IN465-3213775"Viewsupdate and;Views:check option andMARK="BULL" REMAP="BU--Bullet"You cannot MOREINFO="NONE"update views defined with the MOREINFO="NONE"distinct clause.If a view is created MOREINFO="NONE"with check option, each row that is updated through the view must remain visible through the view. For example, the stores_cal view includes all rows of the stores table for which state has a value of "CA". The MOREINFO="NONE"with check option clause checks each MOREINFO="NONE"update statement against the view's selection criteria:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create view stores_calas select * from storeswhere state = "CA"with check optionREMAP="UN--Under"MOREINFO="NONE"update statements, such as the one below, fail if they change state to any value other than "CA":REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update stores_calset state = "WA"where store_id = "7066"If a view is created MOREINFO="NONE"with check option, all views derived from the "base" view must satisfy the view's selection criteria. Each row updated through a derived view must remain visible through the base view.REMAP="UN--Under"Consider the view stores_cal30, which is derived from stores_cal. The new view includes information about stores in California with payment terms of "Net 30":REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create view stores_cal30as select * from stores_calwhere payterms = "Net 30"REMAP="UN--Under"Because stores_cal was created MOREINFO="NONE"with check option, all rows updated through stores_cal30 must remain visible through stores_cal. Any row that changes state to a value other than "CA" is rejected.REMAP="UN--Under"Notice that stores_cal30 does not have a MOREINFO="NONE"with check option clause of its own. This means that it is possible to update a row with a payterms value other than "Net 30" through stores_cal30. The following MOREINFO="NONE"update statement would be successful, even though the row would no longer be visible through stores_cal30:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update stores_cal30set payterms = "Net 60"where stor_id = "7067"You cannot update a row through a view that joins columns from two or more tables unless both of the following conditions are true:MARK="DASH" REMAP="BS--BulletSub"The view has no MOREINFO="NONE"with check option clauseID="IN465-3213776"Viewsupdating restrictionsAll columns being updated belong to the same base tableID="IN4614-3413977"update commandviews and;Multi-table views
MOREINFO="NONE"update statements are allowed on join views MOREINFO="NONE"with check option. The update fails if any of the affected columns appears in the MOREINFO="NONE"whereID="IN465-3714278"Viewscheck option and
 clause, in an expression that includes columns from more than one table.ID="IN465-4014579"Viewsupdate andIf you update a row through a join view, all affected columns must belong to the same base table.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantEntry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The use of a MOREINFO="NONE"from clause or a 
qualified table or column name are 
Transact-SQL extensions detected 
by the FIPS flagger. Updates 
through a join view or a view 
whose target list contains an 
expression are Transact-SQL 
extensions that cannot be detected 
until runtime and are not flagged 
by the FIPS flagger.PermissionsREMAP="BO--Body"MOREINFO="NONE"update permission defaults to the table or view owner, who can transfer it to other users. REMAP="BO--Body"If you have MOREINFO="NONE"set ansi_permissions on, you will need, in addition to the regular permissions required for update statements, to have MOREINFO="NONE"select permission on all columns appearing in the MOREINFO="NONE"where clause, and MOREINFO="NONE"select permission on all columns on the right side of the MOREINFO="NONE"set clause.See AlsoCommands     LINKEND="X81463"create default
, LINKEND="X58868"create index
, LINKEND="X43186"create rule
, LINKEND="X19955"create trigger
, LINKEND="X91835"insert
,  LINKEND="X30827"where ClauseTopics     LINKEND="X80039"Cursors
, LINKEND="X39672"Text and Image Datatypes
, LINKEND="X19352"Transactions
, System procedures     LINKEND="X84736"sp_bindefault
MOREINFO="NONE", LINKEND="X38718"sp_bindrule
MOREINFO="NONE", LINKEND="X91431"sp_help
MOREINFO="NONE", LINKEND="X87638"sp_unbindefault
MOREINFO="NONE", LINKEND="X37191"sp_unbindrule
ID="IN4610-4214785"Statisticsupdate statistics
ID="IN4625-4815386"update statistics commandID="X42677"update statisticsID="IN477-5015688"Indexesupdate statistics on
ID="IN4727-5015689"Key values, distribution of
Updates information about the distribution of key values in specified indexes. FORMAT="LINESPECIFIC"update statistics MOREINFO="NONE"table_name [MOREINFO="NONE"index_name] Keywords and OptionsREMAP="RI--RefIndent"table_name - is the name of the table with which the index is associated. table_name is required since Transact-SQL does not require index names to be unique in a database. index_name - is the name of the index to be updated. If an index name is not specified, the distribution statistics for all the indexes in the specified table are updated. CommentsID="IN476-5015693"Tablesindex locationMARK="BULL" REMAP="BU--Bullet"SQL Server keeps statistics about the distribution of the key values in each index, and uses these statistics in its decisions about which index(es) to use in query processing. MOREINFO="NONE"update statistics is automatically run when you create or recreate an index on a table that already contains data. The optimization of your queries depends on the accuracy of the distribution steps. If there is significant change in the key values in your index, you should re-run MOREINFO="NONE"update statistics on that index. Use the MOREINFO="NONE"update statistics command if a great deal of data in an indexed column has been added, changed, or removed (that is, if you suspect that the distribution of key values has changed). MOREINFO="NONE"update statistics updates allocation page values used to estimate the number of rows in a table. These statistics are used by the MOREINFO="NONE"rowcnt function and MOREINFO="NONE"sp_spaceused.ID="IN476-5215894"Tablesupdate statistics onRun MOREINFO="NONE"update statisticsID="IN4722-5616295"truncate table commandupdate statistics after
 after adding new rows to a table whose rows had previously been deleted with MOREINFO="NONE"truncate table. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"MOREINFO="NONE"update statistics permission defaults to the table owner and is not transferable. The command can also be executed by the Database Owner, who can impersonate the table owner by running the MOREINFO="NONE"setuser command.See AlsoCommands     LINKEND="X58868"create indexSystem procedures     LINKEND="X87980"sp_helpindex
ID="IN4725-62168100"update statistics command
ID="IN4711-66172101"use commandID="X39034"useID="IN489-68175103"Databasesselecting;Databases:use command
Specifies the database with which you want to work. FORMAT="LINESPECIFIC"use MOREINFO="NONE"database_name ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"use pubs2 go REMAP="BO--Body"The current database is now pubs2. CommentsMARK="BULL" REMAP="BU--Bullet"The MOREINFO="NONE"use command must be executed before you can reference objects in a database. MOREINFO="NONE"use cannot be included in a stored procedure or a trigger. ID="IN486-72179107"Addingaliases;Aliases:sp_addalias and;sp_addalias system procedureAn alias permits a user to use a database under another name in order to gain access to that database. Use the system procedure MOREINFO="NONE"sp_addalias. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionPermissionsREMAP="BO--Body"Permission for the MOREINFO="NONE"use command defaults to all users. Only valid users of the named database are granted access to it. See AlsoCommands     LINKEND="X75308"create database
MOREINFO="NONE", LINKEND="X72692"drop databaseSystem procedures     
LINKEND="X12007"sp_addalias
MOREINFO="NONE", LINKEND="X68639"sp_adduser
MOREINFO="NONE", LINKEND="X24535"sp_modifylogin
ID="IN4811-76183112"use command
ID="IN4815-80187113"waitfor commandID="X56170"waitforID="IN4913-82190115"Time intervalwaitfor
ID="IN494-84192116"Exitwaitfor command
ID="IN4934-89197117"Response time. See waitfor command
ID="IN4944-93201118"Command execution delay. See waitfor command
ID="IN4936-98206119"Execution delay. See waitfor command
Specifies a specific time, a time interval, or an event for the execution of a statement block, stored procedure, or transaction. FORMAT="LINESPECIFIC"waitfor { delay MOREINFO="NONE"time | time MOREINFO="NONE"time | errorexit | processexit | mirrorexit } Keywords and OptionsREMAP="RI--RefIndent"ID="IN4927-100208122"Delayed execution (waitfor)
MOREINFO="NONE"delay - instructs SQL Server to wait until the specified amount of time has passed, up to a maximum of 24 hours. ID="IN4920-104212123"time option, waitfor
MOREINFO="NONE"time- instructs SQL Server to wait until the specified time. time - a time in one of the acceptable formats for datetime data. You cannot specify dates-the date portion of the datetime value is not allowed. ID="IN4917-108216124"errorexit keywordwaitfor
MOREINFO="NONE"errorexit - instructs SQL Server to wait until a kernel or user process terminates abnormally. ID="IN4919-112220125"processexit keywordwaitfor
MOREINFO="NONE"processexit - instructs SQL Server to wait until a kernel or user process terminates for any reason. ID="IN4918-116224126"mirrorexit keywordwaitfor
ID="IN4914-118226127"Disk mirroringwaitfor mirrorexit
MOREINFO="NONE"mirrorexit - instructs SQL Server to wait for a mirror failure.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"begin     waitfor time "14:20"     insert chess(next_move)        values('Q-KR5')     execute sendmail 'judy' end REMAP="UN--Under"At 2:20 p.m., the chess table will be updated with my next move, and a procedure called sendmail will insert a row in a table owned by Judy, notifying her that a new move now exists in the chess table.begin     waitfor delay "00:00:10"      print "Ten seconds have passed.  Your time        is up." end CommentsMARK="BULL" REMAP="BU--Bullet"After issuing the MOREINFO="NONE"waitfor command, you cannot use your connection to SQL Server until the time or event that you specified occurs. ID="IN4924-120228130"Processes (Server tasks)infected, waitfor errorexit
ID="IN4918-122230131"Infected processeswaitfor errorexit andYou can use MOREINFO="NONE"waitfor errorexit with a procedure that kills the abnormally terminated process, in order to free system resources that would otherwise be taken up by an infected process. To find out which process terminated, check the sysprocesses table with the system procedure MOREINFO="NONE"sp_who. ID="IN495-124232132"Datesdisplay formats, waitfor commandThe time you specify with MOREINFO="NONE"waitfor
time or MOREINFO="NONE"waitfor delay can include hours, minutes, and seconds. Use the format MOREINFO="NONE"hh:mi:ss, as described in LINKEND="X84316""Datatypes." REMAP="UN--Under"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"waitfor time "16:23" REMAP="UN--Under"instructs SQL Server to wait for 4:23 p.m. The statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"waitfor delay "01:30"REMAP="UN--Under"instructs SQL Server to wait one hour and 30 minutes. ID="IN4919-126234133"DB-Library programswaitfor mirrorexit andYou can use MOREINFO="NONE"waitfor mirrorexit within a DB-Library program to notify users when there is a mirror failure. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X55146"begin...endTopics     LINKEND="X84316"Datatypes
, LINKEND="X82597"Disk MirroringSystem procedures     LINKEND="X89868"sp_who
ID="IN4915-130238137"waitfor command
 ID="IN4912-134242138"where clauseID="X30827"where ClauseID="IN5017-137246140"Search conditionswhere clause
Sets the search conditions in a MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"delete statement. (Joins and subqueries are specified in the search conditions: see the "LINKEND="X70715"Joins
" and "LINKEND="X45943"Subqueries
" sections for full details.) FORMAT="LINESPECIFIC"REMAP="BO--Body"Search conditions immediately follow the keyword MOREINFO="NONE"where in a MOREINFO="NONE"select, insert, update, or MOREINFO="NONE"delete statement. If you use more than one of the search conditions in a single statement, connect the conditions withMOREINFO="NONE" and orMOREINFO="NONE" or. FORMAT="LINESPECIFIC"where [not] MOREINFO="NONE"expression MOREINFO="NONE"comparison_operator MOREINFO="NONE"expression FORMAT="LINESPECIFIC"where [not] MOREINFO="NONE"expression [not] like  MOREINFO="NONE""match_string"[escape "escape_character"]FORMAT="LINESPECIFIC"where [not] MOREINFO="NONE"expression is [not] null FORMAT="LINESPECIFIC"where [not] expression [not] between MOREINFO="NONE"expression and MOREINFO="NONE"expression FORMAT="LINESPECIFIC"where [not]MOREINFO="NONE"expression [not] in ({MOREINFO="NONE"value_list |MOREINFO="NONE" subquery}) FORMAT="LINESPECIFIC"where [not] exists (MOREINFO="NONE"subquery) FORMAT="LINESPECIFIC"where [not] MOREINFO="NONE"expression MOREINFO="NONE"comparison_operator {any|all} (MOREINFO="NONE"subquery) FORMAT="LINESPECIFIC"where [not] MOREINFO="NONE"column_name MOREINFO="NONE"join_operator MOREINFO="NONE"column_name FORMAT="LINESPECIFIC"where [not] MOREINFO="NONE"boolean_expression FORMAT="LINESPECIFIC"where [not] MOREINFO="NONE"expression {and | or} [not] MOREINFO="NONE"expression Keywords and OptionsREMAP="RI--RefIndent"ID="IN5011-141250143"all keywordwhere
MOREINFO="NONE"all - is used with MOREINFO="NONE"> or MOREINFO="NONE"< and a subquery. It returns results when all values retrieved in the subquery match the value in the MOREINFO="NONE"where or MOREINFO="NONE"having clause of the outer statement. (See "LINKEND="X45943"Subqueries
" for more information.) ID="IN5011-145254144"and keywordwhere
MOREINFO="NONE"and - joins two conditions and returns results when both of the conditions are true. REMAP="UN--Under"When more than one logical operator is used in a statement, MOREINFO="NONE"and operators are normally evaluated first. However, you can change the order of execution with parentheses. ID="IN5011-149258145"any keywordwhere clause
MOREINFO="NONE"any - is used with MOREINFO="NONE">, <, or MOREINFO="NONE"= and a subquery. It returns results when any value retrieved in the subquery matches the value in the MOREINFO="NONE"where or MOREINFO="NONE"having clause of the outer statement. (See "LINKEND="X45943"Subqueries
" for more information.) ID="IN5015-153262146"between keywordwhere
MOREINFO="NONE"betweenID="IN5011-155264147"and keywordrange-end
 - is the range-start keyword. Use MOREINFO="NONE"and for the range-end value. The range:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where @val between x and yREMAP="UN--Under"is inclusive; the range:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"x and @val < y REMAP="UN--Under"is not. Queries using MOREINFO="NONE"between return no rows if the first value specified is greater than the second value.column_name - is the name of the column used in the comparison. Qualify the column name with its table or view name if there is any ambiguity. For columns with the IDENTITY property, you can specify the MOREINFO="NONE"syb_identity keyword, qualified by a table name where necessary, rather than the actual column name.ID="IN5020-157266148"Comparison operatorswhere clause
comparison_operator - is one of the following: TOCENTRY="1"LBL="Table 1-27: "Comparison operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="8*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  =COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  >COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"greater than COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  <COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"less than COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  >=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"greater than or equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  <=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"less than or equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  !=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  <>COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  !>COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not greater than COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  !<COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not less than REMAP="UN--Under"In comparing char, nchar, varchar, and nvarchar data, MOREINFO="NONE"< means closer to the beginning of the alphabet andMOREINFO="NONE" > means closer to the end of the alphabet. REMAP="UN--Under"Case and special character evaluations depend on the collating sequence of the operating system on the machine on which SQL Server is located. For example, lowercase letters may be greater than uppercase letters, and uppercase letters may be greater than numbers.REMAP="UN--Under"Trailing blanks are ignored for the purposes of comparison. For example, "Dirk" is the same as "Dirk  ". REMAP="UN--Under"In comparing dates, MOREINFO="NONE"< means earlier and MOREINFO="NONE"> means later. Put quotes around all character and date data used with a comparison operator. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC" = "Bennet" > "94609"REMAP="UN--Under" See "LINKEND="X84316"Datatypes
" for more information about data entry rules.ID="IN5014-161270149"escape keywordwhere
MOREINFO="NONE"escape - specifies an escape character with which you can search for literal occurrences of wildcard characters. See "LINKEND="X18218"Wildcard Characters
" for a complete explanation.ID="IN5014-165274150"exists keywordwhere
MOREINFO="NONE"exists - is used with a subquery to test for the existence of some result from the subquery. (See "LINKEND="X45943"Subqueries
" for more information.) expression - is a column name, a constant, a function, a subquery, or any combination of column names, constants, and functions connected by arithmetic or bitwise operators. ID="IN5020-167276151"Arithmetic operatorswhere clauseREMAP="UN--Under"The arithmetic operators are: TOCENTRY="1"LBL="Table 1-28: "Arithmetic operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="2*"COLNAME="C2" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  +COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Addition COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  -COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Subtraction COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  *COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Multiplication COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  /COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Division COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  %COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Modulo REMAP="UN--Under"Addition, subtraction, division, and multiplication can be used on exact numeric, approximate numeric, and money types. The modulo operator can only be used with integer types. A modulo is the integer remainder after a division involving two integers. For example, 21 % 9 = 3 because 21 divided by 9 equals 2 with a remainder of 3. ID="IN5017-169278152"Bitwise operatorswhere clauseREMAP="UN--Under"The bitwise operators are: TOCENTRY="1"LBL="Table 1-29: "Bitwise operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="10*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0" &COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bitwise and (two operands) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0" |COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bitwise or (two operands) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0" ^COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bitwise exclusive or (two operands) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0" ~COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bitwise not (one operand) REMAP="UN--Under"The bitwise operators can only be used on the integer types. All the bitwise operators translate the integer arguments into binary representation before evaluating them. (See "LINKEND="X20204"Expressions
" for more information.) ID="IN5010-173282153"in keywordwhere
MOREINFO="NONE"in - allows you to select values that match any one of a list of values. The comparator can be a constant or a column name, and the list can be a set of constants or, more commonly, a subquery. (See "LINKEND="X45943"Subqueries
" for information on using MOREINFO="NONE"in
 with a subquery.) Enclose the list of values in parentheses. ID="IN5015-177286154"is null keywordwhere
MOREINFO="NONE"is null - is used when searching for null values. join_operator - is a comparison operator or one of the symbols =*
 or *=
. (See "LINKEND="X70715"Joins
" for more information.) ID="IN5012-181290155"like keywordwhere
MOREINFO="NONE"like - is a keyword indicating that the following character string (enclosed by single or double quotes) is a matching pattern. MOREINFO="NONE"like is available for char, varchar, nchar, nvarchar, and datetime columns (but not to search for seconds or milliseconds). ID="IN5010-183292156"ConversionConversionof dates used with likedates used with likeREMAP="UN--Under"You can use the keyword MOREINFO="NONE"like and wildcard characters with datetime data as well as with char and varchar. When you use MOREINFO="NONE"like with datetime values, SQL Server converts the dates to the standard datetime format, and then to varchar. Since the standard storage format doesn't include seconds or milliseconds, you cannot search for seconds or milliseconds with MOREINFO="NONE"like and a pattern. REMAP="UN--Under"It is a good idea to use MOREINFO="NONE"like when you search for datetime values, since datetime entries may contain a variety of date parts. For example, if you insert the value "9:20" into a column named arrival_time, the clause:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where arrival_time = '9:20' REMAP="UN--Under"would not find it because SQL Server converts the entry into "Jan 1, 1900 9:20AM." However, the clause:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where arrival_time like '%9:20%' REMAP="UN--Under"would find it. logical_expression - is an expression that returns "true" or "false". (See "LINKEND="X20204"Expressions
" for a full definition.) match_string - is a string of characters and wildcards enclosed in quotes. The wildcards are: TOCENTRY="1"LBL="Table 1-30: "Wildcard operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="10*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  %COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any string of 0 or more characters COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  _COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any single character COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  [ ]COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any single character within the 
specified range ([a-f]) or set ([abcdef]) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  [^]COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any single character not within the 
specified range ([^a-f]) or set 
([^abcdef]) REMAP="UN--Under"For complete information, including information on using alternative character set definitions in wildcards, see "LINKEND="X18218"Wildcard Characters
." ID="IN5011-187296157"not keywordwhere
MOREINFO="NONE"not - negates any logical expression or keywords such as MOREINFO="NONE"like, MOREINFO="NONE"null, MOREINFO="NONE"between,MOREINFO="NONE" in, and MOREINFO="NONE"exists.ID="IN5010-191300158"or keywordwhere
MOREINFO="NONE"or - joins two conditions and returns results when either of the conditions is true. REMAP="UN--Under"When more than one logical operator is used in a statement, MOREINFO="NONE"or operators are normally evaluated after MOREINFO="NONE"and operators. However, you can change the order of execution with parentheses. subquery - is a restricted MOREINFO="NONE"select statement (MOREINFO="NONE"order by and MOREINFO="NONE"compute clauses and the keyword MOREINFO="NONE"into are not allowed) inside the MOREINFO="NONE"where or MOREINFO="NONE"having clause of a MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"delete, MOREINFO="NONE"update, or subquery. (See "LINKEND="X45943"Subqueries
" for more information.) value_list - is a list of values. Put single or double quotes around character values, and separate each value from the following one with a comma. (See example 7.) The list can be a list of variables, for example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"inMOREINFO="NONE" (@a, @b, @c)REMAP="UN--Under"but you cannot use a variable containing a list, such as:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"@a = "'1', '2', '3'"REMAP="UN--Under"for a values list. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"where advance * $2 > total_sales * pricewhere phone not like '415%' REMAP="UN--Under"Finds all the rows in which the phone number does not begin with 415. where au_lname like "[CK]ars[eo]n"REMAP="UN--Under"Finds the rows for authors named Carson, Carsen, Karsen, and Karson. where sales_east.syb_identity = 4REMAP="UN--Under"Finds the row of the sales_east table in which the IDENTITY column has a value of 4.where advance < $5000 or advance is null where (type = "business" or type = "psychology") and advance > $5500 where total_sales between 4095 and 12000 where state in ('CA', 'IN', "MD') REMAP="UN--Under"Finds the rows in which the state is one of the three in the list. CommentsMARK="BULL" REMAP="BU--Bullet"ID="IN5012-197306161"where clauseaggregate functions not permitted in;where clause:having and
ID="IN5019-201310162"Aggregate functionsnot permitted in where clause;Aggregate functions:where clause and
MOREINFO="NONE"where and MOREINFO="NONE"having search conditions are identical, except that aggregate functions are not permitted in MOREINFO="NONE"where clauses. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"having avg(price) > 20 REMAP="UN--Under"is legal;REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where avg(price) > 20REMAP="UN--Under"is not. See "LINKEND="X79130"Aggregate Functions
" for information on the use of aggregate functions, and MOREINFO="NONE""LINKEND="X96182"group by and having Clauses
" for examples. There are two ways to specify literal quotes within a char or varchar entry. The first method is to use two quotes. For example, if you began a character entry with a single quote and wish to include a single quote as part of the entry, use two single quotes: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"'I don''t understand.'' REMAP="UN--Under"With double quotes: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE""He said, ""It's not really confusing.""" REMAP="UN--Under"The second method is to enclose a quote in the opposite kind of quote mark. In other words, surround an entry containing double quotes with single quotes (or vice versa). Here are some examples: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"'George said, "There must be a better way."' "Isn't there a better way?" 'George asked, "Isn"t there a better way?"' ID="IN5052-201310163"\ (backslash), character string continuation withTo enter a character string longer than the width of your screen, enter a backslash (\) before going to the next line. ID="IN5010-203312164"Conversionwhere clause and datatype
ID="IN5016-205314165"Comparing valuesComparing valuesdatatype conversion for;Comparing values:in where clausewhere clauseIf a column is compared to a constant or variable in a MOREINFO="NONE"where clause, SQL Server converts the constant or variable into the datatype of the column, so the system can use the index for data retrieval. For example, float expressions are converted to int when compared to an int column. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where int_column = 2REMAP="UN--Under" selects rows where int_column = 2. ID="IN5020-207316166"Number (quantity of)arguments, in a where clause
ID="IN509-209318167"Argumentswhere clause, number allowedA MOREINFO="NONE"where clause can include a maximum of 128 search arguments per table, where the search arguments are in the form:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"column_name MOREINFO="NONE"comparison-operator constant-expressionStandards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantSee AlsoCommands      LINKEND="X45593"delete
, LINKEND="X30305"execute
, LINKEND="X96182"group by and having Clauses
, LINKEND="X91835"insert
, LINKEND="X35229"select
, LINKEND="X54355"updateTopics     LINKEND="X84316"Datatypes
, LINKEND="X20204"Expressions
, LINKEND="X45943"Subqueries
, LINKEND="X18218"Wildcard CharactersSystem procedures     LINKEND="X90336"sp_helpjoins
ID="IN5012-213322171"where clause
ID="IN5017-216325172"Search conditionswhere clause
ID="IN5013-220329173"while keywordID="X37548"whileID="IN515-224334175"Loopswhile;while loop
ID="IN5134-229339176"Repeated execution. See while loop
ID="IN5136-235345177"Counters, while loop. See while loop
Sets a condition for the repeated execution of a statement or statement block. The statement(s) are executed repeatedly as long as the specified condition is true.FORMAT="LINESPECIFIC"whileMOREINFO="NONE" logical_expression MOREINFO="NONE"     statement Keywords and OptionsREMAP="RI--RefIndent"logical_expression - is any expression that returns TRUE, FALSE or NULL.statement - can be a single SQL statement, but is usually a block of SQL statements delimited by MOREINFO="NONE"begin and MOREINFO="NONE"end. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"while (select avg(price) from titles) < $30begin    update titles        set price = price * 2    select avg(price) from titlesendREMAP="UN--Under"If the average price is less than $30, double the prices of all books in the titles table. Then, you can query for the new average price. As long as it is still less than $30, the MOREINFO="NONE"while loop keeps doubling the prices. Other than determining the average price after each update, the MOREINFO="NONE"select inside the MOREINFO="NONE"while loop also indicates how many loops where completed (each average result returned by SQL Server indicates one loop).CommentsID="IN5113-240350182"break commandwhile loopMARK="BULL" REMAP="BU--Bullet"The execution of statements in the MOREINFO="NONE"while loop can be controlled from inside the loop with the MOREINFO="NONE"breakID="IN5116-245355183"continue commandwhile loop
 and MOREINFO="NONE"continue commands. MOREINFO="NONE"continue causes the MOREINFO="NONE"while loop to restart, skipping any statements after the MOREINFO="NONE"continue. MOREINFO="NONE"break causes an exit from the MOREINFO="NONE"while loop, and any statements that appear after the keyword MOREINFO="NONE"end, which marks the end of the loop, are executed. MOREINFO="NONE"break and MOREINFO="NONE"continue are often (but not always) activated by MOREINFO="NONE"if tests. ID="IN5116-250360184"continue commandwhile loop
ID="IN5113-255365185"break commandwhile loopREMAP="UN--Under"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"while (select avg(price) from titles) < $30 begin     update titles         set price = price * 2     if (select max(price) from titles) > $50         break     else         if (select avg(price) from titles) > $30            continue     print "Average price still under $30"end  select title_id, price from titles    where price > $30REMAP="UN--Under"This batch continues to double the prices of all books in titles as long as the average book price is less than $30. However, if any book price exceeds $50, the MOREINFO="NONE"break stops the MOREINFO="NONE"while loop. The MOREINFO="NONE"continue prevents the MOREINFO="NONE"print statement from executing if the average does exceed $30. Regardless of how the MOREINFO="NONE"while loop terminates (either normally or through the MOREINFO="NONE"break), the last query indicates what books are priced over $30.ID="IN517-257367186"Nestingwhile loopsIf two or more MOREINFO="NONE"while loops are nested, the MOREINFO="NONE"break exits to the next outermost loop. First all the statements after the end of the inner loop run, and then the next outermost loop restarts. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X55146"begin...end
MOREINFO="NONE", LINKEND="X41626"break
MOREINFO="NONE", LINKEND="X69990"continue
MOREINFO="NONE", LINKEND="X60287"goto Label
ID="IN5113-261371190"while keyword
ID="IN5117-265375191"writetext commandID="X97484"writetextID="IN5214-269380193"image datatypewritetext to
ID="IN5221-269380194"Non-logged operations
ID="IN528-271382195"Updatingwritetext
Permits non-logged, interactive updating of an existing text or imageID="IN5226-275386196"Logging text or image data
ID="IN5239-279390197"Write operations, logging text or image
 column. FORMAT="LINESPECIFIC"writetext [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name.MOREINFO="NONE"column_nametext_pointer [with log] MOREINFO="NONE"data Keywords and OptionsREMAP="RI--RefIndent"table_name.column_name - the name of the column must include the table name. The database name and owner name are optional. text_pointer- a varbinary(16) value that stores the pointer to the text or image data. Use the MOREINFO="NONE"textptr function to determine this value, as shown in the example below. text and image data is not stored in the same set of linked pages as other table columns. It is stored in a separate set of linked pages. A pointer to the actual location is stored with the data; MOREINFO="NONE"textptr returns this pointer.ID="IN5226-283394200"with log option, writetext
ID="IN5216-285396201"Transaction logswritetext with log and
MOREINFO="NONE"with log - logs the inserted text or image data. The use of this option aids media recovery, but logging large blocks of data quickly increases the size of the transaction log. Make sure that the transaction log resides on a separate database device (see MOREINFO="NONE"create database, MOREINFO="NONE"sp_logdevice, and the System Administration Guide for details). data - the data to be written into the text or image column. text data must be enclosed in quotes. image data must be preceded by "0x". Check the information about the client software you are using to determine the maximum length of text or image data the client can handle.ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"declare @val varbinary(16) select @val = textptr(copy) from blurbs     where au_id = "409-56-7008" writetext blurbs.copy @val with log "hello world"REMAP="UN--Under"This example puts the text pointer into the local variable @val, then MOREINFO="NONE"writetext places the text string "hello world" into the text field pointed to by @val.CommentsID="IN524-289400204"Sizetext and image dataMARK="BULL" REMAP="BU--Bullet"The maximum length of text that can be inserted interactively with MOREINFO="NONE"writetext is approximately 120K bytes for text and image data. By default, MOREINFO="NONE"writetext is a non-logged operation. This means that text or image data is not logged when it is written into the database. In order to use MOREINFO="NONE"writetext in its default, non-logged state, a System Administrator must use MOREINFO="NONE"sp_dboption to set MOREINFO="NONE"select into/bulkcopy on. This permits the insertion of non-logged data. MOREINFO="NONE"writetext updates text data in an existing row. The update completely replaces all of the existing text. MOREINFO="NONE"writetext operations are not caught by an MOREINFO="NONE"insert or MOREINFO="NONE"update trigger. MOREINFO="NONE"writetext requires a valid text pointer to the text or image column. In order for a valid text pointer to exist, a text column must contain either actual data or a null value that has been explicitly entered with MOREINFO="NONE"update. REMAP="UN--Under"Given the table textnull with columns key and x, where x is a text column that permits nulls, this MOREINFO="NONE"update sets all the text values to NULL and assigns a valid text pointer in the text column: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update textnull set x = nullREMAP="UN--Under"No text pointer results from an MOREINFO="NONE"insert of an explicit null:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert textnull values (2,null)REMAP="UN--Under"or this implicit null insert:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert textnull (key) values (2) MOREINFO="NONE"insert and MOREINFO="NONE"update on text columns are logged operations. You cannot use MOREINFO="NONE"writetext on text and image columns in views. ID="IN5224-291402205"Multibyte character setswritetext andIf you attempt to use MOREINFO="NONE"writetext on text values after changing to a multibyte character set and have not run MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text, the command fails and an error message is generated instructing you to run MOREINFO="NONE"dbcc MOREINFO="NONE"fix_text on the table. ID="IN5211-295406206"Performancewritetext during dump database
MOREINFO="NONE"writetext in its default. unlogged mode runs more slowly while a MOREINFO="NONE"dump database is taking place.ID="IN5214-301412207"Speed (Server)writetext compared to dbwritetext and dbmoretext
ID="IN5219-307418208"DB-Library programsdbwritetext and dbmoretext, writetext compared toThe Client Library functions MOREINFO="NONE"dbwritetext andMOREINFO="NONE" dbmoretext are faster and use less dynamic memory than MOREINFO="NONE"writetext. These functions can insert up to two gigabytes of text data. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X28630"readtextFunctions     LINKEND="X29354"text and image FunctionsTopics     LINKEND="X39672"text and image DatatypesNUMBER="2" ID="X56300"Transact-SQL FunctionsID="IN22110011"Reference informationTransact-SQL functions
ID="IN21210012"Transact-SQLextensions
ID="IN2219743"SQL. See Transact-SQLREMAP="BO--Body"This chapter describes the Transact-SQL functions. Functions are used to return information from the database. They are allowed in the MOREINFO="NONE"select list, in the MOREINFO="NONE"where clause, and anywhere else an expression is allowed. They are often used as part of a stored procedure or program.REMAP="BO--Body"LINKEND="X99632"Table 2-1
ID="IN2189474"Built-in functionsBuilt-in functionsSee also individual function names!see also individual function names
ID="IN2189475"Built-in functions
 lists the different types of Transact-SQL functions and describes the type of information each returns:TOCENTRY="1"LBL="Table 2-1: " ID="X99632"Transact-SQL functionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Type of FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AggregateCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Generate summary values that appear as new 
columns in the query results. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Datatype Conversion COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Change expressions from one datatype to another and 
specify new display formats for date/time 
information. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DateCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Do computations on datetime and smalldatetime values 
and their components, date parts. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Label FunctionsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Perform comparisons between sensitivity labels.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MathematicalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Return values commonly needed for operations on 
mathematical data. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Row AggregateCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Generate summary values that appear as additional 
rows in the query results. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StringCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Operate on binary data, character strings, and 
expressions. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SystemCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Return special information from the database.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"text/imageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Supply values commonly needed for operations on 
text and image data.ID="X79130"Aggregate Functions  
The aggregate functions generate summary values that appear as new columns in the query results. They can be used in the select list or the MOREINFO="NONE"havingID="IN43149663"select commandaggregates and
 clause of a MOREINFO="NONE"select statement or subquery, and often appear in a statement that includes a MOREINFO="NONE"group by clause. SyntaxREMAP="BO--Body"Aggregates follow the general form: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"MOREINFO="NONE"aggregate_function ([all | distinct] MOREINFO="NONE"expression) REMAP="BO--Body"The aggregate functions, their individual syntax, and the results they produce are shown later. Note that MOREINFO="NONE"expressionID="IN43119486"all keywordaggregate functions and
 is usually a column name, MOREINFO="NONE"allID="IN431692107"distinct keywordaggregate functions and
 and MOREINFO="NONE"distinct are optional for MOREINFO="NONE"sum, MOREINFO="NONE"avg, and MOREINFO="NONE"count (but not MOREINFO="NONE"count(*)), and thatMOREINFO="NONE" count(*) takes no arguments. MOREINFO="NONE"sum and MOREINFO="NONE"avg can only be used on exact numeric, approximate numeric, and money datatypes. TOCENTRY="1"LBL="Table 2-2: "Aggregate functionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="17*"COLNAME="C2" COLWIDTH="22*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Aggregate FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Result VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sum([all | distinct] expression) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Total of (distinct) values in the numeric 
column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"avg([all | distinct] expression) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Average of (distinct) values in the 
numeric column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"count([all | distinct] expression) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of (distinct) non-null values in 
the column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"count(*) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of selected rows COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"max(expression) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Highest value in the expression COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"min(expression) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Lowest value in the expression Keywords and OptionsREMAP="RI--RefIndent"aggregate_function ID="IN4314921010"Summary valuesaggregate functions and
- is the name of one of the aggregates. The aggregate functions calculate summary values, such as averages and sums, from the values in a particular column. For each set of rows to which an aggregate function is applied, a single value is generated. ID="IN4313901211"having clauseaggregate functions and
ID="IN4319881412"Aggregate functionshaving clause andREMAP="UN--Under"The aggregates can be used in a select list or a MOREINFO="NONE"having clause. They cannot be used in a MOREINFO="NONE"where clause. ID="INA4315861613"group by clauseaggregate functions and
ID="IN4319841814"Aggregate functionsgroup by clause andREMAP="UN--Under"Aggregates are often used with MOREINFO="NONE"group by. With MOREINFO="NONE"group by, the table is divided into groups. Aggregates produce a single value for each group. Without MOREINFO="NONE"group by, an aggregate function in the select list produces a single value as a result, whether it is operating on all the rows in a table or on a subset of rows defined by a MOREINFO="NONE"where clause. ID="IN4311822015"all keywordaggregate functions and
MOREINFO="NONE"all - applies the aggregate to all values. MOREINFO="NONE"all is the default.   ID="IN4316802216"distinct keywordaggregate functions and
MOREINFO="NONE"distinct - eliminates duplicate values before an aggregate is applied. MOREINFO="NONE"distinct is optional with MOREINFO="NONE"sum, MOREINFO="NONE"avg, and MOREINFO="NONE"count.   column_name - is the name of a column. expression - is a column name, constant, function, any combination of column names, constants, and functions connected by arithmetic or bitwise operators, or a subquery. With aggregates, an expression is usually a column name. (See "LINKEND="X20204"Expressions
" for more information.) ID="IN4322772517"sum aggregate function
MOREINFO="NONE"sum - finds the sum of all the values in a column. MOREINFO="NONE"sum can only be used on numeric (integer, floating point, or money) datatypes. Null values are ignored in calculating sums.   ID="IN4322742818"avg aggregate function
MOREINFO="NONE"avg - finds the average of the values in a column. MOREINFO="NONE"sum can only be used on numeric (integer, floating point, or money) datatypes. Null values are ignored in calculating averages.    ID="IN4324713119"count aggregate function
MOREINFO="NONE"count - finds the number of non-null values in a column. When MOREINFO="NONE"distinct is specified, MOREINFO="NONE"count finds the number of unique non-null values. MOREINFO="NONE"count can be used with all datatypes except text and image. Null values are ignored when counting.MOREINFO="NONE" count(column_name) will return a value of 0 on empty tables, on columns that contain only null values, and on groups that contain only null values.ID="IN4327683420"count(*) aggregate function
MOREINFO="NONE"count(*)ID="IN4320663621"Number (quantity of)rows in count(*)
 - finds the number of rows. MOREINFO="NONE"count(*) does not take any arguments, and cannot be used with MOREINFO="NONE"distinct. All rows are counted, regardless of the presence of null values.   ID="IN4322633922"max aggregate function
MOREINFO="NONE"max - finds the maximum value in a column. MOREINFO="NONE"max can be used with exact and approximate numeric, character, and datetime columns. It cannot be used with bit columns. With character columns, MOREINFO="NONE"max finds the highest value in the collating sequence. MOREINFO="NONE"max ignores null values. MOREINFO="NONE"distinct is not available, since it is not meaningful with MOREINFO="NONE"max.   ID="IN4322604223"min aggregate function
MOREINFO="NONE"min - finds the minimum value in a column. MOREINFO="NONE"min can be used with numeric, character, and datetime columns. It cannot be used with bit columns. With character columns, MOREINFO="NONE"min finds the lowest value in the sort sequence. MOREINFO="NONE"min ignores null values. MOREINFO="NONE"distinct is not available, since it is not meaningful with MOREINFO="NONE"min.   ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select avg(advance), sum(total_sales) from titles where type = "business"REMAP="UN--Under"Calculates the average advance and the sum of total sales for all business books. Each of these aggregate functions produces a single summary value for all of the retrieved rows. select type, avg(advance), sum(total_sales) from titles group by type REMAP="UN--Under"Used with a MOREINFO="NONE"group by clause, the aggregate functions produce single values for each group, rather than for the whole table. This statement produces summary values for each type of book. select count(distinct city) from authors REMAP="UN--Under"Finds the number of different cities in which authors live. MOREINFO="NONE"select type from titles groupMOREINFO="NONE" by type having count(*) > 1 REMAP="UN--Under"Lists the types in the titles table, but eliminates the types that include only one book, or none. select pub_id, sum(advance), avg(price) from titles group by pub_id having sum(advance) > $25000 and avg(price) > $15REMAP="UN--Under"Groups the titles table by publishers, and includes only those groups of publishers who have paid more than $25,000 in total advances, and whose books average more than $15 in price. CommentsID="IN4314584427"select commandaggregates andMARK="BULL" REMAP="BU--Bullet"Aggregate functions can be used in the select_list ID="IN4319564628"Aggregate functionshaving clause and
ID="IN4313544829"having clauseaggregate functions and
or in the MOREINFO="NONE"having clause of a MOREINFO="NONE"select statement. They cannot be used in a MOREINFO="NONE"whereID="IN436544830"Tableswork;Work tables, number of
ID="IN4320544831"Number (quantity of)tables allowed in a query;Number (quantity of):work tables allowed
 clause. Because each aggregate in a query requires its own work table, a query using aggregates can exceed the maximum number of tables allowed in a query (16). ID="IN436544832"Addingsummary columnsAggregate functions calculate the summary values of the non-null values in a particular column. If the MOREINFO="NONE"ansinull option is set MOREINFO="NONE"off (the default), there is no warning when an aggregate function encounters a null. If MOREINFO="NONE"ansinull is set MOREINFO="NONE"on, a query returns the following SQLSTATE warning when an aggregate function encounters a null:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Warning- null value eliminated in set functionID="IN4319544833"Aggregate functionsscalar aggregatesAggregate functions can be applied to all the rows in a table, in which case they produce a single value, a scalar aggregate. They can also be applied to all the rows that have the same value in a specified column or expression (using the MOREINFO="NONE"group by and, optionally, the MOREINFO="NONE"havingID="IN4319544834"Aggregate functionsvector aggregates
 clause), in which case they produce a value for each group, a vector aggregate. The results of the aggregate functions are shown as new columns. ID="IN437544835"Nestingaggregate functions
ID="IN4317544836"Scalar aggregatesnesting vector aggregates within
ID="IN4317544837"Vector aggregatesnestingREMAP="UN--Under"You can nest a vector aggregate inside a scalar aggregate. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select type, avg(price), avg(avg(price)) from titles group by typeREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type ------------  ------------  ------------ UNDECIDED             NULL        15.23  business             13.73        15.23 mod_cook             11.49        15.23 popular_comp         21.48        15.23 psychology           13.50        15.23 trad_cook            15.96        15.23  (6 rows affected) REMAP="UN--Under"The MOREINFO="NONE"group by clause applies to the vector aggregate-in this case, MOREINFO="NONE"avg(price). The scalar aggregate-MOREINFO="NONE"avg(MOREINFO="NONE"avg(price))-is the average of the average prices by type in the titles table. ID="IN4314525038"select commandselect commandin Transact-SQL compared to standard SQLTransact-SQL compared to standard SQL
ID="IN4314505239"select commandrestrictions in standard SQLIn standard SQL, when a select_list includes an aggregate, all the select_list columns must either have aggregate functions applied to them or be in the MOREINFO="NONE"group by list. Transact-SQL has no such restrictions. ID="IN4336505240"Standard SQL, aggregate functions inaggregate functions inREMAP="UN--Under"The first example following shows a MOREINFO="NONE"select statement with the standard restrictions; the second one shows the same statement with another item (title_id) added to the select list; MOREINFO="NONE"order by is also added to illustrate the difference in displays. These "extra" columns can also be referenced in a MOREINFO="NONE"having clause. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select type, avg(price), avg(advance) from titles group by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type ------------  ------------  ------------ UNDECIDED             NULL         NULL business             13.73     6,281.25 mod_cook             11.49     7,500.00 popular_comp         21.48     7,500.00 psychology           13.50     4,255.00 trad_cook            15.96     6,333.33  (6 rows affected)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select type, title_id, avg(price), avg(advance) from titles group by type order by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type         title_id -----------  --------    ---------- --------- UNDECIDED       MC3026      NULL        NULL business        BU1032      13.73   6,281.25 business        BU1111      13.73   6,281.25 business        BU2075      13.73   6,281.25 business        BU7832      13.73   6,281.25 mod_cook        MC2222      11.49   7,500.00 mod_cook        MC3021      11.49   7,500.00 popular_comp    PC1035      21.48   7,500.00 popular_comp    PC8888      21.48   7,500.00 popular_comp    PC9999      21.48   7,500.00 psychology      PS1372      13.50   4,255.00 psychology      PS2091      13.50   4,255.00 psychology      PS2106      13.50   4,255.00 psychology      PS3333      13.50   4,255.00 psychology      PS7777      13.50   4,255.00 trad_cook       TC3218      15.96   6,333.33 trad_cook       TC4203      15.96   6,333.33 trad_cook       TC7777      15.96   6,333.33  (18 rows affected)ID="IN4319485441"Aggregate functionsgroup by clause and
ID="IN4315465642"group by clauseaggregate functions andYou can use either a column name or any other expression (except a column heading or alias) after MOREINFO="NONE"group by. Null values in the MOREINFO="NONE"group by column are put into a single group. ID="IN4314445843"compute clauseusing row aggregates
ID="IN4314426044"Row aggregatescompute andThe MOREINFO="NONE"compute clause in a MOREINFO="NONE"select statement uses row aggregates to produce summary values. The row aggregates make it possible to retrieve detail and summary rows with one command. The following example illustrates this feature:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select type, title_id, price, advance from titles where type = "psychology" order by type compute sum(price), sum(advance) by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"type        title_id    price       advance ----------- -------     ----------  ---------psychology  PS1372          21.59   7,000.00 psychology  PS2091          10.95   2,275.00 psychology  PS2106          7.00    6,000.00 psychology  PS3333          19.99   2,000.00 psychology  PS7777          7.99    4,000.00                             sum     sum                             ------- ----------                             67.52   21,275.00(6 rows affected)REMAP="UN--Under"Note the difference in display between the above example and the earlier examples without MOREINFO="NONE"compute. ID="IN435386445"Joinscount or count(*) with When tables are being joined, including MOREINFO="NONE"count(*) in the MOREINFO="NONE"select list produces the count of the number of rows in the joined results. If the objective is to count the number of rows from one table that match criteria, use MOREINFO="NONE"count(MOREINFO="NONE"column_name). ID="IN4312366646"int datatypeaggregate functions andWhen you sum or average integer data, SQL Server treats the result as an int value, even if the datatype of the column is smallint or tinyint. To avoid overflow errors in DB-Library programs, declare all variables for results of averages or sums as type intID="IN4319366647"DB-Library programsoverflow errors;Overflow errors:DB-Library
. Aggregate functions cannot be used on virtual tables such as sysprocesses and syslocks. If you include an aggregate function in the MOREINFO="NONE"selectID="IN437366648"Cursorsaggregate functions and;Aggregate functions:cursors and
clause of a cursor, that cursor is not updatable.Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="308*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantEntry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"By default, the aggregate 
functions are not 
compliant. MOREINFO="NONE"set ansinull on 
for compliant behavior.See AlsoCommands     LINKEND="X48334"compute Clause
, LINKEND="X96182"group by and having Clauses
, LINKEND="X35229"select
, LINKEND="X30827"where Clause
ID="IN4319346852"Aggregate functions
 Functions      LINKEND="X24911"Row Aggregate Functions
 Topics     LINKEND="X80039"CursorsREMAP="BO--Body"ID="X13154"Datatype Conversion Functions
Datatype conversion functions change expressions from one datatype to another and specify new display formats for date/time information. SQL Server provides three datatype conversion functions, MOREINFO="NONE"convert(), MOREINFO="NONE"inttohex(), and MOREINFO="NONE"hextoint(), which can be used in the select list, in the MOREINFO="NONE"where clause, and anywhere else an expression is allowed.FORMAT="LINESPECIFIC"TOCENTRY="1"LBL="Table 2-3: "Datatype conversion functionsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="9*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ArgumentCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ResultVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"convert COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(datatype [(length) | (precision[, scale])], 
expression[, style])COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Converts between a wide variety 
of datatypes and reformats 
date/time and money data for 
display purposes.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"hextoint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(hexadecimal_string)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the platform-
independent integer equivalent 
of a hexadecimal string.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"inttohex COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(integer_expression)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the platform-
independent hexadecimal 
equivalent of an integer.Keywords and OptionsREMAP="RI--RefIndent"datatype - is the system-supplied datatype (for example, char(10), varbinary(50), or int) into which the expression is to be converted. User-defined datatypes cannot be used. length - is an optional parameter used with char, nchar, varchar, nvarchar, binary and varbinary datatypes. If you do not supply a length, SQL Server truncates the data to 30 characters for the character types and 30 bytes for the binary  types. The maximum allowable length for character and binary data is 255. precision - is the number of significant digits in a numeric or decimal datatype. For float datatypes, precision is the number of significant binary digits in the mantissa. If you do not supply a precision, SQL Server uses the default precision of 18 for numeric and decimal datatypes.scale - is the number of digits to the right of the decimal point in a numeric, or decimal datatype. If you do not supply a scale, SQL Server uses the default scale of 0.expression - is the value to be converted from one datatype or date format to another. hexadecimal_string ID="IN43109845"CharactersCharactersÒ 0xÓ ;Ò 0xÓ [0x];Zero x (0x)0x
- is the hexadecimal value to be converted to an integer. This must be either a a character type column or variable name or a valid hexadecimal string, with or without a 0x prefix, enclosed in quotes.integer_expression - is the integer value to be converted to a hexadecimal string.ID="IN43339846"Style values, date representation
ID="IN43109847"Conversionstyles for dates
style - is the display format to use for the converted data. When converting money or smallmoney data to a character type, use a style of 1 to display a comma after every three digits.REMAP="UN--Under"When converting datetime or smalldatetime data to a character type, use the style numbers in LINKEND="X53500"Table 2-4
 to specify the display format.  Values in the leftmost column display two-digit years (yy). For four-digit years (yyyy), add 100 or use the value in the middle column. TOCENTRY="1"LBL="Table 2-4: " ID="X53500"Display formats for date/time information COLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="17*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Without 
Century (yy)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"With Century 
(yyyy)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OutputVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 or 100COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mon dd yyyy hh:miAM (or PM) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"101COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mm/dd/yy COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"102COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"yy.mm.dd COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"103COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dd/mm/yy COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"104COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dd.mm.yy COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"105COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dd-mm-yy COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"106COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dd mon yy COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"107COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mon dd, yy COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"108COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"hh:mm:ss COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0" -COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"9 or 109COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mon dd yyyy 
hh:mi:ss:mmmAM (or PM) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"110COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mm-dd-yy COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"11COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"111COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"yy/mm/dd COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"112COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"yymmdd REMAP="UN--Under"The default values (style 0 or 100, and 9 or 109) always return the century (yyyy). REMAP="UN--Under"When converting to char or varchar from  smalldatetime, styles that include seconds or milliseconds show zeroes in those positions. Supported ConversionsID="IN43209759"Datatype conversionsimplicitREMAP="BO--Body"SQL Server performs certain datatype conversions automatically. These are called implicit conversions. For example, if you compare a char expression and a datetime expression, or a smallint expression and an int expression, or char expressions of different lengths, SQL Server automatically converts one datatype to another. REMAP="BO--Body"You must request other datatype conversions explicitly, using one of the built-in datatype conversion functions. For example, before concatenating numeric expressions, you must convert them to character expressions.REMAP="BO--Body"SQL Server does not allow you to convert certain datatypes to certain other datatypes, either implicitly or explicitly. For example, you cannot convert smallint data to datetime, or datetime data to smallint. Unsupported conversions result in error messages.REMAP="BO--Body"LINKEND="X61687"Figure 2-1
 indicates whether individual datatype conversions are performed implicitly or explicitly or are unsupported.FLOAT="0"FORMAT="UNKNOWN" FILEREF="fig2_5.xwd"ID="X61687" LBL="Figure 2-1: " Explicit, implicit, and unsupported datatype conversionsExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select title, convert(char(12), total_sales) from titles select title, total_sales from titles where convert(char(20), total_sales) like "1%" select convert(char(12), getdate(), 3) REMAP="UN--Under"Converts the current date to style "3", dd/mm/yy. select convert(varchar(12), pubdate, 3) from titles REMAP="UN--Under"If the value pubdate can be null, you must use varchar rather than char, or errors may result. select hextoint ("0x00000100")REMAP="UN--Under"Returns the integer equivalent of the hexadecimal string 0x00000100. The result is always 256, regardless of the platform on which it is executed.select convert(integer, 0x00000100)REMAP="UN--Under"Returns the integer equivalent of the string 0x00000100. Results can vary from one platform to another.select inttohex (10)REMAP="UN--Under"Returns a hexadecimal string, without 0x prefix, representing the value of the integer 10. The result is always  "0000000A" regardless of the executing platform.select convert (binary, 10)REMAP="UN--Under"Returns the platform-specific bit pattern as a Sybase binary type.select convert(bit, $1.11)REMAP="UN--Under"Returns 1, the bit string equivalent of $1.11. ID="IN432097512"Datatype conversionscharacter informationConverting Character Data to a Non-Character TypeREMAP="BO--Body"Character data can be converted to a non-character type-such as a money, date/time, exact numeric, or approximate numeric type-if it consists entirely of characters that are valid for the new type. Leading blanks are ignored.REMAP="BO--Body"ID="IN43694814"Errorsconvert function
Syntax errors are generated when the data includes unacceptable characters. Following are some examples of characters that cause syntax errors:MARK="BULL" REMAP="BU--Bullet"Commas or decimal points in integer dataCommas in monetary dataLetters in exact or approximate numeric data or bit stream dataMisspelled month names in date/time dataID="IN432094815"Datatype conversionscharacter informationConverting from One Character Type to AnotherID="IN432494817"Multibyte character setsconvertingREMAP="BO--Body"When converting from a multibyte character set to a single-byte character set, characters with no single-byte equivalent are converted to blanks.ID="IN4313921018"text datatypeconvertingREMAP="BO--Body"text columns can be explicitly converted to char, nchar, varchar, or nvarchar. You are limited to the maximum length of the character datatypes, 255 bytes. If you do not specify the length, the converted value has a default length of 30 bytes.ID="IN4320921019"Datatype conversionsnumeric informationConverting Numbers to a Character TypeREMAP="BO--Body"Exact and approximate numeric data can be converted to a character type. If the new type is too short to accommodate the entire string, an insufficient space error is generated. For example, the following conversion tries to store a 5-character string in a 1-character type:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select convert(char(1), 12.34)Insufficient result space for explicit conversionof NUMERIC value '12.34' to a CHAR field.When converting float data to a character type, the new type should be at least 25 characters long.ID="IN4320921021"Datatype conversionsmoney informationID="IN4320921022"Datatype conversionsrounding duringRounding During Conversion to/from Money TypesREMAP="BO--Body"The money and smallmoney types store four digits to the right of the decimal point, but round up to the nearest hundredth (.01) for display purposes. When data is converted to a money type, it is rounded up to four places. REMAP="BO--Body"Data converted from a money type follows the same rounding behavior if possible. If the new type is an exact numeric with less than three decimal places, the data is rounded to the scale of the new type. For example, when $4.50 is converted to an integer, it yields 4:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select convert(int, $4.50)              -----------            5 REMAP="BO--Body"Data converted to money or smallmoney is assumed to be in full currency units, such as dollars, rather than in fractional units, such as cents. For example, the integer value of 5 would be converted to the money equivalent of 5 dollars, not 5 cents, in us_english.  ID="IN4320921024"Datatype conversionsdate/time informationConverting Date/time InformationREMAP="BO--Body"Data that is recognizable as a date can be converted to datetime or smalldatetime. Incorrect month names lead to syntax errors. Dates that fall outside the acceptable range for the datatype lead to arithmetic overflow errors.REMAP="BO--Body"When datetime values are converted to smalldatetime, they are rounded up to the nearest minute.ID="IN4320921026"Datatype conversionsnumeric informationConverting Between Numeric TypesREMAP="BO--Body"Data can be converted from one numeric type to another. If the new type is an exact numeric whose precision or scale is not sufficient to hold the data, errors can occur. Use theMOREINFO="NONE" arithabort and MOREINFO="NONE"arithignore options to determine how these errors are handled.The MOREINFO="NONE"arithabort and MOREINFO="NONE"arithignore options have been redefined for Release 10.0. If you use these options in your applications, examine them to be sure they are still producing the desired behavior.ID="IN4320921028"Datatype conversionsoverflow errorsID="IN436921029"Errorsdivide-by-zeroID="IN436921030"Errorsarithmetic overflowID="X17608"Arithmetic Overflow and Divide-by Zero ErrorsREMAP="BO--Body"Divide-by-zero errors occur when SQL Server tries to divide a numeric value by zero. Arithmetic overflow errors occur when the new type has too few decimal places to accommodate the results. This happens during MARK="BULL" REMAP="BU--Bullet"Explicit or implicit conversions to exact types with a lower precision or scaleExplicit or implicit conversions of data that falls outside the acceptable range for a money or datetime type Conversions of hexadecimal strings requiring more than 4 bytes of storage using MOREINFO="NONE"hextointREMAP="BO--Body"Both arithmetic overflow and divide-by-zero erros are considered serious, whether they occur during implicit or explicit conversions. Use the MOREINFO="NONE"arithabort arith_overflow option to determine how SQL Server handles these errors. The default ID="IN4322861631"arithabort option, setarith_overflow and
setting,MOREINFO="NONE" arithabort arith_overflow on, rolls back the entire transaction or batch in which the error occurs. If you set MOREINFO="NONE"arithabort arith_overflow off, SQL Server aborts the statement that causes the error but continues to process other statements in the transaction or batch.You can use the @@error global variable to check statement results. REMAP="BO--Body"Use the ID="IN4323802232"arithignore option, setarith_overflow and
MOREINFO="NONE"arithignore arith_overflow option to determine whether SQL Server displays a message after these errors. The default setting, MOREINFO="NONE"off, displays a warning message when a divide-by-zero error or a loss of precision occurs.  Setting MOREINFO="NONE"arithignore arith_overflow on suppresses warning messages after these errors. The optional MOREINFO="NONE"arith_overflow keyword can be omitted without any effect. ID="IN4320802233"Datatype conversionsscale errors
ID="IN436802234"ErrorsscaleScale ErrorsREMAP="BO--Body"When an explicit conversion results in a loss of scale, the results are truncated without warning. For example, when you explicitly convert a float, numeric, or decimal type to an integer, SQL Server assumes you really want the result to be an integer and truncates all numbers to the right of the decimal point. ID="IN4322742835"arithabort option, setnumeric_truncation andREMAP="BO--Body"During implicit conversions to numeric or decimal types, loss of scale generates a scale error. Use the MOREINFO="NONE"arithabort numeric_truncation option to determine how serious such an error is considered. The default setting, MOREINFO="NONE"arithabort numeric_truncation on, aborts the statement that causes the error but continues to process other statements in the transaction or batch. If you set MOREINFO="NONE"arithabort numeric_truncation off, SQL Server truncates the query results and continues processing.For entry level SQL92 compliance, set:- arithabort arith_overflow off- arithabort numeric_truncation on- arithignore offID="IN436742836"ErrorsdomainID="IN4320742837"Datatype conversionsdomain errorsDomain ErrorsREMAP="BO--Body"The MOREINFO="NONE"convert() function generates a domain error when the function's argument falls outside the range over which the function is defined. This should happen very rarely. ID="IN436713138"Errorsconvert function
ID="IN4332713139"Integer datatypes, converting to
ID="IN4320713140"Datatype conversionshexadecimal-like informationConversions between Binary and Integer TypesREMAP="BO--Body"The binary and varbinaryID="IN4310713142"CharactersCharactersÒ 0xÓ ;Ò 0xÓ [0x];Zero x (0x)0x
 types store hexadecimal-like data consisting of a 0x prefix followed by a string of digits and letters. These strings are interpreted differently by different platforms.  For example, the string 0x0000100 represents 65536 on machines that consider byte 0 most significant, and 256 on machines that consider byte 0 least significant.The convert Function and Implicit ConversionsREMAP="BO--Body"The binary types can be converted to integer types either explicitly, using the MOREINFO="NONE"convert function, or implicitly. The data is stripped of its 0x prefix and then zero-padded if it is too short for the new type or truncated if it is too long. REMAP="BO--Body"Both MOREINFO="NONE"convert and the implicit datatype conversions evaluate binary data differently on different platforms. Because of this, results may vary from one platform to another. Use the MOREINFO="NONE"hextoint function for platform-independent conversion of hexadecimal strings to integers, and the MOREINFO="NONE"inttohex function for platform-independent conversion of integers to hexadecimal values.The hextoint FunctionID="IN4320693343"Datatype conversionshextoint function
ID="IN4317673544"hextoint functionREMAP="BO--Body"Use the MOREINFO="NONE"hextoint function for platform-independent conversions of hexadecimal data to integers. MOREINFO="NONE"hextoint accepts a valid hexadecimal string, with or without a 0x prefix, enclosed in quotes, or the name of a character type column or variable.REMAP="BO--Body"MOREINFO="NONE"hextoint returns the integer equivalent of the hexadecimal string. The function always returns the same integer equivalent for a given hexadecimal string, regardless of the platform on which it is executed.The inttohex FunctionID="IN4320653745"Datatype conversionsinttohex function
ID="IN4317633946"inttohex functionREMAP="BO--Body"Use the MOREINFO="NONE"inttohex function for platform-independent conversions of integers to hexadecimal strings. MOREINFO="NONE"inttohex accepts any expression that evaluates to an integer. It always returns the same hexadecimal equivalent for a given expression, regardless of the platform on which it is executed.Converting Image Columns to Binary TypesID="IN4320633948"Datatype conversionsimage informationREMAP="BO--Body"You can use theMOREINFO="NONE" convert function to convert an image column to binary or varbinary. You are limited to the maximum length of the binary datatypes, 255 bytes. If you do not specify the length, the converted value has a default length of 30 characters.Converting Other Types to bitID="IN4320633951"Datatype conversionsbit informationREMAP="BO--Body"Exact and approximate numeric types can be converted to the bit type implicitly. Character types require an explicit MOREINFO="NONE"convert function.REMAP="BO--Body"The expression being converted must consist only of digits, a decimal point, a currency symbol, and a plus or minus sign. The presence of other characters generates syntax errors.REMAP="BO--Body"The bit equivalent of 0 is 0. The bit equivalent of any other number is 1. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoFunctions     LINKEND="X69388"Date Functions
,LINKEND="X67592"Mathematical Functions
, LINKEND="X22985"String Functions
, LINKEND="X29354"text and image Functions
ID="IN4310614155"Conversiondatatypes;Datatypes:converting
 Topics     LINKEND="X84316"DatatypesREMAP="BO--Body"ID="X69388"Date Functions
Manipulate datetime values. FORMAT="LINESPECIFIC"REMAP="BO--Body"All date functions except MOREINFO="NONE"getdate take arguments. Function names, arguments, and results are listed in the following table. TOCENTRY="1"LBL="Table 2-5: "Date functionsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="13*"COLNAME="C3" COLWIDTH="16*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ArgumentCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ResultVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"getdate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"()COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the current system 
date and time.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"datename COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(datepart, date)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the name of the 
specified part (such as the 
month "June") of a datetime 
value, as a character string. If 
the result is numeric, such as 
"23" for the day, it is still 
returned as a character string.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"datepart COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(datepart, date)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns an integer value for 
the specified part of a datetime 
value. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"datediff COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(datepart, date1, date2)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns date2 - date1, 
measured in the specified 
date part. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dateadd COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(datepart, 
numeric_expression, 
date)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the date produced by 
adding the specified number 
of the specified date parts to 
the date. numeric_expression can be any numeric type; the 
value is truncated to an 
integer. Keywords and OptionsREMAP="RI--RefIndent"ID="IN43219485"getdate date function
MOREINFO="NONE"getdate ID="IN43109486"Retrievingcurrent date and time;Current date
- produces the current date and time in SQL Server's standard internal format for datetime values. getdateID="IN43169487"() (parentheses)in expressions;Parentheses ():in an expression
 takes the NULL argument, (). ID="IN431791118"datename function
MOREINFO="NONE"datename ID="IN431091119"Date parts
- produces the specified datepart (the first argument) of the specified date (the second argument) as a character string. Takes either a datetime or smalldatetime value as its second argument. ID="IN4317881410"datepart function
MOREINFO="NONE"datepart - produces the specified date part (the first argument) of the specified date (the second argument) as an integer. Takes either a ID="IN4317861611"datetime datatypedate functions and
datetimeID="IN4322841812"smalldatetime datatypedate functions an
 or smalldatetimeID="IN4333812113"Names in calendar. See Date parts
 value as its second argument. REMAP="UN--Under"It is also used as an argument with MOREINFO="NONE"dateadd, datediff, datename, and MOREINFO="NONE"datepart. The following table lists the date parts, the abbreviations recognized by SQL Server, and the acceptable values.TOCENTRY="1"LBL="Table 2-6: "Date parts and their valuesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="4*"COLNAME="C3" COLWIDTH="9*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Date PartCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"AbbreviationCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Values VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"yearCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"yyCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1753 - 9999 (2079 for 
smalldatetime)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"quarterCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"qqCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 - 4 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"monthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"mmCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 - 12 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"weekCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"wkCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 - 54 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dayCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ddCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 - 31 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dayofyearCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dyCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 - 366 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"weekdayCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dwCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 - 7 (Sun.-Sat.) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"hourCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"hhCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 - 23 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"minuteCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"miCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 - 59 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"secondCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ssCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 - 59 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"millisecondCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"msCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 - 999 ID="IN4322812114"Two-digit year numbersREMAP="UN--Under"If the year is given with two digits, <50 is the next century ("25" is "2025") and >=50 is this century ("50" is "1950"). ID="IN4337812115": (colon) preceding milliseconds
ID="IN4310812116". (period)preceding millisecondsREMAP="UN--Under"Milliseconds can be preceded either with a colon or a period. If preceded by a colon, the number means thousandths of a second. If preceded by a period, a single digit means tenths of a second, two digits mean hundredths of a second, and three digits mean thousandths of a second. For example, "12:30:20:1" means twenty and one-thousandth of a second past 12:30; "12:30:20.1" means twenty and one-tenth of a second past 12:30. date - an argument used with MOREINFO="NONE"dateadd, MOREINFO="NONE"datediff, MOREINFO="NONE"datename, and MOREINFO="NONE"datepart. The date can be either the function MOREINFO="NONE"getdateID="IN4324782417"Formats, date. See Dates
, a character string in one of the acceptable date formats (see "LINKEND="X84316"Datatypes
"), an expression that evaluates to a valid date format, or the name of a datetime column. ID="IN4317742818"datediff function
MOREINFO="NONE"datediff - calculates the number of date parts between two specified dates. It takes three arguments. The first is a date part. The second and third are dates, either datetime or smalldatetime values. The result is a signed integer value equal to date2 - date1, in dateparts. REMAP="UN--Under"ID="IN4310723019"Truncationdatediff results
MOREINFO="NONE"datediff results are always truncated, not rounded, when the result is not an even multiple of the datepart. For example, using MOREINFO="NONE"hour as the datepart, the difference between "4:00 AM" and "5:50AM" is 1. ID="IN4320723020"Midnights, number ofmidnightsREMAP="UN--Under"When you use MOREINFO="NONE"day as the datepart, it counts the number of midnights between the two times specified. For example, the difference between January 1, 1992, 23:00 and January 2, 1992, 01:00 is 1; the difference between January 1, 1992 00:00 and January 1, 1992, 23:59 is 0.ID="IN4330723021"First-of-the-months, number offirst-of-the-monthsREMAP="UN--Under"The MOREINFO="NONE"month datepart counts the number of first-of-the-months between two dates. For example, the difference between January 25 and February 2 is 1, while the difference between January 1 and January 31 is 0.ID="IN4320723022"Number (quantity of)Sundays;Sundays, number valueREMAP="UN--Under"When you use the datepart MOREINFO="NONE"week with MOREINFO="NONE"datediff, you get the number of Sundays between the two dates, including the second date but not the first. For example, the number of weeks between Sunday, January 4 and Sunday, January 11 is 1. REMAP="UN--Under"If smalldatetime values are used, they are converted to datetime values internally for the calculation. Seconds and milliseconds in smalldatetime values are automatically set to 0 for the purpose of the difference calculation. ID="IN4317683423"datediff functionID="IN4316653724"dateadd function
MOREINFO="NONE"dateadd ID="IN436653725"AddingAddingan interval to a dateinterval to a date
- adds an interval to a specified date. It takes three arguments-the datepart, a number, and a date. The result is a datetime value equal to the date plus the number of dateparts. REMAP="UN--Under"If the date argument is a smalldatetime value, the result is also a smalldatetime. You can use MOREINFO="NONE"dateadd to add seconds or milliseconds to a smalldatetime, but it is only meaningful if the result date returned by MOREINFO="NONE"dateadd changes by at least one minute. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"MOREINFO="NONE"Command
       MOREINFO="NONE"ResultREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"select rightnow = getdate( )    Nov 25 1995 10:32AM select datepart(month,getdate())11select datename(month getdate())NovemberREMAP="UN--Under"This example assumes a current date of November 25, 1995, 10:32 a.m. select newpubdate = dateadd(day, 21, pubdate) from titles REMAP="UN--Under"Displays the new publication dates when the publication dates of all the books in the titles table slip 21 days. select newdate = datediff(day, pubdate, getdate()) from titles REMAP="UN--Under"This query finds the number of days elapsed between pubdate and the current date (obtained with theMOREINFO="NONE" getdate function). CommentsMARK="BULL" REMAP="BU--Bullet"Date functions can be used in the select list or MOREINFO="NONE"where clause of a query. ID="IN435653728"Datesearliest allowed;Dates:pre-1753 datatypes for;Historic dates, pre-1753Use the datetime datatype only for dates after January 1, 1753. datetime values must be enclosed in single or double quotes. Use char, nchar, varchar or nvarchar for earlier dates. SQL Server recognizes a wide variety of date formats. See "MOREINFO="NONE"convert" and "LINKEND="X84316"Datatypes
" for more information. REMAP="UN--Under"SQL Server automatically converts between character and datetime values when necessary (for example, when you compare a character value to a datetime value). ID="IN4321614129"datefirst option, setThe date part MOREINFO="NONE"weekday or MOREINFO="NONE"dw returns the day of the week (Sunday, Monday, etc.) when used with MOREINFO="NONE"datenameID="IN4317594330"datepart function
, and a corresponding number when used with MOREINFO="NONE"datepartID="IN435594331"Namesweekday numbers and;Numbers:weekday names and;Order:weekday numeric
ID="IN4318594332"Weekday date valuenames and numbers
. The numbers that correspond to the names of weekdays depend on the MOREINFO="NONE"datefirstID="IN438594333"Defaultslanguage, and date parts;Language defaults:weekday order and
ID="IN4319594334"us_english languageweekdays setting
 setting. Some language defaults (including us_english) produce Sunday=1, Monday=2, and so on; others produce Monday=1, Tuesday=2,and so on.The default behavior can be changed on a per-session basis with MOREINFO="NONE"set datefirst.REMAP="UN--Under"Using MOREINFO="NONE"weekday or MOREINFO="NONE"dwID="IN4316574535"dateadd function
 with MOREINFO="NONE"dateadd and MOREINFO="NONE"datediff is not logical, and produces spurious results. Use MOREINFO="NONE"day or MOREINFO="NONE"dd instead. Since smalldatetime is accurate only to the minute, when a smalldatetimeID="IN4317554736"datename function
 value is used with either MOREINFO="NONE"datename or MOREINFO="NONE"datepart, seconds and milliseconds are always zero. ID="IN435534937"Rangedatediff results
ID="IN4317515138"datediff function
The MOREINFO="NONE"datediff function produces results of datatype intID="IN4318495339"Millisecond valuesdatediff results in
ID="IN4328475540"Seconds, datediff results in
, and causes errors if the result is greater than 2,147,483,647. For milliseconds, this is approximately 24 days, 20:31.846 hours. For seconds, this is 68 years, 19 days, 3:14:07 hours. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X35229"select
, LINKEND="X30827"where ClauseFunctions     LINKEND="X13154"Datatype Conversion FunctionsTopics     LINKEND="X84316"Datatypes
, LINKEND="X20204"Expressions
ID="IN4314455744"Date functionsdate
 REMAP="BO--Body"ID="X67592"Mathematical Functions
Mathematical functions return values commonly needed for operations on mathematical data. Mathematical function names are not keywords. FORMAT="LINESPECIFIC"REMAP="BO--Body"The mathematical functions take the general form: FORMAT="LINESPECIFIC"function_name(arguments) 
ID="INA4399484"Argumentsmathematical function;Mathematical functions:syntaxREMAP="BO--Body"The chart below lists the types of arguments that are used in the mathematical functions.TOCENTRY="1"LBL="Table 2-7: "Arguments used in mathematical functionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="28*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Argument 
TypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can Be Replaced ByVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"approx_numericCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any approximate numeric (float, real, or double 
precision) column name, variable, constant expression, 
or a combination of these. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"integerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any integer (tinyint, smallint or int) column name, 
variable, constant expression, or a combination of 
these.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numericCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any exact numeric (numeric, dec, decimal, tinyint, 
smallint, or int), approximate numeric (float, real, or 
double precision), or money column, variable, constant 
expression, or a combination of theseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"powerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any exact numeric, approximate numeric, or money 
column, variable, or constant expression, or a 
combination of these.REMAP="BO--Body"Each function also accepts arguments that can be implicitly converted to the specified type. For example, functions that accept approximate numeric types also accept integer types. SQL Server automatically converts the argument to the desired type.ID="IN43119485"ExpressionsNumbersnumbering in mathematical functions;Numbers:in mathematical function expressionsmathematical function expressionsREMAP="BO--Body"If a function takes more than one expression of the same type, the expressions are numbered (for example, approx_numeric1, approx_numeric2). ID="IN4349396"Listmathematical functionsREMAP="BO--Body"Following are the mathematical functions, their arguments, and the results they return:TOCENTRY="1"LBL="Table 2-8: "Mathematical functionsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="5*"COLNAME="C3" COLWIDTH="12*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ArgumentCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Result VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"abs COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the absolute value of a given 
expression. Results are of the same 
type and have the same precision 
and scale as the numeric expression. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"acos COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the angle (in radians) whose cosine 
is the specified value. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"asin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the angle (in radians) whose sine is 
the specified value. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"atan COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the angle (in radians) whose tangent 
is the specified value. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"atn2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric1, 
approx_numeric2)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the angle (in radians) whose tangent 
is (approx_numeric1/approx_numeric2).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ceiling COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the smallest integer greater than or 
equal to the specified value. Results are 
of the same type as the numeric 
expression. For numeric and decimal 
expressions, the results have a 
precision equal to that of the 
expression and a scale of 0.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"cos COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the cosine of the specified angle (in 
radians). COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"cot COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the cotangent of the specified angle 
(in radians). COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"degrees COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Converts radians to degrees. Results are 
of the same type as the numeric 
expression. For numeric and decimal 
expressions, the results have an 
internal precision of 77 and a scale 
equal to that of the expression. When 
money datatypes are used, internal 
conversion to float may cause loss of 
precision. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"exp COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the exponential value of the 
specified value. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"floor COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the largest integer less than or equal 
to the specified value. Results are of the 
same type as the numeric expression. 
For numeric and decimal expressions, the 
results have a precision equal to that 
of the expression and a scale of 0.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"log COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the natural logarithm of the 
specified value. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"log10 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the base 10 logarithm of the 
specified value. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"pi COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"()COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the constant value of 
3.1415926535897936. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"power COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(MOREINFO="NONE"numeric, power) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the value of numeric raised to 
the power power. Results are of the 
same type as numeric. For expressions 
of type numeric or decimal, the results 
have an internal precision of 77 and a 
scale equal to that of the expression. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"radians COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(MOREINFO="NONE"numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Converts degrees to radians. Results 
are of the same type as numeric. For 
expressions of type numeric or decimal, 
the results have an internal precision 
of 77 and a scale equal to that of the 
numeric expression. When money 
datatypes are used, internal 
conversion to float may cause loss of 
precision. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"rand COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"([MOREINFO="NONE"integer])COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a random float value between 
0 and 1, using the optional integer as a 
seed value. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"round COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(MOREINFO="NONE"numeric, integer)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Rounds the numeric so that it has integer significant digits. A positive integer 
determines the number of significant 
digits to the right of the decimal 
point; a negative integer, the number 
of significant digits to the left of the 
decimal point. Results are of the 
same type as the numeric expression 
and, for numeric and decimal 
expressions, have an internal 
precision of 77 and scale equal to that 
of the numeric expression.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sign COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(MOREINFO="NONE"numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the positive (+1), zero (0), or 
negative (-1). Results are of the same type, 
and have the same precision and scale, as the 
numeric expression. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(MOREINFO="NONE"approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the sine of the specified angle 
(measured in radians). COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sqrt COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(MOREINFO="NONE"approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the square root of the specified 
value. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"tan COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(MOREINFO="NONE"approx_numeric)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the tangent of the specified angle 
(measured in radians). ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"Statement                       MOREINFO="NONE"Result REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"select floor(123)             123FORMAT="LINESPECIFIC"select floor(123.45)          123 FORMAT="LINESPECIFIC"select floor(1.2345E2)        123.000000FORMAT="LINESPECIFIC"select floor(-123.45)         -124 FORMAT="LINESPECIFIC"select floor(-1.2345E2)       -124.000000FORMAT="LINESPECIFIC"select floor($123.45)         123.00 REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"select ceiling(123.45)        124 FORMAT="LINESPECIFIC"select ceiling(-123.45)       -123 FORMAT="LINESPECIFIC"select ceiling(1.2345E2)      124.000000FORMAT="LINESPECIFIC"select ceiling(-1.2345E2)     -123.000000FORMAT="LINESPECIFIC"select ceiling($123.45)       124.00 REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"select round(123.4545, 2)     123.4500 FORMAT="LINESPECIFIC"select round(123.45, -2)      100.00 FORMAT="LINESPECIFIC"select round(1.2345E2, 2)     123.450000FORMAT="LINESPECIFIC"select round(1.2345E2, -2)    100.000000REMAP="BO--Body"The MOREINFO="NONE"round function always returns a value. If integer is negative and exceeds the number of significant digits in numeric, SQL Server returns a result of zero. (This is expressed in the form 0.00, where the number of zeros to the right of the decimal point is equal to the scale of numeric.) For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select round(55.55, -3)REMAP="BO--Body"returns a value of 0.00.CommentsID="IN4369399"Errorstrapping mathematical;Range:errors in mathematical functionsMARK="BULL" REMAP="BU--Bullet"Error traps are provided to handle domain or range errors of these functions. Users can MOREINFO="NONE"set the MOREINFO="NONE"arithabort and MOREINFO="NONE"arithignoreID="IN431293910"Domain rulesmathematical functions errors in;Error handling:domain or range
ID="IN431693911"Aborting a query
 options to determine how domain errors are handled:ID="IN4322871512"arithabort option, setmathematical functions and arith_overflowMARK="DASH" REMAP="BS--BulletSub" ID="IN4322812113"arithabort option, setarith_overflow and
MOREINFO="NONE"arithabort arith_overflow specifies behavior following a divide-by-zero error or a loss of precision. The default setting,MOREINFO="NONE" arithabort arith_overflow on, rolls back the entire transaction or batch in which the error occurs. If you set MOREINFO="NONE"arithabort arith_overflow off, SQL Server aborts the statement that causes the error but continues to process other statements in the transaction or batch.ID="IN4322752714"arithabort option, setmathematical functions and numeric_truncation MOREINFO="NONE"arithabort numeric_truncation specifies behavior following a loss of scale by an exact numeric type during an implicit datatype conversion. (When an explicit conversion results in a loss of scale, the results are truncated without warning.) The default setting, MOREINFO="NONE"arithabort numeric_truncation on, aborts the statement that causes the error but continues to process other statements in the transaction or batch. If you set MOREINFO="NONE"arithabort numeric_truncation off, SQL Server truncates the query results and continues processing. ID="IN438752715"Messagesmathematical functions and
ID="IN4323693316"arithignore option, setmathematical functions and arith_overflowBy default, the MOREINFO="NONE"arithignore arith_overflow option is turned MOREINFO="NONE"off, causing SQL Server to display a warning message after any query that results in numeric overflow. Set the MOREINFO="NONE"arithignore option MOREINFO="NONE"on to ignore overflow errors.The MOREINFO="NONE"arithabort and MOREINFO="NONE"arithignore options have been redefined for Release 10.0. If you use these options in your applications, examine them to be sure they still produce the desired effects.ID="IN4326653717"rand mathematical functionrandThe MOREINFO="NONE"rand function uses the output of a 32-bit pseudo-random integer generator. The integer is divided by the maximum 32-bit integer to give a double value between 0.0 and 1.0. The MOREINFO="NONE"rand function is seeded randomly at server startup, so getting the same sequence of random numbers is unlikely, unless the user first initializes this function with a constant seed value. The MOREINFO="NONE"rand function is a global resource. Multiple users calling the MOREINFO="NONE"rand function progress along a single stream of pseudo-random values. If a repeatable series of random numbers is needed, the user must assure that the function is seeded with the same value initially and no other user calls MOREINFO="NONE"rand while the repeatable sequence is desired.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X64136"set
MOREINFO="NONE",Functions     LINKEND="X13154"Datatype Conversion Functions
, LINKEND="X22985"String Functions
, LINKEND="X29354"text and image Functions
ID="IN439584421"Functionsmathematical;List:mathematical functions;Built-in functions:mathematical;Mathematical functions
 REMAP="BO--Body"ID="X24911"Row Aggregate FunctionsID="IN43119663"Rows, tabledetail and summary results;Rows, table:row aggregates and
ID="IN4369664"Addingsummary rows
ID="IN4379665"ResultsResultsof row aggregate operationsrow aggregate operations
Generate summary values that appear as additional rows in the query results.FORMAT="LINESPECIFIC"Start of select MOREINFO="NONE"statement FORMAT="LINESPECIFIC"MOREINFO="NONE"compute MOREINFO="NONE"row_aggregateMOREINFO="NONE"(MOREINFO="NONE"column_nameMOREINFO="NONE")     [, MOREINFO="NONE"row_aggregate(MOREINFO="NONE"column_name)]... [by MOREINFO="NONE"column_name [, MOREINFO="NONE"column_name]...] Keywords and OptionsREMAP="RI--RefIndent"ID="IN43149668"Row aggregateslist of
row_aggregate - is one of the following: TOCENTRY="1"LBL="Table 2-9: "Row aggregate functionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="24*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"NameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sumCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Total of values in the (numeric) column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"avgCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Average of values in the (numeric) column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"minCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Lowest value in the column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"maxCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Highest value in the column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"countCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of non-null values in the column column_name ID="IN43119669"Column nameColumn namein parenthesesparentheses
ID="IN43796610"Columnsnumeric, and row aggregates;Numeric datatypes and row aggregates
- is the name of a column. It must be enclosed in parentheses. Only exact numeric, approximate numeric, and money columns can be used with MOREINFO="NONE"sum and MOREINFO="NONE"avg.REMAP="UN--Under"One MOREINFO="NONE"compute clause can apply the same function to several columns. When using more than one function, use more than one MOREINFO="NONE"compute clause. ID="IN432594811"by row aggregate subgroup
MOREINFO="NONE"by - indicates that row aggregate values are to be calculated for subgroups. Whenever the value of the MOREINFO="NONE"by item changes, row aggregate values are generated. If you use MOREINFO="NONE"by, you must use MOREINFO="NONE"order by. REMAP="UN--Under"Listing more than one item after MOREINFO="NONE"by breaks a group into sub-groups and applies a function at each level of grouping. ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"select type, price from titles where price > $10 and type like "%cook" order by type, price compute sum(price) by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC" type       price ---------- ---------- mod_cook        19.99            sum            ----------                 19.99  type      price ---------- ---------- trad_cook       11.95 trad_cook       14.99 trad_cook       20.95            sum            ----------                 47.89  (6 rows affected) REMAP="UN--Under"Calculates the sum of the price of each type of cookbook over $10. (See "LINKEND="X48334"compute Clause
" for more examples and information.) CommentsID="IN431994814"Aggregate functionsdifference from row aggregates;Row aggregates:difference from aggregate functionsMARK="BULL" REMAP="BU--Bullet"The row aggregates make it possible to retrieve detail and summary rows with one command. The aggregate functions, on the other hand, ordinarily produce a single value for all the selected rows in the table or for each group, and these summary values are shown as new columns. REMAP="UN--Under"The following examples illustrate the differences: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"select type, sum(price), sum(advance) from titles where type like "%cook" group by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"MOREINFO="NONE"type ----------  ----------  ---------------- mod_cook         22.98         15,000.00 trad_cook        47.89         19,000.00  (2 rows affected) REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"select type, price, advance from titles where type like "%cook" order by type compute sum(price), sum(advance) by type REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"MOREINFO="NONE"type        price       advance ----------  ----------  ---------------- mod_cook          2.99         15,000.00 mod_cook         19.99              0.00             sum         sum             ----------  ----------------                  22.98         15,000.00 type         price         advance ----------  ----------  ---------------- trad_cook        11.95          4,000.00 trad_cook        14.99          8,000.00 trad_cook        20.95          7,000.00             sum         sum             ----------  ----------------                  47.89         19,000.00 (7 rows affected) The columns in the MOREINFO="NONE"compute clause must appear in the select list. If the MOREINFO="NONE"ansinull option is set MOREINFO="NONE"off (the default), there is no warning when a row aggregate encounters a null. If MOREINFO="NONE"ansinull is set MOREINFO="NONE"on, a query returns the following SQLSTATE warning when a row aggregate encounters a null:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Warning- null value eliminated in set functionID="IN4319901215"select into commandnot allowed with computeYou cannot use MOREINFO="NONE"select MOREINFO="NONE"into in the same statement as a MOREINFO="NONE"compute clause because statements that include MOREINFO="NONE"compute generate tables that include the summary results, which are not stored in the database. ID="IN439901216"Variablessum or average integer data andWhen you sum or average integer data, SQL Server treats the result as an int value, even if the datatype of the column is smallint or tinyintID="IN4315901217"Overflow errorsDB-Library;DB-Library programs:overflow errors
. To avoid overflow errors in DB-Library programs, make all variable declarations for results of averages or sums type int. ID="IN4310901218"PrecedencePrecedenceof column order over order of aggregatescolumn order over order of aggregates
ID="IN435901219"Ordercolumns and row aggregatesIn a MOREINFO="NONE"select statement with a MOREINFO="NONE"compute clause, the order of columns in the select list overrides the order of the aggregates in the MOREINFO="NONE"compute clause. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select a, b, c from test compute sum(c), max(b), min(a) REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"a         b       c --------- ------- -------         1       2       3         3       2       1                  sum                  =======                        4           max           =======                 2 min =========         1 (3 rows affected) ID="IN4315901220"Overflow errorsDB-Library;DB-Library programs:overflow errorsREMAP="UN--Under"DB-Library programmers must be aware of this in order to put the aggregate results in the right place. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X48334"compute Clause
, LINKEND="X96182"group by and having Clauses
, LINKEND="X14000"order by Clause
, LINKEND="X35229"select
ID="IN4314881424"Row aggregates
ID="IN4311861625"Rows, tabledetail and summary results;Rows, table:row aggregates and
 Functions     LINKEND="X79130"Aggregate FunctionsREMAP="BO--Body"ID="X22985"String FunctionsID="IN431691113"Pattern matchingPattern matchingSee also patindex; String functions; Wildcard characters!see also
ID="IN43991114"ConstantsConstantsin string functionsstring functions
Operate on binary data, character strings, and expressions. String functions can be nested, and they can be used anywhere an expression is allowed. When you use constants with a string function, enclose them in single or double quotes. String function names are not keywords. FORMAT="LINESPECIFIC"REMAP="BO--Body"The string functions take the general form: FORMAT="LINESPECIFIC"function_name(arguments) 
ID="IN43885176"+ (plus)concatenation operator;Concatenation:using + string function;Plus (+):concatenation operator;Plus (+):string function
ID="IN43785177"Nestingstring functions
ID="IN43985178"Argumentsstring functionREMAP="BO--Body"The chart below lists the arguments used in string functions. If a function takes more than one argument of the same type, the arguments are numbered (for example, char_expr1, char_expr2).TOCENTRY="1"LBL="Table 2-10: "Arguments used in string functionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="28*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Argument 
TypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can Be Replaced ByVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char_expr COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A character-type column name, variable, or constant 
expression of char, varchar, nchar or nvarchar type. 
Functions that also accept text-type column names are 
noted in the explanation. Constant expressions must 
be enclosed in quotation marks. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"expressionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A binary or character column name, variable or 
constant expression. Can be char, varchar, nchar or 
nvarchar data (as for char_expr, above) plus binary or 
varbinary. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"patternCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A character expression (of char or varchar datatype) 
that may include any of the pattern-match wildcards 
supported by . Only the MOREINFO="NONE"patindex function 
accepts pattern (and therefore, wildcards).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"approx_numericCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any approximate numeric (float, real, or double 
precision) column name, variable, or constant 
expression.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"integer_exprCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any integer (tinyint, smallint or int) column name, 
variable, or constant expression. Maximum size 
ranges are noted, as they apply.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"startCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"An integer_expr.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lengthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"An integer_expr.REMAP="BO--Body"Each function also accepts arguments that can be implicitly converted to the specified type. For example, functions that accept approximate numeric expressions also accept integer expressions. SQL Server automatically converts the argument to the desired type.REMAP="BO--Body"The following table lists function names, arguments, and results.TOCENTRY="1"LBL="Table 2-11: "Function names, arguments, and resultsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="11*"COLNAME="C3" COLWIDTH="22*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ArgumentCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ResultVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ascii COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the ASCII code for the first 
character in the expression.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"char COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(integer_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Converts a single-byte integer value to a 
character value. (MOREINFO="NONE"char is usually used as 
the inverse of MOREINFO="NONE"ascii.) integer_expr must be 
between 0 and 255. Returns a char 
datatype. If the resulting value is the first 
byte of a multibyte character, the 
character may be undefined.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"charindex COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(expression1, 
expression2) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Searches expression2 for the first 
occurrence of expression1 and returns an 
integer representing its starting position. 
If expression1 is not found, returns 0. If 
expression1 contains wildcard characters, 
MOREINFO="NONE"charindex treats them as literals.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"char_length COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns an integer representing the 
number of characters in a character 
expression or text value. For variable-
length data, MOREINFO="NONE"char_length strips the 
expression of trailing blanks before 
counting the number of characters. For 
multi-byte character sets, the number of 
characters in the expression is usually less 
than the number of bytes; use MOREINFO="NONE"datalength 
(See "System Functions") to determine 
the number of bytes.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"difference COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr1, 
char_expr2) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns an integer representing the 
difference between two MOREINFO="NONE"soundex values. 
See MOREINFO="NONE"soundex, below.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"lower COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Converts upper to lower case, returning a 
character value.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ltrim COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes leading blanks from the 
character expression. Only values 
equivalent to the space character in the 
current character set are removed. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"patindex COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"("%pattern%", 
char_expr [, MOREINFO="NONE"using 
{MOREINFO="NONE"bytes | MOREINFO="NONE"chars | 
MOREINFO="NONE"characters} ] ) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns an integer representing the 
starting position of the first occurrence of 
pattern in the specified character 
expression, or a zero if pattern is not 
found. By default, MOREINFO="NONE"patindex returns the 
offset in characters; to return the offset in 
bytes (multibyte character strings), 
specify MOREINFO="NONE"using bytes. The `%' wildcard 
character must precede and follow pattern 
(except when searching for first or last 
characters). See "Wildcard 
Characters" for a description of the 
wildcard characters that can be used in 
pattern. Can be used on text data.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"replicate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr, 
integer_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a string with the same datatype 
as char_expr, containing the same 
expression repeated the specified number 
of times or as many times as will fit into a 
255 byte space, whichever is less.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"reverse COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the reverse of char_expr; if 
char_expr is "abcd", it returns "dcba".COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"right COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr, 
integer_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the part of the character 
expression starting the specified number 
of characters from the right. Return value 
has the same datatype as the character 
expression.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"rtrim COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes trailing blanks. Only values 
equivalent to the space character in the 
current character set are removed.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"soundex COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a four-character MOREINFO="NONE"soundex code for 
character strings that are composed of a 
contiguous sequence of valid single- or 
double-byte roman letters.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"space COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(integer_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a string with the indicated 
number of single-byte spaces.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"str COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(approx_numeric[, length [, decimal] ])COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a character representation of the 
floating point number. length sets the 
number of characters to be returned 
(including the decimal point, all digits to 
the right and left of the decimal point, and 
blanks); decimal sets the number of 
decimal digits to be returned. 

length and decimal are optional. If given, 
they must be non-negative. Default length 
is 10; default decimal is 0. MOREINFO="NONE"str() rounds the 
decimal portion of the number so that the 
results fit within the specified length.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"stuff COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr1, start, 
length, char_expr2)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Deletes length characters from char_expr1 
at start, then inserts char_expr2 into 
char_expr1 at start. To delete characters 
without inserting other characters, 
char_expr2 should be NULL (not "", which 
indicates a single space). COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"substring COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(expression, start, 
length)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns part of a character or binary 
string. start specifies the character 
position at which the substring begins. 
length specifies the number of characters 
in the substring.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"upper COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(char_expr) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Converts lower to upper case, returning a 
character value.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select au_lname, substring(au_fname, 1, 1) from authors REMAP="UN--Under"Displays the last name and first initial of each author, for example, Bennet A. select (au_lname + ",  "     + substring(au_fname, 1, 1) + ".") from authors REMAP="UN--Under"Displays the last name followed by a comma, and the first initial with a period of each author, for example, Bennet, A. select substring ((pub_id + title_id), 1, 6) from titles REMAP="UN--Under"Displays the first six characters of the concatenation of each pub_id and title_id. In other words, displays all four characters of the pub_id and the first two characters of the title_id. select charindex("wonderful", notes) from titles where title_id = "TC3218" REMAP="UN--Under"Returns the position at which the character expression "wonderful" begins in the notes column of titles. select au_id, patindex("%circus%", copy) from blurbsREMAP="UN--Under"Selects the author ID and the starting character position of the words "circus" in the MOREINFO="NONE"copy column. It returns "0" if the pattern is not found. MOREINFO="NONE"patindex can be used on all character data, including text data, and the "%" wildcard characters must be used unless searching for the first of last characters of a field.Below are some of the results of theMOREINFO="NONE"right,MOREINFO="NONE"str,andMOREINFO="NONE"stufffunctions:TOCENTRY="1"LBL="Table 2-12: "Results of the right, str, and stuff functionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatementCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Results VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select right("abcde", 3) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cde COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select right("abcde", 6) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"abcde COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select str(1234.7, 4) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1235 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select stuff("abc", 2, 1,"xyz") COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"axyzc CommentsMARK="BULL" REMAP="BU--Bullet"ID="IN4324831911"patindex string function
MOREINFO="NONE"patindex can be used on char, varchar nchar, nvarchar and text data. The other string functions can only be used on char, varchar, binary, and varbinary datatypes, plus those datatypes which convert implicitly to char or varchar. ID="IN437831912"Nestingstring functionsThe string functions can be nested. See examples 3 and 4. ID="IN4321831913"Quotation marks (" ")Constantsenclosing constant values;" " (quotation marks):enclosing constant values;Constants:in string functionsstring functionsWhen you use constants with the string functions, enclose them in single or double quotes. The string functions can be used in a select list, in a MOREINFO="NONE"where clause, and anywhere an expression is allowed. ID="IN4319812114"str string function
ID="IN4315792315"Decimal numbersstr function, representation ofLength and decimal arguments to MOREINFO="NONE"strID="IN438772516"Roundingstr string function and
ID="IN437772517"Numbersasterisks (**) for overlength;Asterisks (*):for overlength numbers
 (if supplied) must be positive. The default length is 10. The default decimal is 0. The length should be long enough to accommodate the decimal point and the number's sign. The decimal portion of the result is rounded to fit within the specified length. If the integer portion of the number does not fit within the length, however, MOREINFO="NONE"str returns a row of asterisks of the specified length. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select str(123.456, 2, 4) REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"-- ** (1 row affected) REMAP="UN--Under"A short approx_numer is right justified in the specified length, and a long approx_numer is truncated to the specified number of decimal places. ID="IN4321742818"stuff string functionThe MOREINFO="NONE"stuff function inserts a string into another string. It deletes a specified length of characters in expr1 at the start position. It then inserts expr2 string into expr1 string at the start position. ID="IN4332742819"Null string in character columnsREMAP="UN--Under"If the start position or the length is negative, a NULL string is returned. If the start position is longer than expr1, a NULL string is returned. If the length to delete is longer than expr1, expr1 is deleted through its last character. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select stuff("abc", 2, 3, "xyz")REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"---- axyz (1 row affected) REMAP="UN--Under"ID="IN4310703220"Charactersstuff function for deleting;Dropping:character with stuff function
To use MOREINFO="NONE"stuff to delete a character, replace expr2 with NULL, not with empty quotation marks. Using "`' to specify a null character replaces it with a space. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select stuff("abcdef", 2, 3, null)REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"go--- aef (1 row affected)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select stuff("abcdef", 2, 3, "")ID="IN4321673521"stuff string functionREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"---- a ef (1 row affected)ID="IN435673522"Namesfinding similar-sounding;Retrieving:similar-sounding words or names;Words, finding similar-sounding
ID="IN4323653723"soundex string functionThe MOREINFO="NONE"soundex function converts an alpha string to a four-digit code for use in locating similar-sounding words or names. All vowels are ignored unless they constitute the first letter of the string. For example, these two strings return the same value: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select soundex ("smith"), soundex ("smythe") REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"----- -----  S530  S530 ID="IN4310633924"Comparisondifference string function
ID="IN4326594325"difference string functiondifference string functionThe MOREINFO="NONE"difference function compares two strings and evaluates the similarity between them, returning a value from 0 to 4. 4 is the best match. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select difference("smithers", "smothers")REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"---------         4  (1 row affected)  REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select difference("smothers", "brothers")REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"---------         2  (1 row affected) ID="IN4336594326"Contiguous sequence of string valuesREMAP="UN--Under"The string values must be composed of a contiguous sequence of valid single- or double-byte roman letters.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands     LINKEND="X35229"select
ID="IN4316554730"String functionsstring;Built-in functions:string
 Functions     LINKEND="X13154"Datatype Conversion Functions
, LINKEND="X67592"Mathematical Functions
,LINKEND="X29354"text and image Functions
ID="IN4316515131"String functionsstring;Built-in functions:string
 REMAP="BO--Body"ID="X80972"System Functions
Return special information from the database. FORMAT="LINESPECIFIC"REMAP="BO--Body"System functions take the general form: FORMAT="LINESPECIFIC"function_name(arguments) 
ID="IN4399754"Argumentssystem functionREMAP="BO--Body"The chart below lists types of arguments usually preceded by MOREINFO="NONE"select.TOCENTRY="1"LBL="Table 2-13: "Arguments used in system functionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="28*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Argument 
TypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can Be Replaced ByVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"character_
expressionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A column name, variable, constant expression, or a 
combination of any of these that evaluates to a single 
value of type char or varchar.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column_idCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A numeric expression that is a column ID of a column. 
These are stored in the colid column of syscolumns.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"database_idCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A numeric expression that is the ID for a database. 
These are stored in the db_id column of sysdatabases.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"doampgCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The sysindexes pointer to the data pages' object 
allocation map.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"expressionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A column name, variable, constant expression, or a 
combination of any of these that evaluates to a single 
value. It can be of any datatype.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ioampgCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The sysindexes pointer to the index pages' object 
allocation map.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"object_id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A numeric expression that is an object ID for a table, 
view, or other database object. These are stored in the 
id column of sysobjects.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"object_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A character expression that is the name of a database 
object, such as a table, view, procedure, trigger, 
default, or rule. The name can be fully qualified (that 
is, it can include the database and owner name). It 
must be enclosed in quotes.ID="IN43319755"Literal character specificationquotes (" ");Literal values:in expressionsREMAP="BO--Body"Some character expression arguments, such as server_user_name, can include variables or literals, or concatenated literals, column names, and variables. All literals must be enclosed in quotation marks, as shown in the examples that follow the chart.REMAP="BO--Body"Function names, arguments, and results are listed in the following table. Where the argument is optional, the function returns the current value. TOCENTRY="1"LBL="Table 2-14: "System functions, arguments, and resultsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="10*"COLNAME="C2" COLWIDTH="13*"COLNAME="C3" COLWIDTH="17*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ArgumentCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Result VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"col_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(object_idMOREINFO="NONE"MOREINFO="NONE", column_id[, database_id])COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the column name. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"col_length COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(object_nameMOREINFO="NONE"MOREINFO="NONE", 
column_name)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the defined length of 
column. Use MOREINFO="NONE"datalength to see the 
actual data size.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"curunreservedpgs COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(database_id, 
page_number, 
free_pages)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the number of free 
pages in the disk piece that 
contains page_number. Use 
free_pages to specify a default 
value to be returned by the 
function. If the database is open, 
MOREINFO="NONE"curunreservedpgs replaces this 
value with the actual number of 
free pages stored in memory for 
that disk piece. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"data_pgs COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(object_idMOREINFO="NONE"MOREINFO="NONE", {doampgMOREINFO="NONE"MOREINFO="NONE" 
| ioampgMOREINFO="NONE"MOREINFO="NONE"})COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the number of pages 
used by table (doampg) or index 
(ioampg). The result does not 
include pages used for internal 
structures.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"datalength COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(expression)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the length of 
MOREINFO="NONE"expression in bytes. 
expression is usually a column 
name. If expression is a character 
constant, it must be enclosed in 
quotes.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"db_id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"([database_name]) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the database 
ID number. database_name must 
be a character expression; if it is 
a constant expression, it must be 
enclosed in quotes. If no 
database_name is supplied, MOREINFO="NONE"db_id 
returns the ID number of the 
current database.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"db_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"([database_id])COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the database name. 
database_id must be a numeric 
expression. If no database_id is 
supplied, MOREINFO="NONE"db_name returns the 
name of the current database.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"host_id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"( )COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the host process ID of 
the client process (not the Server 
process).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"host_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"( )COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the current host 
computer name of the client 
process (not the Server process).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"index_col COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(object_nameMOREINFO="NONE"MOREINFO="NONE", 
index_idMOREINFO="NONE"MOREINFO="NONE", key_MOREINFO="NONE"MOREINFO="NONE"# [, 
user_id])COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the name of the indexed 
column; returns NULL if 
object_name is not a table or view 
name. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"isnull COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(expression1, 
expression2)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Substitutes the value specified 
in expression2 when expression1 evaluates to NULL.The 
datatypes of the expressions 
must convert implicitly, or you 
must use the MOREINFO="NONE"convert function.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"lct_admin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"({{ "MOREINFO="NONE"lastchance" | 
"MOREINFO="NONE"logfull" | "MOREINFO="NONE"unsuspend"} , 
database_id} | 
"MOREINFO="NONE"reserve", log_pages})COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Manages the log segment's last-
chance threshold.
MOREINFO="NONE"lastchance creates a last-chance 
threshold in the specified 
database. 
MOREINFO="NONE"logfull returns 1 if the last-chance 
threshold has been crossed in 
the specified database and 0 if it 
has not. MOREINFO="NONE"unsuspend awakens 
suspended tasks in the database 
and disables the last-chance 
threshold if that threshold has 
been crossed.
MOREINFO="NONE"reserve returns the number of 
free log pages required to 
successfully dump a 
transaction log of the specified 
size.   COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"object_id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(object_name) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the object ID. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"object_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(object_id[, database_id])COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the object name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"proc_role COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"("MOREINFO="NONE"sa_role" |"MOREINFO="NONE"sso_role" | 
"MOREINFO="NONE"oper_role")COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Checks to see if the invoking 
user possesses the correct role to 
execute the procedure. Returns 
1 if the invoker has the required 
role. Otherwise, returns 0.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"reserved_pgs COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"(object_idMOREINFO="NONE"MOREINFO="NONE", 
{doampg|ioampg})COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the number of pages 
allocated to table or index. This 
function does report pages used 
for internal structures.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"rowcnt COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(doampg)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the number of rows in a 
table (estimate). COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"show_role COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"( )COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the user's current active 
roles, if any (MOREINFO="NONE"sa_role, sso_role, or 
MOREINFO="NONE"oper_role). If the user has no 
roles, returns NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"suser_id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"([server_user_name])COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the server user's ID 
number from syslogins. If no 
server_user_name is supplied, it 
returns the server ID of the 
current user.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"suser_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"([server_user_id])COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the server user's name. 
Server user's ID's are stored in 
syslogins. If no server_user_id is 
supplied, it returns the name of 
the current user.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"used_pgs COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"(object_idMOREINFO="NONE"MOREINFO="NONE", doampgMOREINFO="NONE"MOREINFO="NONE", 
ioampg)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the total number of 
pages used by a table and its 
clustered index. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"tsequal COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(timestamp, timestamp2) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compares timestamp values to 
prevent update on a row that 
has been modified since it was 
selected for browsing. 
timestamp is the timestamp of 
the browsed row; timestamp2 is 
the timestamp of the stored row. 
Allows you to use browse mode 
without calling DB-Library. 
(See "Browse Mode.")COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"user COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the user's name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"user_id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"([user_name]) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the user's ID number. 
Reports the number from 
sysusers in the current database. 
If no user_name is supplied, it 
returns the ID of the current 
user.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"user_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"([user_id]) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the user's name, based 
on the user's ID in the current 
database. If no user_id is 
supplied, it returns the name of 
the current user.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"valid_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(character_expression) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns 0 if string is not a valid 
identifier (illegal characters or 
string is more than 30 bytes 
long), a nonzero number if 
MOREINFO="NONE"string is a valid identifier. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"valid_userCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(server_user_id)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns 1 if the specified ID is a 
valid user or alias in at least one 
database on this .  
You must have the MOREINFO="NONE"sa_role or 
MOREINFO="NONE"sso_role role to use this function 
on a server_user_id other than 
your own.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select user_id("harold")REMAP="UN--Under"Returns Harold's ID, 13.select user_name(13) REMAP="UN--Under"Returns the login name for user 13, which is harold.select db_name()REMAP="UN--Under"Returns the name of the current database.select avg(isnull(price,$10.00)) from titlesREMAP="UN--Under"Finds the average of the prices of all titles, substituting the value $10.00 for all NULL entries in price. select isnull(price,0) from titles REMAP="UN--Under"Returns all rows from titles, replacing null values in price with "0". select x = col_length("titles", "title") REMAP="UN--Under"Finds the length of the title column in the titles table. The "x" is included to give a column heading to the result. select Length = datalength(pub_name) from publishers REMAP="UN--Under"Finds the length of the pub_name column in the publishers table. select name from sysusers where name = user_name(1) REMAP="UN--Under"Finds all rows in sysusers where the name is equal to the result of applying the system function MOREINFO="NONE"user_name to user ID #1. select object_id("pubs2." + user_name() + ".mytab")REMAP="UN--Under"Finds the object ID for the table mytab owned by the current user.select sysobjects.name,Pages = data_pgs(sysindexes.id, doampg)from sysindexes, sysobjectswhere sysindexes.id = sysobjects.id    and sysindexes.id > 100    and (indid = 1 or indid = 0)REMAP="UN--Under"Estimates the number of data pages used by user tables (which have objects IDs greater than 100). An indid of 0 indicates a table without a clustered index; an indid of 1 indicates a table with a clustered index. This query does not return rows for any nonclustered indexes or include the size of text chains (which have indid = 255). To see this information, use ioampg in the MOREINFO="NONE"data_pgs function, and indid > 1 in the MOREINFO="NONE"where clause. select show_role()REMAP="UN--Under"Returns a list of your current active roles.select proc_role("sso_role")REMAP="UN--Under"Checks to see whether the user has the role of System Security Officer. Returns "1" if so, otherwise "0".CommentsID="IN4399758"Argumentssystem functionMARK="BULL" REMAP="BU--Bullet"All system functions except MOREINFO="NONE"user require parentheses. When the argument to a system function is optional, the current database, host computer, server user, or database user is assumed.The system functions can be used in a MOREINFO="NONE"select list, in a MOREINFO="NONE"where clause, and anywhere an expression is allowed. ID="IN43189759"Ò saÓ  loginsa loginserver user IDs andserver user IDs and
ID="IN431597510"Database Ownersuser ID number 1;User IDs:number 1, Database OwnerThe server user ID of the "sa" account is 1. When other users are granted the role of System Administrator, they retain their own server user IDs.ID="IN432397511"Server user name and IDnumber -1 guest accountServer user ID -1 is always reserved for a guest account. ID="IN43897512"User IDsnumber 1, Database OwnerThe user ID of the Database Owner is always 1. When a System Administrator uses a database, he or she becomes Database Owner, with user ID 1. If the user turns off his or her System Administrator role for a session, the user assumes his or her own database user ID. If the user has no database user ID in the current database, he or she cannot execute MOREINFO="NONE"set role "sa_role" off.ID="IN432595713"user_name system functionThe MOREINFO="NONE"user_name function returns the name of the current user if the argument is less than 0. ID="IN432693914"col_length system functionlength definition
MOREINFO="NONE"col_length finds the defined length of a column;ID="IN4326911115"datalength system function
MOREINFO="NONE" datalength finds the actual length of the data stored in each row.MOREINFO="NONE" datalength is useful on varchar, varbinary, text and image datatypes, since these datatypes can store variable lengths.MOREINFO="NONE" datalength of any NULL data returns NULL. For all other datatypes, MOREINFO="NONE"datalength reports their defined length. For text and image columns, MOREINFO="NONE"col_length returns 16, the length of the binary(16)ID="IN4317911116"Text page pointer
 pointer to the actual text page.ID="IN4324871517"data_pgs system functiondata_pgs system function
MOREINFO="NONE"data_pgsID="IN434871518"Sizeindexes
ID="IN434871519"Sizetables
 returns the number of pages used by a table or index; it does notID="IN4324831920"used_pgs system functionused_pgs system function
 include pages used for internal structures. MOREINFO="NONE"used_pgsID="IN4317831921"Clustered indexespages allocated to;Index pages:system functions
 returns the number of pages used by a table and its clustered index; it does include pages used for internal structures. ID="IN4316831922"Transaction logssize
ID="IN434831923"Sizetransaction logsTo check the size of the transaction log, the table syslogs, use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select reserved_pgs(id, doampg)UseID="IN4325792324"proc_role system functionproc_role system function
ID="IN4317792325"Stored procedureschecking for roles in
ID="IN4317792326"Stored proceduresgranting permission to roles on
MOREINFO="NONE" proc_role within a stored procedure to guarantee that only users with a specific role can execute it. While MOREINFO="NONE"grant execute can also restrict execute permission on a stored procedure, users without the required role can still be granted permission to execute it. Only MOREINFO="NONE"proc_role provides a fail-safe way to prevent inappropriate access to a particular stored procedure.ID="IN4337762627"Server restarts. See Restarts, Server
ID="IN4322732928"rowcnt system function
MOREINFO="NONE"rowcnt ID="IN4320713129"Number (quantity of)rows in rowcnt function;Rows, table:number of
ID="IN4316693330"Restarts, Serverrowcnt and;
estimates the number of rows, based on the average number of rows per page in a table, and the number of pages in the tablet. This value can vary unexpectedly when the server reboots and transactions have to be recovered. Correct values are restored by running MOREINFO="NONE"update statistics, dbcc checktable or MOREINFO="NONE"dbcc checkdb.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="219*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The MOREINFO="NONE"user function is compliant. All 
other system functions are 
Transact-SQL extensions.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The MOREINFO="NONE"user function is entry level 
compliant. All other system 
functions are Transact-SQL 
extensions.See AlsoCommands     LINKEND="X69087"grant
MOREINFO="NONE", LINKEND="X35229"selectID="X29354"text and image Functions
ID="IN43149572"image datatypefunctions
ID="IN43189393"Built-in functionstext functions;Built-in functions:image functions
ID="IN43149841"Text functions
Operate on text  and image data. Text and image built-in function names are not keywords. Use the MOREINFO="NONE"set MOREINFO="NONE"textsize option to limit the amount of text or image data that a MOREINFO="NONE"select statement retrieves. FORMAT="LINESPECIFIC"REMAP="BO--Body"Text and image functions take the general form: FORMAT="LINESPECIFIC"function_name(argument) REMAP="BO--Body"Function names, arguments, and results are listed in the following table. A pattern is an alphanumeric MOREINFO="NONE"expression of char, varchar, binary or varbinary type used for pattern matching.  PGWIDE=1 TOCENTRY="1"LBL="Table 2-15: "text and image functions, arguments, and resultsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="14*"COLNAME="C3" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FunctionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ArgumentCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ResultVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"patindex COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"("%pattern%", char_expr 
 [, MOREINFO="NONE"using {MOREINFO="NONE"bytes | MOREINFO="NONE"chars | 
MOREINFO="NONE"characters} ] )COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns an integer value representing the 
starting position of the first occurrence of 
pattern in the specified character expression, or 
zero if pattern is not found. By default, MOREINFO="NONE"patindex 
returns the offset in characters; to return the 
offset in bytes for multibyte character strings, 
specify MOREINFO="NONE"using bytes. The % wildcard character 
must precede and follow pattern, except when 
searching for first or last characters. See 
"Wildcard Characters" for a description of the 
wildcard characters that can be used in pattern.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"textptrCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(text_columname) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the text pointer value, a 16-byte binary 
value. The text pointer is checked to ensure that 
it points to the first text page.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"textvalidCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"("table_name.col_name", 
textpointer)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Checks if a given text pointer is valid. Note that 
the identifier for a text or image column must 
include the table name. Returns 1 if the 
pointer is valid, or 0  if the pointer is invalid. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"declare @val varbinary(16) select @val = textptr(blurb) from texttest where title_id = "BU7832" readtext texttest.blurb @val 1 5 REMAP="UN--Under"This example uses the MOREINFO="NONE"textptr function to locate the text column, blurb, associated with title_id BU7832 in table texttest. The text pointer is put into a local variable @val and supplied as a parameter to the MOREINFO="NONE"readtext command, which returns 5 bytes starting at the second byte (offset of 1). select title_id, textptr(blurb) from texttest REMAP="UN--Under"Selects the title_id column and the 16-byte text pointer of the blurb column from the texttest table. select textvalid ("texttest.blurb", textptr(blurb)) from texttest REMAP="UN--Under"Reports whether a valid text pointer exists for each value in the blurb column of the texttest table. CommentsID="IN43199398"Text pointer valuesMARK="BULL" REMAP="BU--Bullet"If a text or image  column has not been initialized by a non-null MOREINFO="NONE"insert or by any MOREINFO="NONE"update statement, textptr returns a NULLID="IN433089139"Pointers, text or image column
 pointer. Use MOREINFO="NONE"textvalid to check whether a text pointer exists. You cannot use MOREINFO="NONE"writetext or MOREINFO="NONE"readtext without a valid text pointer. Use the MOREINFO="NONE"datalength function to get the length of data in text and image columns. See "LINKEND="X80972"System Functions
" for details. The MOREINFO="NONE"patindex function returns the character position of a given character string in text columns.  See also "LINKEND="X22985"String Functions
." ID="IN4312851710"Restrictionstext and image columns
text and image columns cannot be used: MARK="DASH" REMAP="BS--BulletSub"As parameters to stored procedures. As values passed to stored procedures.As local variables.In MOREINFO="NONE"order by, MOREINFO="NONE"compute, and MOREINFO="NONE"group by clauses.In an index.In a MOREINFO="NONE"where clause, except with the keyword MOREINFO="NONE"like. In joins.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionSee AlsoCommands      LINKEND="X28630"readtext
MOREINFO="NONE", LINKEND="X64136"set
MOREINFO="NONE", LINKEND="X97484"writetextFunctions     LINKEND="X13154"Datatype Conversion Functions
, LINKEND="X67592"Mathematical Functions
, LINKEND="X22985"String Functions
, LINKEND="X80972"System FunctionsTopics      LINKEND="X39672"text and image Datatypes
ID="IN4314831914"Text functions
ID="IN4314802215"image datatypefunctions
ID="IN4318782416"Built-in functionstext functions;Built-in functions:image functionsREMAP="BO--Body"NUMBER="3" ID="X56620"Transact-SQL TopicsID="IN3219921"Reference informationTransact-SQL topicsREMAP="BO--Body"This chapter presents general Transact-SQL reference information arranged alphabetically, by topic. Each topic describes the commands, system procedures, and functions that provide a particular type of functionality. LINKEND="X97311"Table 3-1: Transact-SQL topics
ID="IN3419832"Topics list, Transact-SQL reference pages
 lists the topics discussed in this chapter.PGWIDE=1 TOCENTRY="1"LBL="Table 3-1: " ID="X97311"Transact-SQL topicsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="16*"COLNAME="C2" COLWIDTH="29*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TopicCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AuditingCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Records security-related system activity in an audit trail 
that can be used to detect penetration of the system and 
misuse of system resources.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Batch QueriesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Combine a set of SQL statements that are submitted 
together and executed as a group, one after the other. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Browse ModeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allows front end applications using Open Client and a 
host programming language to perform updates while 
viewing data. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Attach comments to SQL statements, statement blocks, 
and system procedures.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Control-of-Flow LanguageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Controls the flow of execution of SQL statements, 
statement blocks, and stored procedures.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CursorsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Provide access to the set of rows returned by a SQL 
query. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Specify the type of information, size, and storage format 
of columns, stored procedure parameters, and local 
variables. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Disk MirroringCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates a software mirror of a user database device, the 
master device, or a database device used for user 
database transaction logs.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ExpressionsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Combine constants, literals, functions, column 
identifiers, variables, and operators. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"IdentifiersCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name database objects such as databases, tables, views, 
columns, indexes, triggers, procedures, defaults, rules, 
and cursors.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"IDENTITY ColumnsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Uniquely identify each row within a table. Each time 
you insert a row into the table,  automatically 
provides a unique, sequential value for the IDENTITY 
column.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"JoinsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compare two or more tables (or views) by specifying a 
column from each, comparing the values in those 
columns row by row, and concatenating rows that have 
matching values.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Login ManagementCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Verifies the identities of SQL Server users and 
administers SQL Server login accounts.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Null ValuesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Marks columns having an unknown value (as opposed 
to those that have 0 or blank as a value). COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ParametersCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Are arguments to a stored procedure.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RolesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Provide greater individual accountability for users 
performing system administration and security-related 
tasks on .COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Search ConditionsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Set the conditions in a MOREINFO="NONE"where or MOREINFO="NONE"having clause. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SubqueriesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Nest a MOREINFO="NONE"select statement inside a MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"update, or 
MOREINFO="NONE"delete statement, another subquery, or anywhere an 
expression is allowed (if it returns a single value). COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Temporary TablesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Store data in tempdb for the duration of the current 
session. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"text and image DatatypesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Store up to 2,147,483,647 ( 231 - 1) bytes of printable 
characters (text) or Sybase binary data (image) in a linked 
list of data pages that are external to the table. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TransactionsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Group SQL statements so that they are treated as a unit: 
either all statements in the group are executed, or no 
statements in the group are executed.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Variables (Local and Global)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Assume values assigned by a MOREINFO="NONE"declare statement (local 
variables) or supplied by  (global variables). COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Wildcard CharactersCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Represent one or more characters in a string. Wildcards 
are used with the keyword MOREINFO="NONE"like to find character and date 
strings that match a particular pattern.ID="IN3249383"patindex string functionpatindex string functionSee also Wildcard characters!see also Wildcard charactersID="X26589"AuditingID="IN43179753"System activitiesauditing
Record security-related system activity in an audit trail that can be used to detect penetration of the system and misuse of system resources.The Audit SystemREMAP="BO--Body"The audit system consists of the sybsecurity database and a set of stored procedures that allow you to selectively set the audit options you need.REMAP="BO--Body"You can choose to audit the following:ID="IN4369755"Loginsauditing;Auditing:logins
ID="IN43439486"Procedure calls. See Remote procedure calls
ID="IN43229487"Remote procedure callsauditing;Auditing:remote procedure calls
ID="IN4369488"Errorsauditing;Auditing:errorsMARK="BULL" REMAP="BU--Bullet"Within a server you can audit logins and logouts, server boots, RPC connections made from other servers, errors, and execution of commands requiring special roles.ID="IN4399489"Databasesauditing
ID="IN43894810"Auditingdatabases
ID="IN43894811"Commandsauditing;Auditing:commandsAt the database level, you can audit the use of the MOREINFO="NONE"grant, revoke, truncate table, and MOREINFO="NONE"drop commands within a database; the use of the MOREINFO="NONE"drop and MOREINFO="NONE"use commands on a database; and references to a specific database from within another database. ID="IN43594812"Usersauditing;Auditing:usersAt the user level, you can audit a specified user's attempts to access tables and views, and you can audit the text of commands submitted to the server by a user.At the object level, you can audit accesses to specified tables and views and execution of stored procedures and triggers.REMAP="BO--Body"Auditing is discussed in more detail in the System Administration Guide.The sybsecurity DatabaseID="IN438921015"Auditingsybsecurity database
ID="IN4320901216"sybsecurity databaseREMAP="BO--Body"The sybsecurity database consists of:ID="IN4315861617"sysaudits tablesysaudits tableMARK="BULL" REMAP="BU--Bullet"The sysaudits table, which is the audit trail. All audit records are written into sysaudits.ID="IN4321822018"sysauditoptions tablesysauditoptions tableThe sysauditoptions table, which contains one row for each global audit option.All of the other default system tables, derived from the model database.REMAP="BO--Body"See LINKEND="X56552"Appendix B,  "The System Tables,"
 for a description of each system table.Installing the Audit SystemREMAP="BO--Body"The audit system and sybsecurity database can be installed at any time using the MOREINFO="NONE"sybinit installation program. See the SQL Server Installation Guide for your platform for information.Setting Audit OptionsID="IN438822022"Auditingoptions, settingREMAP="BO--Body"System Security Officers can determine the type of auditing to be performed in the system. Auditing options are managed using the following system procedures:TOCENTRY="1"LBL="Table 3-2: " ID="X47262"System procedures used to manage auditing optionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="11*"COLNAME="C2" COLWIDTH="29*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"System ProcedureCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditoption COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enables and disables system-wide auditing and global 
audit optionsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditdatabase COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Establishes auditing of different types of events within a 
database, or of references to objects within that database 
from another databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditobject COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Establishes selective auditing of accesses to tables and 
viewsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditsproc COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits the execution of stored procedures and triggersCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditlogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits a user's attempts to access tables and views, or 
the text of commands that the user executesCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addauditrecord COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allows users to enter user-defined audit records 
(comments) into the audit trailThe Audit QueueID="IN4314822024"Records, auditREMAP="BO--Body"When an audited event occurs, an audit record first goes to the audit queue, where it waits until it can be added to the audit trail. You can configure the size of the audit queue with the MOREINFO="NONE"audit queue size option to MOREINFO="NONE"sp_configureID="IN438822025"Auditingqueue, size of
. The size of the audit queue is set according to your needs. See "audit queue size"
 in the System Administration Guide for information on how to configure the size of the audit queue and effects of different queue sizes.The Audit TrailREMAP="BO--Body"The audit trail is contained in the sybsecurity..sysaudits table. It is a special table in that the only operations allowed on it are MOREINFO="NONE"select and MOREINFO="NONE"truncate, and these operations can be performed only by System Security Officers. The columns of sysaudits are described in LINKEND="X56552"Appendix B,  "The System Tables."
 Procedures for archiving the audit trail are discussed in the System Administration Guide.PermissionsREMAP="BO--Body"Only System Security Officers can enable auditing and execute the system procedures to set audit options. The exception is MOREINFO="NONE"sp_addauditrecord, which can be run by any user who has been granted permission to execute it.See AlsoSystem procedures     LINKEND="X86229"sp_addauditrecord
MOREINFO="NONE", LINKEND="X27092"sp_auditdatabase
MOREINFO="NONE", LINKEND="X81262"sp_auditlogin
MOREINFO="NONE", LINKEND="X49123"sp_auditobject
MOREINFO="NONE", LINKEND="X42468"sp_auditoption
MOREINFO="NONE", LINKEND="X26489"sp_auditsproc
ID="IN4316802229"Batch processingqueriesID="X25196"Batch Queries 
A batch or batch file is a set of SQL statements submitted together and executed as a group, one after the other. A batch is terminated by an end-of-batch signal. With the MOREINFO="NONE"isql utility, this is the word "go" on a line by itself. 
ID="IN4421742932"go command terminatorgo command terminatorID="X55385"ExampleREMAP="BO--Body"Following is an example of a batch that contains two SQL statements:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select count(*) from titles select count(*) from authors go Submitting Batches to isql REMAP="BO--Body"You can submit batches to MOREINFO="NONE"isql either interactively or from an operating system file. A file submitted to MOREINFO="NONE"isql can include more than one batch of SQL statements if each batch is terminated by the word "go". For details on the MOREINFO="NONE"isql utility, see the SQL Server Utility ProgramsID="IN4416723136"Batch processinggo command
 for your platform..Referencing Database ObjectsREMAP="BO--Body"Before referencing objects in a database, you must issue a MOREINFO="NONE"use statement for that database. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"use master go select count(*) from sysdatabases goCreating Objects Within a BatchREMAP="BO--Body"Certain data definition statements cannot be combined with other statements within a batch. These include MOREINFO="NONE"create procedure, MOREINFO="NONE"create rule, MOREINFO="NONE"create default, MOREINFO="NONE"create trigger and MOREINFO="NONE"create view.REMAP="BO--Body"MOREINFO="NONE"create database, MOREINFO="NONE"create table, and MOREINFO="NONE"create index can be combined with other statements in a single batch. The following batch creates the table test, inserts a row into the table, and then retrieves the new row:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table test   (column1 char(10), column2 int) insert test   values ("hello", 598) select * from test go Dropping Objects Within a BatchREMAP="BO--Body"You cannot MOREINFO="NONE"drop an object and then reference or recreate it in the same batch. Applying Rules and Defaults Within a BatchID="IN445723141"Rulesbatch queries and
ID="IN448723142"DefaultsDefaultsin batch queriesbatch queriesREMAP="BO--Body"Rules and defaults cannot be bound to columns and used during the same batch. MOREINFO="NONE"sp_bindrule or MOREINFO="NONE"sp_bindefault cannot be in the same batch as MOREINFO="NONE"insert statements that invoke the rule or default. Setting Options in a BatchREMAP="BO--Body"Some options set with a MOREINFO="NONE"set statement do not take effect until the end of the batch. See "LINKEND="X64136"set
" for details. See AlsoCommands     LINKEND="X75308"create database
MOREINFO="NONE",LINKEND="X81463"create default
MOREINFO="NONE", LINKEND="X58868"create index
MOREINFO="NONE", LINKEND="X52197"create procedure
MOREINFO="NONE", LINKEND="X43186"create rule
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X19955"create trigger
MOREINFO="NONE", LINKEND="X30101"create view
MOREINFO="NONE", LINKEND="X64136"set
ID="IN4416703345"Batch processingqueries
ID="IN4411683546"Browse modeID="X19279"Browse ModeID="IN4539683648"Front-end applications, browse mode and
ID="IN458673749"Updatingwhile in browse mode
Browse mode supports the ability to perform updates while viewing data. It is used in front end applications using DB-Library and a host programming language. Browsing a TableREMAP="BO--Body"To browse a table in a front-end application, append the MOREINFO="NONE"for browse keywords to the end of the MOREINFO="NONE"select statement sent to SQL Server. A MOREINFO="NONE"for MOREINFO="NONE"browse clause cannot be used in statements involving the MOREINFO="NONE"unionID="IN457653951"Cursorsfor browse and;Browse mode:cursor declarations and
 operator or in cursor declarations. The use of the keyword MOREINFO="NONE"holdlock is forbidden in a MOREINFO="NONE"select statement that includes the MOREINFO="NONE"for MOREINFO="NONE"browse option. REMAP="BO--Body"For example: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"[Start of MOREINFO="NONE"select statement in an Open Client application]ID="IN4516614352"select statementfor browse
  for browseREMAP="BO--Body"[MOREINFO="NONE"for browse is the last clause in a MOREINFO="NONE"select statement. See select.]REMAP="SY--Syntax" FORMAT="LINESPECIFIC"[more application]ID="IN4518594553"timestamp datatypebrowse mode andREMAP="BO--Body"A table can be browsed in a front-end application if its rows have been timestamped. Timestamping a New Table for BrowsingREMAP="BO--Body"When creating a new table for browsing, include a column named timestamp in the table definition. The column is automatically assigned a datatype of timestamp; you do not have to specify its datatype. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table newtable(col1 int, timestamp,    col3 char(7)) REMAP="BO--Body"Whenever you insert or update a row, SQL Server timestamps it by automatically assigning a unique varbinary value to the timestamp column. Timestamping an Existing TableREMAP="BO--Body"To prepare an existing table for browsing, add a column named timestamp with MOREINFO="NONE"alter tableID="IN456574756"Addingtimestamp column
ID="IN4519535157"alter table commandadding timestamp column
. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"alter table oldtable add timestampREMAP="BO--Body"A timestamp column with a NULL value is added to each existing row. To generate a timestamp, update each existing row without specifying new column values. REMAP="BO--Body"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update oldtableset col1 = col1Comparing timestampID="IN4510515359"ComparisonComparisonof timestamp valuestimestamp values
 Values ID="IN4523495561"tsequal system functionREMAP="BO--Body"Use the MOREINFO="NONE"tsequal system function to compare timestamps when you are using browse mode in a front-end application. For example, the following statement updates a row in publishers that has been browsed. It compares the timestamp column in the browsed version of the row with the hexadecimal timestamp in the stored version. If the two timestamps are not equal, you receive an error message and the row is not updated.REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update publishersset city = "Springfield"where pub_id = "0736"and tsequal(timestamp,0x0001000000002ea8)Standards and ComplianceREMAP="BO--Body"MOREINFO="NONE"for browse is a Transact-SQL extension.See AlsoFunctions          LINKEND="X80972"System FunctionsTopics     LINKEND="X84316"DatatypesSystem procedures     LINKEND="X43109"sp_primarykey
ID="IN4511475764"Browse mode
ID="IN458465865"Updatingwhile in browse modeID="X31136"CommentsID="IN468446166"Commentscomment
Comments attach explanatory text to SQL statements, statement blocks, and system procedures. Comments are not executed.  A comment can be inserted on a line by itself or at the end of a command line. Two comment styles are available: the "slash-asterisk" style: FORMAT="LINESPECIFIC"/* text of comment (slash-asterisk style) */REMAP="BO--Body"and the "double-hyphen" style:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"-- text of comment (double-hyphen style)Slash-Asterisk Style CommentsID="IN4611446169"Conventionsmultiple-line comments;Multiple-line commentsREMAP="BO--Body"Multiple-line comments are allowed, as long as they are surrounded by "/*" and "*/". ID="IN4613446170"Asterisks (*)pairs surrounding commentsREMAP="BO--Body"A stylistic convention often used for multiple-line comments is to begin the first line with "/*" and subsequent lines with "**". The comment ends with "*/" as usual. ID="IN467446171"NestingcommentsREMAP="BO--Body"The "/*" form permits nesting.REMAP="BO--Body"Following are examples:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"/* this procedure finds rules by user name*/ create procedure findmyrule @nm varchar(30) = null as if @nm is null begin   print "You must give a user name"   return   print "I have returned" /* this statement follows return, ** so won't be executed */ end else      /* print the rule names and IDs, and           the user ID */   select sysobjects.name, sysobjects.id,     sysobjects.uid  from sysobjects, master..syslogins   where  master..syslogins.name = @nm   and sysobjects.uid = master..syslogins.suid   and sysobjects.type = "R" ID="IN4619436272"Hyphens as comments
ID="IN4627436273"-- (double hyphen) comments!-- (double hyphen) commentsDouble-Hyphen Style CommentsREMAP="BO--Body"This comment style begins with two consecutive hyphens followed by a space, and terminates with a newline character. Multiple-line comments are therefore not possible. REMAP="BO--Body"SQL Server will not interpret two consecutive hyphens within a string literal or within a "/*"-style comment as signalling the beginning of a comment.REMAP="BO--Body"To represent an expression containing two minuses in sequence (binary followed by unary), put a space or open parenthesis between the two hyphens.ID="IN4619426375"Hyphens as commentsREMAP="BO--Body"Following are examples:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"-- this procedure finds rules by user name create procedure findmyrule @nm varchar(30) = null as if @nm is null begin   print "You must give a user name"   return   print "I have returned" -- each line of a multiple-line comment -- must be marked separately.end else        -- print the rule names and IDs, and         -- the user ID   select sysobjects.name, sysobjects.id,     sysobjects.uid  from sysobjects, master..syslogins   where  master..syslogins.name = @nm   and sysobjects.uid = master..syslogins.suid   and sysobjects.type = "R" ID="IN468406576"CommentscommentStandards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="308*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The /* style comment is a 
Transact-SQL extension.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID="IN4624386779"Control-of-flow languageID="X12929"Control-of-Flow Language
Controls the order in which SQL statements, statement blocks, and stored procedures are executed.FORMAT="LINESPECIFIC"REMAP="BO--Body"LINKEND="X00031"Table 3-3
ID="IN4724386882"Control-of-flow languagekeywords table
ID="IN478386883"Keywordscontrol-of-flow
 gives the control-of-flow keywords and their functions: TOCENTRY="1"LBL="Table 3-3: " ID="X00031"Control-of-flow keywordsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="28*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"KeywordCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FunctionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"begin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Begins a statement block COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"end COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Ends a statement block COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"break COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Exits from MOREINFO="NONE"while loop COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"continue COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Restarts a MOREINFO="NONE"while loop COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"declare COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Declares local variables COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"goto  label COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Goes to a position in a statement block COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"if COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Defines conditional execution COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"else COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Defines alternate execution when MOREINFO="NONE"if condition is false COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"print COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Prints a user-defined message on the user's screen COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"raiserror COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Prints a user-defined message on the user's screen and 
set a system flag to record the fact than an error 
condition has occurredCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"return COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Exits unconditionally COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"waitfor COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sets delay for command execution COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"while COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Repeats performance of statements while condition is 
trueCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"/* comment MOREINFO="NONE"*/ or 
MOREINFO="NONE"--comment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Inserts a comment anywhere in a 
SQL statementStandards and ComplianceREMAP="BO--Body"Control-of-flow keywords are Transact-SQL extensions. See AlsoCommands     LINKEND="X55146"begin...end
MOREINFO="NONE", LINKEND="X41626"break
MOREINFO="NONE", LINKEND="X69990"continue
MOREINFO="NONE", LINKEND="X52197"create procedure
MOREINFO="NONE", LINKEND="X19955"create trigger
MOREINFO="NONE", LINKEND="X40303"declare
MOREINFO="NONE", LINKEND="X60287"goto Label
MOREINFO="NONE", LINKEND="X74736"if...else
MOREINFO="NONE", LINKEND="X69372"print
MOREINFO="NONE", LINKEND="X60573"raiserror
MOREINFO="NONE", LINKEND="X44808"return
MOREINFO="NONE", LINKEND="X56170"waitfor
MOREINFO="NONE", LINKEND="X37548"while
ID="IN4724367086"Control-of-flow languageTopics     LINKEND="X25196"Batch Queries
, LINKEND="X31136"Comments
, LINKEND="X72999"Parameters
, LINKEND="X44102"Variables (Local and Global)
)ID="IN477347287"CursorsID="X80039"CursorsID="IN4811337489"Rows, tablecursors
A cursor provides access to the set of rows returned by a SQL query. A cursor is a symbolic name that is associated with a MOREINFO="NONE"selectID="IN4817337490"Cursor result setcursors
 statement. Cursors enable you to access individual rows of data returned by SQL Server. Cursors consist of two parts: the cursor result set and the ID="IN487337491"Cursorsposition;Positioning cursors
cursor position.The cursor result set is the set of rows returned by the MOREINFO="NONE"select statement defined for a cursor. The cursor position is the current pointer to one row within the result set.Creating a CursorREMAP="BO--Body"To create a cursor, use the MOREINFO="NONE"declare cursor statement:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"   declare cursor_name cursorfor select_statement[for {read only | update [of column_name_list]}]REMAP="BO--Body"The cursor_name is the name of the cursor. It must be a valid SQL Server identifier (not longer than 30 characters and must start with a letter or the symbols # or _). REMAP="BO--Body"select_statement is the query that defines the cursor result set. See LINKEND="X35229"select
 for information about its options.ID="IN4817337493"Read-only cursorsREMAP="BO--Body"The ID="IN4836297894"for read only option, declare cursor
MOREINFO="NONE"for read only option specifies that the cursor result set cannot be updated. In contrast, the ID="IN4833258295"for update option, declare cursor
MOREINFO="NONE"for update option specifies that the cursor result set is updatable. You can specify ID="IN4825218696"of option, declare cursor
MOREINFO="NONE"of column_name_list after MOREINFO="NONE"for update with the list of columns from the select_statement defined as updatable.REMAP="BO--Body"The following example defines a result set for the authors_crsr cursor that contains all authors from the authors table who do not reside in California:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"declare authors_crsr cursorfor select au_id, au_lname, au_fnamefrom authorswhere state != 'CA'ID="IN489198897"Declaringcursors;Cursors:declaringREMAP="BO--Body"The MOREINFO="NONE"declare cursor statement must precede any MOREINFO="NONE"open statement for that cursor. You cannot include other statements with MOREINFO="NONE"declare cursor in the same Transact-SQL batch.Opening a CursorREMAP="BO--Body"To open the cursor:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"open cursor_nameFetching a RowREMAP="BO--Body"After opening the cursor, you can fetch a row:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"fetch cursor_name [into fetch_target_list]REMAP="BO--Body"SQL Server moves the cursor position one or more rows down the cursor result set. It retrieves the data from each row of the result set and stores the current position, allowing further fetches until it reaches the end of the result set.REMAP="BO--Body"ID="IN48121592100"into keyworddeclare cursor
MOREINFO="NONE"into fetch_target_list specifies that the column data returned should be placed into the specified variables. The fetch_target_list must consist of Transact-SQL parameters or local variables that have been previously declared.REMAP="BO--Body"For example, after declaring the @id, @lname, and @fname variables, you can fetch rows from the authors_crsr as follows:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"fetch authors_crsr into @id, @lname, @fnameREMAP="BO--Body"By default, the MOREINFO="NONE"fetch command only brings back one row at a time. You can use the MOREINFO="NONE"cursor rows option of the MOREINFO="NONE"set command to change the number of rows MOREINFO="NONE"fetch returns. However, this option does not affect a MOREINFO="NONE"fetch containing an MOREINFO="NONE"into clause.Closing a CursorREMAP="BO--Body"When you are finished with the result set of a cursor, you can MOREINFO="NONE"close it:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"close cursor_nameREMAP="BO--Body"Closing the cursor does not change its definition. You can MOREINFO="NONE"open the cursor again, and SQL Server creates a new cursor result set using the same query as before.Deallocating a CursorREMAP="BO--Body"If you want to discard the cursor, you must MOREINFO="NONE"deallocate it:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"deallocate cursor cursor_nameREMAP="BO--Body"Deallocating a cursor frees up any resources associated with the cursor, including the cursor name. You cannot reuse a cursor name until you deallocate it. If you deallocate an open cursor, SQL Server automatically closes it. Terminating a client connection to a server also closes and deallocates any open cursors.Example: Using a CursorREMAP="BO--Body"The following stored procedure checks the sales table to see if any books by a particular author have sold well. It uses a cursor to examine each row, and then prints out information. Without the cursor, it would need several MOREINFO="NONE"select statements to accomplish the same task.REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create procedure au_sales (@author_id id)as /* declare local variables used for fetch */declare @title_id tiddeclare @title varchar(80)declare @ytd_sales intdeclare @msg varchar(120) /* declare the cursor to get each book written    by given author */declare author_sales cursor forselect ta.title_id, t.title, t.total_salesfrom titleauthor ta, titles twhere ta.title_id = t.title_idand ta.au_id = @author_id open author_sales fetch author_sales        into @title_id, @title, @ytd_sales if (@@sqlstatus = 2)begin    print "We do not sell books by this author."    close author_sales    returnend /* if cursor result set is not empty, then process    each row of information */while (@@sqlstatus = 0)begin    if (@ytd_sales = NULL)    begin        select @msg = @title +            " had no sales this year."        print @msg    end    else if (@ytd_sales < 500)    begin        select @msg = @title +            " had poor sales this year."        print @msg    end    else if (@ytd_sales < 1000)    begin        select @msg = @title +            " had mediocre sales this year."        print @msg    end    else    begin        select @msg = @title +            " had good sales this year."        print @msg    end     fetch author_sales into @title_id, @title,    @ytd_salesend /* if error occurred, call a designated handler */if (@@sqlstatus = 1) exec error_handle close author_sales deallocate cursor author_sales returnTypes of CursorsID="IN4871592105"Cursorstypes ofREMAP="BO--Body"There are four kinds of cursors: Client cursors, Execute cursors, Server cursors, and Language cursors.ID="IN4861592106"Clientcursors;Cursors:clientMARK="BULL" REMAP="BU--Bullet"Client cursors are declared through Open Client calls (or Embedded SQL). The Open Client keeps track of the rows returned from SQL Server and buffers them for the application. Updates and deletes to the result set of Client cursors can only be done through the Open Client calls.ID="IN48151592107"Execute cursorsexecuteExecute cursors are a subset of Client cursors whose result set is defined by a stored procedure. The stored procedure can use parameters. The values of the parameters are sent through Open Client calls.ID="IN48141592108"Server cursorsserverServer cursors are declared inside a stored procedure. The client executing the stored procedure is not aware of the presence of these cursors. Results returned to the client for a MOREINFO="NONE"fetch appear exactly the same as the results from a normal MOREINFO="NONE"select.ID="IN48161592109"Language cursorslanguageLanguage cursors are declared in SQL without using Open Client. As with Server cursors, Open Client is completely unaware of the cursors and the results are sent back to the client in the same format as a normal MOREINFO="NONE"select.REMAP="BO--Body"Client cursors, through the use of applications using Open Client calls or Embedded-SQL, are the most frequently used form of cursors. However, to simplify the discussion of cursors, the examples in this manual show Language and Server cursors. For examples of using Client or Execute cursors, see your Open Client or Embedded-SQL documentation.Determining a Cursor's ScopeREMAP="BO--Body"A cursor is defined by itsID="IN48161592111"Scope of cursorsscope
 scope. The scope determines the region in which the cursor is known. Once a cursor's scope no longer exists, its cursor name also no longer exists. SQL Server divides the scope of a cursor into the following regions:MARK="BULL" REMAP="BU--Bullet"Session- this region starts when a client logs onto SQL Server and ends when it logs off. This region does not include any regions defined by stored procedures or triggers.Stored procedure- this region starts when a stored procedure begins execution and ends when it completes execution. If a stored procedure calls another stored procedure, SQL Server starts a new region and treats it as a subregion of the first procedure.Trigger- this region starts when a trigger begins execution and ends when it completes execution.ID="IN4871592112"CursorsregionsREMAP="BO--Body"A cursor name must be unique within a given scope. Scopes are distinct in that a cursor name defined in one region can also be defined in another or within its own subregion. However, you cannot access a cursor defined in one region from another region. SQL Server does allow access to a cursor in subregions if no other cursor with that same name exists in the subregion.REMAP="BO--Body"Name conflicts within a particular scope are only detected by SQL Server during runtime. REMAP="BO--Body"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create procedure proc1 as    declare @flag int    if (@flag)        declare names_crsr cursor        for select au_fname from authors    else        declare names_crsr cursor        for select au_lname from authorsREMAP="BO--Body"This stored procedure works because only one names_crsr cursor is defined in its scope.Cursor Result Set and Cursor ScansID="IN4871394114"Cursorsorder by andREMAP="BO--Body"Cursor result set rows may not reflect the values in the actual base table rows. For example, a cursor declared with an MOREINFO="NONE"order by clause usually requires the creation of an internal table to order the rows for the cursor result set. SQL Server does not lock the rows in the base table that correspond to the rows in the internal table, which permits other clients to update these base table rows. In that case, the rows returned to the client from the cursor result set would not be in sync with the base table rows.REMAP="BO--Body"A cursor result set is generated as the rows are returned through a MOREINFO="NONE"fetch of that cursor. This means that a cursor MOREINFO="NONE"select query is processed like a normal MOREINFO="NONE"select ID="IN4871394115"Cursorscursor scans;Scans, cursor
query. This process, known as a cursor scan, provides a faster turnaround time and eliminates the need to read rows the application does not require. ID="IN4871196116"Cursorsindexes;Indexes:cursors usingREMAP="BO--Body"SQL Server requires that cursor scans use a unique index of a table. However, you can still use cursors which reference tables without unique indexes, if none of those tables are updated by another process in the same page lock as that cursor. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"declare storinfo_crsr cursorfor select stor_id, stor_name, payterms    from stores    where state = 'CA'REMAP="BO--Body"The table stores specified with the above cursor does not have any indexes. SQL Server allows the declaration of cursors on tables without unique indexes, but any attempt to update these tables in the same page lock will close all cursors on such tables.ID="IN4877100117"Cursorsupdate and;Cursors:delete andUpdating or Deleting Rows Using CursorsID="IN4887100119"Updatingcursor rows;Dropping:cursor rows
ID="IN48145102120"update commandcursors andREMAP="BO--Body"You can update and delete rows with cursors using the MOREINFO="NONE"updateID="IN48143104121"delete commandcursors and
 or MOREINFO="NONE"delete statements, but you cannot insert new rows. You can update or delete rows for an updatable cursor. If the cursor is read-only, you can only read the data; you cannot update or delete it. By default, SQL Server attempts to determine if a cursor is updatable before designating it as read-only.Determining Whether a Cursor Is UpdatableREMAP="BO--Body"You can explicitly specify whether a cursor is updatable using the MOREINFO="NONE"read only or MOREINFO="NONE"update keywords in the MOREINFO="NONE"declare statement. For example, the following defines an updatable result set for the pubs_crsr cursor:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"declare pubs_crsr cursorfor select pub_name, city, statefrom publishersfor update of city, stateREMAP="BO--Body"This example includes all the rows from the publishers table, but it explicitly defines only the city and state columns for update.REMAP="BO--Body"If you do not explicitly specify MOREINFO="NONE"for read only or MOREINFO="NONE"for update, the cursor is implicitly updatable when the MOREINFO="NONE"select statement does not contain any of the following:MARK="BULL" REMAP="BU--Bullet"ID="IN48161106123"distinct keywordcursors and
MOREINFO="NONE"distinct optionID="IN4815-1108124"group by clausecursors and
MOREINFO="NONE"group by clauseID="IN4819-1108125"Aggregate functionscursors andAggregate functionsID="IN4814-3110126"union operatorcursors and
MOREINFO="NONE"union operatorREMAP="BO--Body"You cannot specify the MOREINFO="NONE"for update option if a cursor's select_statement contains one of the above constructs. SQL Server also defines a cursor as read-only if you declare a Language or Server type cursor that includes an MOREINFO="NONE"order by clause as part of its select_statement. SQL Server handles updates differently for Client or Executable type cursors, thereby eliminating this restriction.Determining Which Columns Can Be UpdatedREMAP="BO--Body"If you do not specify a column_name_list with the MOREINFO="NONE"for update option, all the specified columns in the query are updatable. SQL Server attempts to use unique indexes for updatable cursors when scanning the base table. For cursors, SQL Server considers an index containing an IDENTITY column to be unique, even if it is not declared so. REMAP="BO--Body"If you do not specify the MOREINFO="NONE"for update option, SQL Server uses any unique index, although it can also use other indexes or table scans if no unique index exists for the specified table columns. However, when you specify the MOREINFO="NONE"for update option, then SQL Server must use a unique index defined for one or more of the columns to scan the base table. If none exists, it returns an error.REMAP="BO--Body"For updatable cursors, SQL Server allows you to update columns that are not specified in the list of columns of the cursor's select_statement, but that are part of the tables specified in the select_statement. However, when you specify a column_name_list with MOREINFO="NONE"for update, you can only update those specific columns.REMAP="BO--Body"Any columns of the base table you specify in the column_name_list of MOREINFO="NONE"for update should include only those columns you need to update, and not any columns included in at least one unique index. This allows SQL Server to use that unique index for its cursor scan which helps prevent an update anomaly called the Halloween Problem.ID="IN4817-3110128"Halloween problemHalloween problemREMAP="BO--Body"This problem occurs when a client updates a column of a cursor result set row which defines the order in which the rows are returned from the base tables. For example, if SQL Server accesses a base table using an index and the index key is updated by the client, the updated index row can move within the index and be read again by the cursor. This is a result of an updatable cursor only logically creating a cursor result set. The cursor result set is actually the base tables that derive the cursor.ID="IN489-5112129"Declaringcursors;Cursors:declaring
ID="IN487-7114130"Cursorsindexes;Indexes:cursors usingREMAP="BO--Body"For information about how to update or delete
cursor rows, see the LINKEND="X54355"update or LINKEND="X45593"delete statements in this manual.Getting Information About CursorsREMAP="BO--Body"Two global variables provide information about cursor actions: ID="IN4827-9116132"@@sqlstatus global variablesqlstatus global variablecursors andcursors and;atatsqlstatus global variable:cursors and
@@sqlstatusID="IN4826-11118133"@@rowcount global variablerowcount global variablecursors andcursors and;atatrowcount global variable:cursors and
 and @@rowcount. MARK="BULL" REMAP="BU--Bullet"@@sqlstatus holds status information (warning exceptions) resulting from the execution of a MOREINFO="NONE"fetch statement. The value of @@sqlstatus is 0, 1, or 2. TOCENTRY="1"LBL="Table 3-4: "@@sqlstatus valuesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="35*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Successful completion of the MOREINFO="NONE"fetch statement.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The MOREINFO="NONE"fetch statement resulted in an error.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"There is no more data in the result set. This warning can occur if the 
current cursor position is on the last row in the result set and the 
client submits a MOREINFO="NONE"fetch statement for that cursor.REMAP="UN--Under"Only a MOREINFO="NONE"fetch statement can set @@sqlstatus. All other statements have no effect on @@sqlstatus.@@rowcount is the number of rows returned from the cursor result set to the client up to the last MOREINFO="NONE"fetch. In other words, it represents the total number of rows seen by the client at any one point in time. REMAP="UN--Under"Once all the rows are read from a cursor result set, @@rowcount represents the total number of rows in that result set. Each open cursor is associated with a specific @@rowcount variable. The variable is dropped when you close the cursor. Checking @@rowcount after a MOREINFO="NONE"fetch provides you with the number of rows read for the cursor specified in that MOREINFO="NONE"fetch.ID="IN4830-13120134"sp_cursorinfo system procedureREMAP="BO--Body"In addition to these to variables, SQL Server provides the system procedure MOREINFO="NONE"sp_cursorinfo, which displays information about the cursor name, its current status (such as open or closed), and its result columns. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_cursorinfo 0, authors_crsrREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Cursor name 'authors_crsr' is declared at nesting    level '0'.The cursor is not open.The cursor will remain open when a transaction is     commited or rolled back.The number of rows returned for each FETCH is 1.The cursor is updatable.There are 3 columns returned by this cursor.The result columns are:Name = 'au_id', Table = 'authors', Type = ID,    Length = 11 (updatable)Name = 'au_lname', Table = 'authors', Type =     VARCHAR, Length = 40 (updatable)Name = 'au_fname', Table = 'authors', Type =     VARCHAR, Length = 20 (updatable)REMAP="BO--Body"For more information about LINKEND="X95439"sp_cursorinfo, see Volume 2.ID="IN487-15122136"Cursorslocking;Locking and cursors
Cursors and LockingREMAP="BO--Body"Cursor locking methods are similar to the current locking methods for SQL Server. In general, statements that read data (such as MOREINFO="NONE"select or MOREINFO="NONE"readtext) use shared locks on each data page to avoid reading changed data from an uncommitted transaction. Update statements use exclusive locks on each page they change. To reduce deadlocks and improve concurrency, SQL Server often precedes an exclusive lock with an update lock, which indicates that the client intends to change data on the page. ID="IN487-15122138"Cursorsupdatable
ID="IN4812-15122139"Update locksUpdate locksin cursorscursorsREMAP="BO--Body"For updatable cursors, SQL Server uses update locks by default when scanning tables or views referenced with the MOREINFO="NONE"for update option of MOREINFO="NONE"declare cursor. If the MOREINFO="NONE"for update list is empty, all tables and views referenced in the MOREINFO="NONE"from clause of the select_statement receive update locks by default. REMAP="BO--Body"You can instruct SQL Server to use shared locks instead of update locks by adding the MOREINFO="NONE"shared keyword to that MOREINFO="NONE"from clause. Specifically, you should add MOREINFO="NONE"shared after each table name for which you prefer a shared lock.SQL Server releases an update lock when the cursor position moves off the data page. Since an application buffers rows for Client cursors, the corresponding Server cursor may be positioned on a different data row and page than the Client cursor. In this case, a second client could update the row that represents the current cursor position of the first client even if the first client used the MOREINFO="NONE"for update option.REMAP="BO--Body"Any exclusive locks acquired by a cursor in a transaction are held until the end of that transaction. This also applies to shared or update locks when using the MOREINFO="NONE"holdlock keyword or the MOREINFO="NONE"set isolation level 3 option. However, if you do not set the MOREINFO="NONE"close on endtran option, the cursor remains open past the end of the transaction, and its current page lock remains in effect. It could also continue to acquire locks as it fetches additional rows.REMAP="BO--Body"For more information about locking in SQL Server, see the System Administration Guide.Cursor Locking OptionsID="IN4816-19126140"holdlock keywordcursors and;shared keyword:cursors andREMAP="BO--Body"These are the effects of specifying the MOREINFO="NONE"holdlock or MOREINFO="NONE"shared options (of the MOREINFO="NONE"select statement) when defining an updatable cursor:MARK="BULL" REMAP="BU--Bullet"If you omit both options, you can read data on the currently fetched pages only. Other users cannot update your currently fetched pages, through a cursor or otherwise. Other users can declare a cursor on the same tables you use for your cursor, but they cannot get an update lock on your currently fetched pages.If you specify the MOREINFO="NONE"shared option, you can read data on the currently fetched pages only. Other users cannot update your currently fetched pages, through a cursor or otherwise.If you specify the MOREINFO="NONE"holdlock option, you can read data on all pages fetched (in a current transaction) or only the pages currently fetched (if not in a transaction). Other users cannot update your currently fetched pages or pages fetched in your current transaction, through a cursor or otherwise. Other users can declare a cursor on the same tables you use for your cursor, but they cannot get an update lock on your currently fetched pages or pages fetched in your current transaction.If you specify both options, you can read data on all pages fetched (in a current transaction) or only the pages currently fetched (if not in a transaction). Other users cannot update your currently fetched pages, through a cursor or otherwise. ID="IN4819-19126141"Locking and cursorslevelsCursor Isolation LevelsID="IN4816-19126142"Isolation levelscursor lockingREMAP="BO--Body"SQL Server provides two isolation levels for cursors:MARK="BULL" REMAP="BU--Bullet"Level 1 - SQL Server uses a shared or update lock on base table pages that contain a row representing a current cursor position. The page remains locked until the current cursor position moves off the page (as a result of MOREINFO="NONE"fetch statements). If an index is used to search the base table rows, it also applies shared or update locks to those corresponding index pages. This is the default locking behavior supported by SQL Server.Level 3 - SQL Server uses a shared or update lock on any base table pages which have been read in a transaction on behalf of the cursor. In addition, the locks are held until the transaction ends, as opposed to releasing the locks when the data page is no longer needed. The MOREINFO="NONE"holdlock keyword applies this locking level to the specified table or view.REMAP="BO--Body"For more information about using cursors with transactions or about isolation levels, see "LINKEND="X19352"Transactions
" in this chapter.ID="IN487-21128143"Cursorslocking;Locking and cursorsSee AlsoCommands     LINKEND="X78688"close
MOREINFO="NONE", MOREINFO="NONE"deallocate 
MOREINFO="NONE", LINKEND="X11816"declare cursor
MOREINFO="NONE", LINKEND="X45593"delete
MOREINFO="NONE", LINKEND="X18078"fetch
MOREINFO="NONE", LINKEND="X29776"open
MOREINFO="NONE", LINKEND="X64136"set
MOREINFO="NONE", LINKEND="X54355"updateSystem procedures     LINKEND="X95439"sp_cursorinfoREMAP="BO--Body"ID="X84316"DatatypesID="IN43269573"Column data. See Datatypes
ID="INA43990124"DatatypesDatatypesSee also User-defined datatypes; individual datatype names!see also
ID="IN433487155"Internal datatypes of null columnsInternal datatypes of null columnsSee also Datatypes!see also Datatypes
ID="IN433184186"System datatypes. See Datatypes
ID="IN432281217"User-defined datatypesUser-defined datatypesSee also Datatypes!see also Datatypes
Specify the type of information, size, and storage format of columns, stored procedure parameters, and local variables.ID="IN43981218"DatatypessystemSystem-Supplied DatatypesREMAP="BO--Body"SQL Server provides a number of system datatypes, and allows you to build user-defined datatypes based on these types. SQL Server also supplies two user-defined datatypes, timestamp and sysname.REMAP="BO--Body"The table below lists the system-supplied datatypes provided for various types of information, as well as the synonyms recognized by SQL Server. For simplicity, system datatypes are printed in lowercase characters, although SQL Server allows you to enter them in either upper- or lowercase. (timestamp and sysname, like all user-defined datatypes, are case sensitive.) Most SQL Server-supplied datatypes are not reserved words, and can be used to name other objects.PGWIDE=1 TOCENTRY="1"LBL="Table 3-5: "Range and storage size for SQL Server system datatypesCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="10*"COLNAME="C2" COLWIDTH="11*"COLNAME="C3" COLWIDTH="19*"COLNAME="C4" COLWIDTH="12*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Datatypes by 
CategoryCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SynonymsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RangeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bytes of StorageVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Exact numeric: integersCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint 

smallint 

int COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"



integer COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 to 255

215 -1 (32,767) to -215 (-32,768)

231 (2,147,483,647) to 
-231 (-2,147,483,648)COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1

2

4COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ExactMOREINFO="NONE" MOREINFO="NONE"numeric:MOREINFO="NONE" MOREINFO="NONE"decimals COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numeric (p, s)

decimal (p, s)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"

dec COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1038 -1 to -1038

1038 -1 to -1038COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2 to 17

2 to 17COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ApproximateMOREINFO="NONE" MOREINFO="NONE"numeric COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"float (precision)

double precision 

real COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"machine dependent

machine dependent

machine dependentCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4 or 8

8

4COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Money COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallmoney 

money COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"214,748.3647 to -214,748.3648 

922,337,203,685,477.5807 to
-922,337,203,685,477.5808 COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4

8COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Date/time COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smalldatetime 

datetime COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"January 1, 1900 to June 6, 2079
January 1, 1753 to December 31, 9999COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4

8COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Character COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(n)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"character COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"255 characters or lessCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(n)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"character varying, 
char varying COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"255 characters or lessCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"actual entry length COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nchar(n)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"national character, 
national char COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"255 characters or lessCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n * @@ncharsizeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nvarchar(n) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nchar varying, 
national char 
varying, national 
character varying COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"255 characters or lessCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"textCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"231 -1 (2,147,483,647) bytes or lessCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 or multiple of 2K 
(4K on Stratus)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Binary COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binary(n)

varbinary(n) 

image COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"255 bytes or less

255 bytes or less

231 -1 (2,147,483,647) bytes or lessCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n 

actual entry length

0 or multiple of 2K 
(4K on Stratus)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Bit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 or 1COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 (one byte holds up 
to 8 bit columns)
ID="IN437792310"ColumnsSize of columnssizes of (list);Size of columns:by datatypedatatype
ID="IN439782411"Datatypessummaries of
ID="IN439772512"Datatypesnumeric
ID="IN439723013"Datatypesexact numeric;Datatypes:integer;Integer data;Exact numeric datatypesExact Numeric Datatypes: IntegersREMAP="BO--Body"SQL Server provides three datatypes, tinyint, smallint, and intID="IN4321703216"Arithmetic operationsexact numeric datatypes and;Exact numeric datatypes:arithmetic operations and
, to store integers (whole numbers). These types are exact numeric types; they preserve their accuracy during arithmetic operations.REMAP="BO--Body"Choose among the integer types based on the expected size of the numbers to be stored. Internal storage size varies by type:TOCENTRY="1"LBL="Table 3-6: "Integer datatypesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="14*"COLNAME="C3" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StoresCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bytes of 
StorageVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Whole numbers between 0 and 255, inclusive. 
(Negative numbers are not permitted.) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Whole numbers between 215 -1 and -215 
(32,767 and -32,768), inclusive. COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Whole numbers between 231 - 1 and -231 
(2,147,483,647 and -2,147,483,648), inclusive. COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4ID="IN4312693317"Integer data
ID="IN4321673518"Arithmetic operationsexact numeric datatypes and;Exact numeric datatypes:arithmetic operations and
ID="IN439653719"Datatypesdecimal;Decimal dataExact Numeric Datatypes: Decimal NumbersREMAP="BO--Body"SQL Server provides two other exact numeric types, numeric and decimal, for numbers that include decimal points. Data stored in numeric and decimal columns is packed to conserve disk space, and preserves its accuracy to the least significant digit after arithmetic operations. The numeric and decimal types are identical in all respects but one: only numeric types with a scale of 0 can be used for the IDENTITY column. Decimal Precision and ScaleREMAP="BO--Body"The exact numeric types accept two optional parameters, precision and scale, enclosed within parentheses and separated by a comma:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"datatype [(precision [, scale])]REMAP="BO--Body"SQL Server treats each combination of precision and scale as a distinct datatype. For example, numeric (10,0) and numeric (5,0) are two separate datatypes. The precision and scale determine the range of values that can be stored in a decimal or numeric column:MARK="BULL" REMAP="BU--Bullet"The precision specifies the maximum number of decimal digits that can be stored in the column. It includes all digits, to the right and left of the decimal point. You can specify a precision 1 to 38 digits, or use the default precision of 18 digits.The scale specifies the maximum number of digits that can be stored to the right of the decimal point. Note that the scale must be less than or equal to the precision. You can specify a scale of 0 to 38 digits, or use the default scale of 0 digits.REMAP="BO--Body"Exact numeric types with a scale of 0 are displayed without a decimal point. If you enter a value that exceeds either the precision or scale for the column, SQL Server returns an error message.Storage SizeREMAP="BO--Body"The storage size for a numeric or decimalID="IN439643821"Datatypesinteger
ID="IN439604222"Datatypesdecimal;Decimal data;Exact numeric datatypes
ID="IN439594323"Datatypesexact numeric
 column depends on its precision. The minimum storage requirement is 2 bytes for a 1- or 2-digit column. Storage size increases by 1 byte for each additional 2 digits of precision, up to a maximum of 17 bytes.ID="IN4359564624"Floating point datatypes. See Approximate numeric datatypes
ID="IN439554725"Datatypesapproximate numeric;Approximate numeric datatypesApproximate Numeric Datatypes REMAP="BO--Body"SQL Server provides three approximate numeric types, float, double precision, and realID="IN4321554728"Arithmetic operationsapproximate numeric datatypes and;Approximate numeric datatypes:arithmetic operations and
, for numeric data that can tolerate rounding during arithmetic operations. The approximate numeric types are especially suited to data that covers a wide range of values. They support all aggregate functions and all arithmetic operations except modulo.Range, Precision, and Storage SizeREMAP="BO--Body"The real and double precision types are built on types supplied by the operating system. The float type accepts an optional binary precision in parentheses. float columns with a precision of 1-15 are stored as real; those with higher precision are stored as double precision. The range and storage precision for all three types is machine dependent.REMAP="BO--Body"The following table shows the range and storage size for each approximate numeric type. Note thatID="IN4320534929"isql utility commandapproximate numeric datatypes and
MOREINFO="NONE" isqlID="INA438534930"Roundingapproximate numeric values;Approximate numeric values, rounding
 displays only six significant digits after the decimal point and rounds the remainder:TOCENTRY="1"LBL="Table 3-7: "Approximate numeric datatypesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="13*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bytes of StorageVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"float[(default precision)]COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4 for default precision < 16
8 for default precision >= 16COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"double precision  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"real  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4 Entering Approximate Numeric DataREMAP="BO--Body"You enter approximate numeric data as a mantissa followed by an optional exponent:MARK="BULL" REMAP="BU--Bullet"The mantissa is a signed or unsigned number, with or without a decimal point. The column's binary precision determines the maximum number of binary digits allowed in the mantissa.ID="IN4324534931"e or E exponent datatypeThe exponent, which begins with the character "e" or "E", must be a whole number.REMAP="BO--Body"The value represented by the entry is the following product:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"mantissa * 10exponentREMAP="BO--Body"For example, 2.4E3 represents the value 2.4 times 103ID="IN439525032"Datatypesnumeric
, or 2,400.ID="IN4319525033"Character datatypescharacterCharacter DatatypesID="IN4326505235"Single-byte character setschar datatype forREMAP="BO--Body"The character types store strings consisting of letters, numbers, and symbols. Use the fixed-length type, ID="IN4313465636"char datatype
char(n), and the variable-length type,ID="IN4347435937"Variable-length character. See varchar datatype
 varchar(n)ID="IN4324416138"Multibyte character setsnchar datatype for
ID="IN4338386439"National Character. See nchar datatype
, for single-byte character sets such as English. Use the fixed-length type, nchar(n), and the variable-length type, nvarchar(n), for multibyte character sets such as Japanese. Use the text type (described in LINKEND="X39672""text and image Datatypes"
) for strings longer than 255 characters. Character literals are treated as variable- length types. REMAP="BO--Body"You can use the MOREINFO="NONE"likeID="IN437386440"Numbersconverting strings of
 keyword to search character strings for particular characters, and the built-in string functions to manipulate their contents. Strings consisting of numbers can be converted to exact and approximate numeric types with the MOREINFO="NONE"convert function, then used for arithmetic.ID="IN4310356741"TruncationTruncationSee also Padding, data!see also Padding, data
ID="IN4313327042"Padding, dataPadding, dataSee also Truncation!see also Truncation
ID="IN439297343"InsertingInsertingSee also Padding, data!see also Padding, data
ID="IN4320277544"Number of charactersin a column;Size of columns:characterLength and Storage SizeREMAP="BO--Body"Use n tID="IN4315267645"Size of columnsfixed-lengtho specify the length in characters for the fixed-length types, char(n)ID="IN4314228046"nchar datatype
 and nchar(n)ID="IN4313228047"Padding, datablanks and
ID="IN4310228048"Truncationcharacter datatypes
. Entries shorter than the assigned length are blank-padded; entries longer than the assigned length, truncated without warning unless the MOREINFO="NONE"string_rtruncation option to the MOREINFO="NONE"set command is set to MOREINFO="NONE"on. Fixed-length columns that allow nulls are internally converted to variable-length columns.REMAP="BO--Body"Use nID="IN4315218149"Size of columnsvariable-lengthID="IN4316198350"varchar datatypespaces inID="IN4316158751"varchar datatype to specify the maximum length in characters for the variable-length types, varchar(n)ID="IN4317119152"nvarchar datatype
ID="IN431799353"nvarchar datatypespaces in
 and nvarchar(n)ID="IN432769654"Embedded spaces. See Spaces
ID="IN43649855"BlanksSpaces, charactercharacter datatypes and;Character expressions, blanks or spaces in;Spaces, character:in character datatypescharacter datatypes
ID="IN4310110156"CharactersCharactersSee also Spaces, character!see also Spaces, character
. Data in variable-length columns is stripped of trailing blanks; storage size is the actual length of the data entered. Data in variable-length variables and parameters retains all trailing blanks, but is not padded to the full defined length. REMAP="BO--Body"Fixed-length columns tend to take more storage space than variable-length columns, but are accessed somewhat faster. The following table summarizes the storage requirements of the different character types: TOCENTRY="1"LBL="Table 3-8: "Character datatypesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="2*"COLNAME="C2" COLWIDTH="5*"COLNAME="C3" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StoresCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bytes of StorageVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(n) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fixed-length data, such as social 
security numbers or postal codes, in 
single-byte character sets.COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nchar(n) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Variable-length data, such as names, 
in single-byte character sets.COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n * @@ncharsizeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(n) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fixed-length data in multibyte 
character setsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Actual number of 
characters enteredCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nvarchar(n) COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Variable-length data in multibyte 
character setsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Actual number of 
characters * 
@@ncharsizeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"text COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Up to 2,147,483,647 bytes of printable 
characters on linked lists of data 
pages COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 when uninitialized; 
a multiple of 2K after 
initializationID="IN4315-110357"Size of columnsvariable-length;Size of columns:character
ID="IN4315-210458"Size of columnsfixed-length
ID="IN4320-310559"Number of charactersin a columnREMAP="BO--Body"Use the MOREINFO="NONE"char_length string function and MOREINFO="NONE"datalength system function to determine column length. MOREINFO="NONE"char_length returns the number of characters, stripping trailing blanks for variable-length types. MOREINFO="NONE"datalength returns the number of bytes.Entering Character DataREMAP="BO--Body"Character strings must be enclosed in single or double quotes. If you have set MOREINFO="NONE"quoted_identifier on, use single quotes for character strings or SQL Server treats them as identifiers.REMAP="BO--Body"Strings that include the double-quote character should be surrounded by single quotes. Strings that include the single-quote character should be surrounded by double quotes. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"'George said, "There must be a better way."' "Isn't there a better way?" ID="IN4315-310560"Doubling quotesDoubling quotesin character stringscharacter stringsREMAP="BO--Body"An alternative is to enter two quotation marks for each quotation mark you want to include in the string. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC""George said, ""There must be a better way."" 'Isn"t there a better way?' REMAP="BO--Body"To continue a character string onto the next line of your screen, enter a backslash (\) before going to the next line. Treatment of Blank SpacesREMAP="BO--Body"The following example creates a table, spaces, with both fixed- and variable-length character columns:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table spaces (cnot char(5) not null,     cnull char(5) null,      vnot varchar(5) not null,         vnull varchar(5) null,      explanation varchar(25) not null)   insert spaces values ("a", "b", "c", "d",     "pads char-not-null only") insert spaces values ("1    ", "2    ", "3    ",     "4    ", "truncates trailing blanks") insert spaces values ("    e", "    f", "    g",     "    h", "leading blanks, no change") insert spaces values ("   w ", "   x ", "   y ",    "   z ", "truncates trailing blanks") insert spaces values ("", "", "", "",     "empty string equals space" )   select "[" + cnot + "]",        "[" + cnull + "]",        "[" + vnot + "]",        "[" + vnull + "]",      explanation from spaces REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"                                   explanation               -------  -------  ------- ------- -------------------- [a    ]  [b]      [c]     [d]     pads char-not-null only  [1    ]  [2]      [3]     [4]     truncates trailing blanks [    e]  [    f]  [    g] [    h] leading blanks, no change [   w ]  [   x]   [   y]  [   z]  truncates trailing blanks   [     ]  [ ]      [ ]     [ ]     empty string equals space (5 rows affected)  ID="IN4311-310561"Null valuescolumn datatype conversion forREMAP="BO--Body"This example illustrates how the column's datatype and null type interact to determine how blank spaces are treated:ID="IN4315-310562"Not null valuesspaces inMARK="BULL" REMAP="BU--Bullet"Only char MOREINFO="NONE"not null and ncharMOREINFO="NONE" not null columns are padded to the full width of the column; char MOREINFO="NONE"null columns are treated like varchar and nchar MOREINFO="NONE"null columns are treated like nvarchar. ID="IN4317-610863"Spaces, characterSpaces, characterSee also Blanks!see also Blanks
ID="IN4351-911164"Preceding blanks. See Blanks; Spaces, characterPreceding blanks are not affected.ID="IN4327-1211465"Trailing blanks. See BlanksTrailing blanks are truncated except for char and nchar MOREINFO="NONE"not null columns. ID="IN4334-1511766"Single quotes. See Quotation marks
ID="IN4329-1511767"Empty string (" ") or (' ')Empty string (" ") or (' ')as a single spacesingle spaceThe empty string ("") is treated as a single space. In char and nchar MOREINFO="NONE"not nullID="IN436-1812068"BlanksBlanksSee also Spaces, character!see also Spaces, character
 columns, the result is a column-length field of spaces. ID="IN436-2012269"BlanksSpaces, charactercharacter datatypes and;Character expressions, blanks or spaces in;Spaces, character:in character datatypescharacter datatypes
ID="IN4316-2312570"Binary datatypesbinary
ID="IN4311-2612871"Zero x (0x)Zero x (0x)See also Binary datatypes; Hexadecimal numbers!see also Binary datatypes; Hexadecimal numbersBinary-Like Datatypes REMAP="BO--Body"The binary-like datatypes, binary(n), ID="IN4318-3013273"varbinary datatype
varbinary(n), and ID="IN4314-3213474"image datatype
imageID="IN4316-3213475"Binary
datatypesBinary datatypesÒ
0xÓ  prefix0x prefixID="IN439-3213476"Insertingleading zero automatic;Leading zeros, automatic insertion ofID="IN4310-3213477"CharactersCharactersÒ 0xÓ ;Ò 0xÓ [0x];Zero x (0x)0x, store raw binary data, such as pictures, in a hexadecimal-like notation. Binary data begins with the characters "0x" and can include any combination of digits and the uppercase and lowercase letters A through F. SQL Server manipulates the binary types in a platform-specific manner. For true hexadecimal data, use the hextoint and inttohex functions. For more information, see LINKEND="X13154""Datatype Conversion Functions"
.REMAP="BO--Body"Use the binary(n) and varbinary(n) datatypes to store data up to 255 bytes in length. Use n to specify the column length in bytes, or use the default length of one byte. Each byte stores two binary digits. If you enter a value longer than nID="IN4310-3213478"Truncationbinary datatypes
, SQL Server truncates the entry to the specified length without warning or error.MARK="BULL" REMAP="BU--Bullet"Use the fixed-length binary type, binary(n), for data in which all entries are expected to be approximately equal in length. Use the variable-length binary type, varbinary(n), for data that is expected to vary greatly in length. ID="IN4314-3613879"Speed (Server)Speed (Server)of binary and varbinary datatype accessbinary and varbinary datatype accessREMAP="BO--Body"Because entries in binary columns are zero-padded to the column length (n), they may require more storage space than those in varbinary columns, but are accessed somewhat faster.REMAP="BO--Body"Use the imageID="IN4315-3814080"Size of columnsimage datatype
 datatype to store larger blocks of binary data (up to 2,147,483,647 bytes) on external data pages. You cannot use the image datatype for variables, or for parameters in stored procedures. For more information, see the section "LINKEND="X39672"text and image Datatypes
".ID="IN4327-4114381"Trailing zeroes. See Zeroes
ID="IN436-4114382"Zeroesleading or trailing;Zeroes:padding or inserting
ID="IN436-4214483"Zeroestrailing, in binary datatypesTreatment of Trailing Zeroes in binary and varbinary Data ID="IN4316-4214484"Binary datatypestrailing zeroes in;Datatypes:trailing zeroes inREMAP="BO--Body"All binary MOREINFO="NONE"not nullID="IN4313-4214485"Padding, datawith zeroes
 columns are padded with zeros to the full width of the column. Trailing zeros are truncated in all varbinary data, and in binary MOREINFO="NONE"null columns since columns which accept null values must be treated as variable-length.REMAP="BO--Body"The following example creates a table with all four variations of binary and varbinary datatypes, NULL and NOT NULL. The same data is inserted in all four columns, and is padded or truncated according to the datatype of the column.REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table zeros (bnot binary(5) not null,            bnull binary(5) null,            vnot varbinary(5) not null,            vnull varbinary(5) null) insert zeros values (0x12345000, 0x12345000,             0x12345000, 0x12345000)insert zeros values (0x123, 0x123, 0x123, 0x123) select * from zerosREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"bnot             bnull        vnot        vnull    ------------     ---------    ----------  --------- 0x1234500000     0x123450     0x123450    0x123450 0x0123000000     0x0123       0x0123      0x0123 ID="IN437-4214486"Numbersodd or even binary
ID="IN4310-4214487"CharactersCharactersÒ 0xÓ ;Ò 0xÓ [0x];Zero x (0x)0xREMAP="BO--Body"When you input an odd number of characters preceded by 0x, the value is right justified and a 0 is inserted in the leftmost place. This happens because each byte of storage holds two binary digits, so all values stored must contain an even number of digits. When you enter an odd number of digits, SQL Server assumes you have omitted a leading 0. REMAP="BO--Body"Input values "0x00" or "0x0" are stored as "0x00" in variable-length binary columns (binary null, image and varbinary columns). In fixed-length binary (binary not null) columns, the value is padded with zeros to the full length of the field:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert zeros values (0x0, 0x0,0x0, 0x0) select * from zeros where bnot = 0x00REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"bnot           bnull       vnot        vnull        ----------     ------      -----       ------------0x0000000000   0x00        0x00        0x00  ID="IN4318-4614888"varbinary datatype
ID="IN436-4714989"Zeroestrailing, in binary datatypes
ID="IN4341-4714990"Platform dependence, binary datatypes andplatform dependence andPlatform DependenceREMAP="BO--Body"Because the exact form in which you enter a particular value depends upon the platform you are using, calculations involving binary data can produce different results on different machines. For platform-independent conversions between hexadecimal strings and integers, use the MOREINFO="NONE"inttohex and MOREINFO="NONE"hextoint functions rather than the platform-specific convert function. (See LINKEND="X13154""Datatype Conversion Functions"
ID="IN4316-5015291"Binary datatypesbinary
 for details.)ID="IN439-5115392"Datatypesmonetary;Monetary datatypesMoney Datatypes REMAP="BO--Body"The money datatypes, money and smallmoneyID="IN4318-5115395"Monetary datatypesarithmetic operations and;Arithmetic operations:monetary datatypes and
, store monetary data. You can use these types for US dollars and other decimal currencies, but SQL Server provides no means to convert from one currency to another. You can use all arithmetic operations except modulo, and all aggregate functions, with money and smallmoney data. ID="IN4336-5115396"Precision, datatype (monetary types)REMAP="BO--Body"Both money and smallmoneyID="IN438-5115397"Roundingmonetary values
ID="IN439-5115398", (comma), (comma)in monetary values;Comma (,):in monetary values[Comma (,):in monetary values]monetary values
 are accurate to one ten thousandth of a monetary unit, but they round values up to two decimal places for display purposes. The default print format places a comma after every three digits. ID="IN435-5115399"RangeRangeof monetary values allowedmonetary values allowedREMAP="BO--Body"The following table summarizes the range and storage requirements for money datatypes:TOCENTRY="1"LBL="Table 3-9: "Money datatypesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="4*"COLNAME="C2" COLWIDTH="13*"COLNAME="C3" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RangeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bytes of 
StorageVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"moneyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Monetary values between 
+922,337,203,685,477.5807 and
 -922,337,203,685,477.5808 COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallmoney COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Monetary values between 
+214,748.3647 and -214,748.3648 COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4ID="IN4315-51153100"Currency symbolREMAP="BO--Body"Monetary values entered with E notation are interpreted as float. This may cause an entry to be rejected or to lose some of its precision when it is stored as a money or smallmoney value. REMAP="BO--Body"money and smallmoneyID="IN4337-51153101"Negative (-) sign for monetary values!- (minus sign)for negative monetary valuesnegative monetary values
 values can be entered with or without a preceding currency symbol, such as a dollar sign ($). To enter a negative value, place the minus sign after the currency symbol. Do not include commas in your entry.ID="IN439-53155102"Datatypesdate and time
ID="IN435-55157103"Datesdatatypes;Time values:datatypesDate/Time Datatypes REMAP="BO--Body"Use the ID="IN4317-59161105"datetime datatype
datetimeID="IN4322-63165106"smalldatetime datatype
 and smalldatetimeID="IN435-63165107"RangeRangeof recognized datesrecognized dates
ID="IN4328-63165108"Twenty-first-century numbersearliest allowed
 datatypes to store date and time information from January 1, 1753 through December 31, 9999. Dates outside this range must be entered, stored, and manipulated as char or varchar values.ID="IN4315-65167109"Size of columnsdatetime datatypeMARK="BULL" REMAP="BU--Bullet"datetime columns hold dates between January 1, 1753 and December 31, 9999. datetime values are accurate to 1/300th of a second on platforms that support this level of granularity. Storage size is 8 bytes: 4 bytes for the number of days since the base date of January 1, 1900 and 4 bytes for the time of day.ID="IN4315-67169110"Size of columnssmalldatetime datatype
smalldatetime columns hold dates from January 1, 1900 to June 6, 2079, ID="IN4322-71173111"smalldatetime datatype
with accuracy to the minute. Storage size is 4 bytes: 2 bytes for the number of days after January 1, 1900, and 2 bytes for the number of minutes since midnight. ID="IN435-71173112"Datesdisplay formats;Display:format for datesDisplay FormatsID="IN438-71173113"Defaultsdate formatREMAP="BO--Body"The default display format for dates is "Mon dd yyyy hh:mmAM" (or PM); for example: "Apr 15 1988 10:23PM". Use the MOREINFO="NONE"convert function to display seconds and milliseconds, and to obtain additional date styles and date-part orderings by converting datetime data to char. Entry FormatsID="IN4310-71173114"Date partsenteringREMAP="BO--Body"Always enclose datetime and smalldatetimeID="IN4321-75177115"Quotation marks (" ")enclosing datetime values;" " (quotation marks):enclosing datetime values
 values in single or double quotes. If you have MOREINFO="NONE"set quoted_identifier on, use single quotes or SQL Server treats the data as an identifier.ID="IN435-75177116"Datesentry formats;Dates:recognition ofREMAP="BO--Body"SQL Server recognizes a wide variety of data entry formats for date and time values. The date portion and time portion of a datetimeID="IN438-75177117"Defaultsdate, Server
 values are discussed separately below. SQL Server recognizes the two portions of the data separately, so the time can precede or follow the date. Either portion can be omitted; SQL Server provides defaults, also described below. If both portions are omitted, the default date is January 1, 1900 12:00:00:000AM. MARK="BULL" REMAP="BU--Bullet"If you specify only the last two digits of the year, values less than 50 are interpreted as "20yy", and values of 50 or greater are interpreted as "19yy". A date cannot begin with only a two-digit year specified. If such a date is entered, SQL Server returns an error message stating that the datetime value is out of range.You must type the century only when the day is omitted, or when you need a century other than the default, as described above. When entering time data, the order of the components must be as follows:REMAP="UN--Under"hoursminutessecondsmillisecondsAM or amPM or pmREMAP="UN--Under"(12AM is midnight, 12PM is noon). To be recognized as time, a value must contain either a colon or an AM/PM signifier. ID="IN4318-75177118"Millisecond valuesinput and storage ofREMAP="UN--Under"Milliseconds can be preceded either with a colon or period. If preceded by a colon, the number means thousandths of a second. If preceded by a period, a single digit means tenths of a second, two digits mean hundredths of a second, and three digits mean thousandths of a second. For example, `12:30:20:1' means twenty and one-thousandth of a second past 12:30; `12:30:20.1' means twenty and one-tenth of a second past 12:30. REMAP="UN--Under"Among the acceptable formats for time data are: REMAP="UN--Under"MOREINFO="NONE"14:30 14:30[:20:999] 14:30[:20.9] 4am 4 PM [0]4[:30:20:500]AM If you omit the time portion of a datetime value, the default value, 12:00:00:000 AM, is supplied. SQL Server recognizes three basic styles of date input. Each of the date formats shown below must be enclosed in quotes, and may be preceded or followed by a time specification, as described above. ID="IN4312-75177119"Month valuesentering in alphabetic formatEntering the Month in Alphabetic Format REMAP="BO--Body"The month can be the full month name or the month abbreviations as given in the specification for the current language. Commas are optional. Case is ignored. If the day is missing, it defaults to the first day of the month. The MOREINFO="NONE"dateformat (see the LINKEND="X64136"set
 command) setting is not applied when you specify the month in alphabetic form. REMAP="BO--Body"Valid formats for specifying the date alphabetically are: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"Apr[il] [15][,] 1988 Apr[il] 15[,] [19]88 Apr[il] 1988 [15]  [15] Apr[il][,] 1988 15 Apr[il][,] [19]88 15 [19]88 apr[il] [15] 1988 apr[il]  1988 APR[IL] [15] 1988 [15] APR[IL] Entering the Month in Numeric FormatREMAP="BO--Body"You can enter the month in a string with slash (/), hyphen (-) or period (.) separators. The month, day, and year must be specified. The strings must be in the form: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"<MOREINFO="NONE"num> <sep> <num> <sep> <num> [<time spec>] REMAP="BO--Body"orMOREINFO="NONE":REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"[MOREINFO="NONE"MOREINFO="NONE"<time spec>MOREINFO="NONE"]MOREINFO="NONE"  MOREINFO="NONE"<num> <sep> <num> <sep> <num>REMAP="BO--Body"The default order for date part entry is mdyID="IN4317-79181120"datetime datatypeset dateformat
, when the language is set to us_english. Use the MOREINFO="NONE"set MOREINFO="NONE"dateformat command to change the order for dates. The MOREINFO="NONE"set MOREINFO="NONE"language command may also affect the expected order of date parts, depending on the definition for a particular language. ID="IN4317-83185121"datetime datatypedateformat settingREMAP="BO--Body"The interpretation of the values of the date parts depends on the MOREINFO="NONE"dateformat setting; if the ordering does not match the setting, either the values will not be interpreted as dates (because values are out of range) or the values will be misinterpreted. For example, "12/10/08" could be interpreted as one of six different dates, depending on the MOREINFO="NONE"dateformat setting. See the LINKEND="X64136"set
 command for more information. REMAP="BO--Body"To enter "April 15, 1988" in mdy MOREINFO="NONE"dateformat, you can use these formats: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"[0]4/15/[19]88[0]4-15-[19]88[0]4.15.[19]88REMAP="BO--Body"The other entry orders are shown below with "/" as separators; hyphens or periods can also be used: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"15/[0]4/[19]88  (dmy) 1988/[0]4/15  (ydm) 1988/15/[0]4  (ymd) [0]4/[19]88/15  (myd) 15/[19]88/[0]4  (dym) Entering the Date as an Unseparated StringREMAP="BO--Body"You can enter the date as a 4, 6 or 8 digit string, or an empty string, or enter the time value, but no date value. The MOREINFO="NONE"dateformat is not applied to all-numeric date entries. 6 or 8 digit strings are always interpreted as year-month-day. The month and day must always be two digits. This format is recognized: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"[19]880415 REMAP="BO--Body"If 4 digits are given, the string is interpreted as the year, and the month is set to January, the day to the first of the month. The century cannot be omitted. ID="IN439-83185122"Base dateREMAP="BO--Body"An empty string ("") or missing date is interpreted as the base date, January 1, 1900. A time value without a date, for example, "4:33" is interpreted as "January 1, 1900 4:33AM". REMAP="BO--Body"You can do some arithmetic calculations on datetime values with the built-in date functions. (See "LINKEND="X69388"Date Functions
ID="IN4317-87189123"datetime datatype
.")ID="IN435-89191124"Dateslike and;Dates:searching for
ID="IN4317-93195125"datetime datatypelike and
ID="IN4312-95197126"like keywordsearching for dates withPattern Matching with the like KeywordID="IN4317-97199127"Search conditionsdatetime dataREMAP="BO--Body"If you use the equality operator (=) to search datetime values for a particular month, day and year, SQL Server returns only those values for which the time is precisely 12:00:00:000AM. Use the MOREINFO="NONE"like keyword to look for dates that match a particular pattern. ID="IN4320-97199128"Number of charactersdate interpretation and
ID="IN4310-99201129"ConversionConversionof dates used with likedates used with likeREMAP="BO--Body"For example, if you insert the value `9:20' into a column named arrival_time, SQL Server converts the entry into `Jan 1 1900 9:20AM.' If you look for this entry using the equality operator, it isn't found:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where arrival_time = "9:20" /* does not match */REMAP="BO--Body"You can find the entry using the MOREINFO="NONE"like operator:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where arrival_time like "%9:20%" ID="IN4317-103205130"datetime datatypeconversion;datetime datatype:values and comparisonsREMAP="BO--Body"When using MOREINFO="NONE"like, SQL Server first converts the dates to datetimeID="IN4316-107209131"varchar datatypedatetime values conversion to
 format and then to varchar. The display format consists of the 3-character month in the current language, 2 characters for the day, and 4 characters for the year, the time in hours and minutes, and AM or PM. REMAP="BO--Body"You cannot use the wide variety of input formats when searching with MOREINFO="NONE"like. Since the standard display formats don't include seconds or milliseconds, you cannot search for seconds or milliseconds with MOREINFO="NONE"like and a match pattern, unless you are also using style 9 or 109 and the MOREINFO="NONE"convert function. ID="IN4317-111213132"Spaces, characterlike datetime values andREMAP="BO--Body"If you are using MOREINFO="NONE"like, and the day of the month is 1 through 9, you must insert two spaces between the month and day to match the varchar conversion of the datetime value. Similarly, if the hour is less than 10, the conversion places two spaces between the year and the hour. The clause: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"like May 2%REMAP="BO--Body"(with one space between "May" and "2") finds all dates from May 20 through May 29, but not May 2. You do not need to insert the extra space with other date comparisons, only with MOREINFO="NONE"like, since the datetime values are converted to varchar only for the MOREINFO="NONE"likeID="IN439-113215133"Datatypesdate and time
ID="IN435-115217134"Datesdatatypes;Time values:datatypes
 comparison. ID="IN4312-118220136"bit datatypeThe bit DatatypeID="IN4332-120222139"True/false data, bit columns for
ID="IN4328-122224140"Yes/no data, bit columns forREMAP="BO--Body"Use bit columns for true/false or yes/no types of data. bit columns hold either 0 or 1. Integer values other than 0 or 1 are accepted, but are always interpreted as 1. Storage size is 1 byte. Multiple bit datatypes in a table are collected into bytes. For example, 7 bit columns fit into 1 byte; 9 MOREINFO="NONE"bit columns take 2 bytes. REMAP="BO--Body"Columns of datatype MOREINFO="NONE"bit cannot be NULL and cannot have indexes on them. The MOREINFO="NONE"status column in the ID="IN4316-124226141"syscolumns table
MOREINFO="NONE"syscolumns system table indicates the unique offset position for bit columns. ID="IN4318-127229142"timestamp datatypeThe timestamp User-Defined DatatypeID="IN4322-129231145"User-defined datatypestimestamp asREMAP="BO--Body"timestamp is a SYBASE-supplied user-defined datatype, defined asID="IN4318-133235146"varbinary datatypevarbinary datatypein timestamp columnstimestamp columns
MOREINFO="NONE" varbinary(8) NULL. MOREINFO="NONE"timestampID="IN4318-135237147"timestamp datatypebrowse mode and
 columns are necessary in tables that are to be browsed (see "LINKEND="X19279"Browse Mode
") in Client Library applications. REMAP="BO--Body"Because timestamp is a user-defined datatype, you cannot use it to define other user-defined datatypes. You must enter it as shown here, in all lowercase letters. ID="IN438-142244148"UpdatingUpdatingSee also Changing; timestamp datatype!see also Changing; timestamp datatype
ID="IN4317-146248149"timestamp columnsautomatic update of;Automatic operations:timestampREMAP="BO--Body"Every time a row containing a MOREINFO="NONE"timestamp column is inserted or updated, SQL Server automatically updates the MOREINFO="NONE"timestampID="IN4320-148250150"Number (quantity of)timestamp columns
 column. A table can have only one column of MOREINFO="NONE"timestamp datatype.ID="IN4317-150252151"timestamp columnscreatingCreating a timestamp ColumnREMAP="BO--Body"If you create a column named timestamp without specifying a datatype, SQL Server automatically defines the column as a timestamp datatype:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    create table testing         (c1 int, timestamp, c2 int)REMAP="BO--Body"You can also explicitly assign the timestamp datatype to a column named timestamp:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    create table testing         (c1 int, timestamp timestamp, c2 int)REMAP="BO--Body"or to a column with another name:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    create table testing         (c1 int, t_stamp timestamp,c2 int)REMAP="BO--Body"You can create a column named timestamp and assign it another datatype (although this could be confusing to other users, and would not allow the use of the MOREINFO="NONE"browse functions in Open Client or with the MOREINFO="NONE"tsequal function):ID="IN4318-153255152"timestamp datatypeREMAP="UI--UserInput" FORMAT="LINESPECIFIC"    create table testing         (c1 int, timestamp datetime)The sysnameID="IN4323-156258154"sysname custom datatype
 User-Defined DatatypeREMAP="BO--Body"ID="IN4322-158260156"User-defined datatypessysname as
MOREINFO="NONE"sysnameID="IN4313-160262157"System tablessysname datatype
 is a user-defined datatype that is distributed on the SQL Server installation tape and used in the system tables. Its definition is:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"varchar(30) "not null"ID="IN4322-162264158"User-defined datatypesREMAP="BO--Body"You cannot declare a column, parameter, variable to be of type sysname. It is possible, however, to create a user-defined datatype with a base type of sysname. You can then define columns, parameters, and variables with the user-defined type.ID="IN4344-165267159"Custom datatypes. See User-defined datatypes
ID="IN4345-168270160"Datatypes, custom. See User-defined datatypesUser-Defined DatatypesID="IN436-168270162"Addinguser-defined datatypesREMAP="BO--Body"SQL Server allows you to create user-defined datatypes, based on any system datatype, with the MOREINFO="NONE"sp_addtype system procedure. You cannot create a user-defined datatype based on another user-defined datatype, such as timestamp or the tid datatype in the pubs2 database. sysname, as described above, is a special case.ID="IN436-168270163"Naminguser-defined datatypes
ID="IN4322-168270164"Object names, databaseuser-defined datatype names as
ID="IN4316-168270165"Database objectsuser-defined datatypes asREMAP="BO--Body"User-defined datatypes are database objects. Their names are case sensitive and must conform to the rules for identifiers. UseMOREINFO="NONE" sp_renameID="IN4322-168270166"User-defined datatypesdropping
 to rename a user-defined datatype, and MOREINFO="NONE"sp_droptype to remove a user-defined datatype from a database. You cannot drop a datatype that is already in use in any table. ID="IN4351-168270167"Null types, user-defined datatype specification andID="IN4317-170272168"IDENTITY propertyuser-defined datatype specification andID="IN4328-172274169"sp_bindrule system procedureuser-defined datatypes andREMAP="BO--Body"In addition to datatype information (including length, precision, and scale where appropriate), user-defined datatypes can specify a default null type or the IDENTITY property. You can bind rules to user-defined datatypes with MOREINFO="NONE"sp_bindruleID="IN4330-174276170"sp_bindefault system procedureuser-defined datatypes and
, and bind defaults with MOREINFO="NONE"sp_bindefault.REMAP="BO--Body"After creating a user-defined datatype in a database, you can use it to create columns, parameters, and variables.These automatically inherit the datatype, rules, and defaults associated with the user-defined type. By default, they inherit the null type or IDENTITY property of the user-defined type, although you can override these in a column definition. ID="IN4314-176278171"model databaseuser-defined datatypes inREMAP="BO--Body"A user-defined datatype must be created in each database in which it will be used. It is a good practice to create frequently used types in the modelID="IN4315-178280172"tempdb databaseuser-defined datatypes in
 database. These types are automatically be added to each new database (including tempdbID="IN4322-180282173"User-defined datatypes
, which is used for temporary tables) as it is created.ID="IN439-180282175"Declaringdatatypes;Datatypes:declaringID="IN439-180282176"Datatypeshelp on;Information (Server):datatypes;Help reports:datatypesGetting Help on DatatypesID="IN4324-182284178"sp_help system procedureREMAP="BO--Body"Use the MOREINFO="NONE"sp_help system procedure to display information about the properties of a system or user-defined datatype. You can also use this procedure to display the datatype, length, precision, and scale for each column in a table.Declaring the Datatype of a Column, Variable, or ParameterREMAP="BO--Body"You must declare the datatype for a column, local variable, or parameter. The datatype can be any of the system-supplied datatypes or any user-defined datatype in the database. Declaring the Datatype for a Column in a TableREMAP="BO--Body"Use the following syntax to declare the datatype of a new column in an MOREINFO="NONE"alter table or MOREINFO="NONE"create table statement: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"create table [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name (MOREINFO="NONE"column_name MOREINFO="NONE"datatype [identity | not null | null]    [, MOREINFO="NONE"column_name MOREINFO="NONE"datatype [identity | not null |        null]]...) REMAP="SY--Syntax" FORMAT="LINESPECIFIC"alter table [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name add MOREINFO="NONE"column_name datatype [identity | null     [, MOREINFO="NONE"column_name MOREINFO="NONE"datatype [identity | null]... REMAP="BO--Body"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table sales_daily    (stor_id char(4)not null,     ord_num numeric(10,0)identity,     ord_amt money null)ID="IN4315-184286180"Local variablesdeclare (name and datatype)Declaring the Type for a Local Variable in a Batch or ProcedureREMAP="BO--Body"Use the following syntax to declare the datatype for a local variable in a batch or stored procedure:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"declare @variable_name MOREINFO="NONE"datatype [, @variable_name MOREINFO="NONE"datatype]... REMAP="BO--Body"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"declare @hope money ID="IN4317-184286181"Stored proceduresparameter datatype declarationDeclaring the Type for a Parameter in a Stored ProcedureREMAP="BO--Body"Use the following syntax to declare the datatype for a parameter in a stored procedure:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"create procedure [MOREINFO="NONE"owner.]MOREINFO="NONE"procedure_name [;nMOREINFO="NONE"umber] [[(]@MOREINFO="NONE"parameter_name MOREINFO="NONE"datatype [= default] [output]     [,@MOREINFO="NONE"parameter_name MOREINFO="NONE"datatype [= default]         [output]]...[)]][with recompile] as MOREINFO="NONE"SQL_statements REMAP="BO--Body"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create procedure auname_sp @auname varchar(40) as     select au_lname, title, au_ord     from authors, titles, titleauthor     where @auname = au_lname     and authors.au_id = titleauthor.au_id     and titles.title_id = titleauthor.title_id Determining the Datatype of a LiteralID="IN4314-184286183"Literal valuesdatatypes ofREMAP="BO--Body"You cannot declare the datatype of a literal. SQL Server treats all character literals as varchar. Numeric literals entered with E notation are treated as float; all others as exact numerics:MARK="BULL" REMAP="BU--Bullet"Literals between 231 - 1 and -231 with no decimal point are treated as integerLiterals that include a decimal point, or that fall outside the range for integers, are treated as numericTo preserve backward compatibility, use E notation for numeric literals that should be treated as floats.ID="IN4341-184286184"Mixed datatypes, arithmetic operations onID="IN4311-184286185"Expressionsmixed modeDatatype of Mixed-Mode Expressions REMAP="BO--Body"When you perform concatenation or mixed-mode arithmetic on values with different datatypes, SQL Server must determine the datatype and, in some cases, the length and precision, of the result.ID="IN4310-187289187"PrecedencePrecedenceSee also Hierarchy!see also Hierarchy
ID="IN439-187289188"Datatypeshierarchy of;Hierarchy:datatypeDetermining Datatype HierarchyREMAP="BO--Body"Each system datatype has a datatype hierarchy, which is stored in the systypes system table. User-defined datatypes inherit the hierarchy of the system type on which they are based. ID="IN437-188290189"Listingdatatypes with typesREMAP="BO--Body"The following query ranks the datatypes in a database by hierarchy. In addition to the information shown below, your query results will include information about any user-defined datatypes in the database:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select name,hierarchyfrom systypesorder by hierarchyREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"name                          hierarchy -----------------------------  --------- floatn                               1float                                2 datetimn                             3datetime                             4real                                 5numericn                             6numeric                              7decimaln                             8decimal                              9moneyn                              10money                               11smallmoney                          12smalldatetime                       13intn                                14int                                 15smallint                            16tinyint                             17bit                                 18varchar                             19sysname                             19nvarchar                            19char                                2nchar                               20varbinary                           21timestamp                           21binary                              22text                                23image                               24 (28 rows affected)ID="IN437-189291190"Listingdatatypes with types
 REMAP="BO--Body"The datatype hierarchy determines the results of computations using values of different datatypes. The result value is assigned the datatype that is closest to the top of the list. REMAP="BO--Body"In the following example, qty from the sales table is multiplied by royalty from the roysched table. qty is a smallint, which has a hierarchy of 16; royalty is an int, which has a hierarchy of 15. Therefore, the datatype of the result is an int. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"smallint(qty) * int(royalty) = int Determining Precision and ScaleREMAP="BO--Body"For the numeric and decimal types, each combination of precision and scale is a distinct SQL Server datatype. If you perform arithmetic on two numeric or decimal valuesMARK="BULL" REMAP="BU--Bullet"n1 with precision p1 and scale s1and n2 with precision p2 and scale n2REMAP="BO--Body"SQL Server determines the precision and scale of the results as follows:TOCENTRY="1"LBL="Table 3-10: "Precision and scale after arithmetic operationsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="21*"COLNAME="C3" COLWIDTH="12*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OperationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PrecisionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ScaleVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n1 + n2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"max(s1, s2) + max(p1 -s1, p2 - s2) + 1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"max(s1, s2)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n1 - n2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"max(s1, s2) + max(p1 -s1, p2 - s2) + 1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"max(s1, s2)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n1 * n2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"s1 + s2 + (p1 - s1) + (p2 - s2) + 1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"s1 + s2COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"n1 / n2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0" max(s1 + p2 -s2 + 1, 6) + p1 - s1 + p2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"max(s1 + p2 -s2 + 1, 6)ID="IN4310-191293191"Conversiondatatypes;Datatypes:convertingConverting One Datatype to AnotherID="IN4310-191293193"Conversionautomatic values
ID="IN4334-191293194"Implicit conversion (of datatypes)implicitREMAP="BO--Body"Many conversions from one datatype to another are handled automatically by SQL Server. These are called implicit conversions. Other conversions must be performed explicitly with the MOREINFO="NONE"convert, MOREINFO="NONE"inttohex, and MOREINFO="NONE"hextoint functions. See LINKEND="X13154""Datatype Conversion Functions"
 in Chapter 2 for details about datatype conversions supported by SQL Server.ID="IN439-191293195"Datatypesnull columns andAutomatic Conversion for Fixed-Length NULL ColumnsID="IN4310-191293196"Conversionnull values and automatic;Internal datatypes of null columnsREMAP="BO--Body"Only columns with variable-length datatypes can store null values. When you create a NULL column with a fixed-length datatype, SQL Server automatically converts it to the corresponding variable-length datatype. SQL Server does not inform the user of the type change.REMAP="BO--Body"The following chart lists the fixed-length datatypes and the variable-length datatypes to which they are converted. Certain variable-length datatypes, such as moneyn, are reserved types; you cannot use them to create columns, variables, or parameters:TOCENTRY="1"LBL="Table 3-11: "Automatic conversion of fixed-length to variable-length datatypesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Original Fixed-Length 
DatatypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Converted ToVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nchar COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nvarchar COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binary COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinary COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetimn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"float COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"floatn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int, smallint, and tinyint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimal COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimaln COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numeric COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numericn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"money and smallmoneyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"moneyn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sensitivityCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sensitivityn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sensitivity_boundary COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sensitivity_boundaryn ID="IN4310-193295197"Conversiondatatypes;Datatypes:converting
ID="IN4310-193295198"Truncationerrors and datatypes
ID="IN4315-193295199"Overflow errorsdatatypes
ID="IN436-193295200"ErrorsdatatypesHandling Overflow and Truncation ErrorsREMAP="BO--Body"The MOREINFO="NONE"arithabort option determines how SQL Server behaves when an arithmetic error occurs. The two MOREINFO="NONE"arithabort options, MOREINFO="NONE"arithabort arith_overflow and MOREINFO="NONE"arithabort numeric_truncation, handle different types of arithmetic errors. You can set each option independently, or set both options with a single MOREINFO="NONE"set arithabort MOREINFO="NONE"on orMOREINFO="NONE" set arithabort off statement. MARK="BULL" REMAP="BU--Bullet"ID="IN4322-199301202"arithabort option, setarith_overflow and
MOREINFO="NONE"arithabort arith_overflow specifies behavior following a divide-by-zero error or a loss of precision during either an explicit or an implicit datatype conversion. This type of error is considered serious. The default setting,MOREINFO="NONE" arithabort arith_overflow on, rolls back the entire transaction or batch in which the error occurs. If you set MOREINFO="NONE"arithabort arith_overflow off, SQL Server aborts the statement that causes the error but continues to process other statements in the transaction or batch.MOREINFO="NONE"arithabort numeric_truncation specifies behavior following a loss of scale by an exact numeric type during an implicit datatype conversion. (When an explicit conversion results in a loss of scale, the results are truncated without warning.) The default setting, MOREINFO="NONE"arithabort numeric_truncation on, aborts the statement that causes the error but continues to process other statements in the transaction or batch. If you set MOREINFO="NONE"arithabort numeric_truncation off, SQL Server truncates the query results and continues processing.REMAP="BO--Body"TheMOREINFO="NONE" arithignore option determines whether SQL Server prints a warning message after an overflow error. By default, the MOREINFO="NONE"arithignore option is turned MOREINFO="NONE"off. This causes SQL Server to display a warning message after any query that results in numeric overflow. To ignore overflow errors, MOREINFO="NONE"set the MOREINFO="NONE"arithignore option MOREINFO="NONE"on.The MOREINFO="NONE"arithabort and MOREINFO="NONE"arithignore options have been redefined for Release 10.0. If you use these options in your applications, examine them to be sure they still produce the desired effects.Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="340*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL provides the smallint, int, numeric, decimal, float, 
double precision, real, and char SQL89 datatypes. The  tinyint, 
binary, varbinary,image, bit, datetime,smalldatetime, money, 
smallmoney, nchar, nvarchar,sysname, text, timestamp, varchar, and user-defined datatypes are Transact-SQL extensions.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL provides the smallint, int, numeric, decimal, float, 
double precision, real, char, and varchar SQL89 datatypes. The  
tinyint, binary, varbinary,image, bit, datetime,smalldatetime, 
money, smallmoney, nchar, nvarchar,sysname, text, timestamp,and 
user-defined datatypes are Transact-SQL extensions.See AlsoCommands     LINKEND="X52197"create procedure
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X30305"execute
MOREINFO="NONE", LINKEND="X64136"setFunctions     LINKEND="X79130"Aggregate Functions
, LINKEND="X13154"Datatype Conversion Functions
,LINKEND="X69388"Date Functions
, LINKEND="X67592"Mathematical Functions
, LINKEND="X22985"String Functions
, LINKEND="X29354"text and image FunctionsTopics     LINKEND="X72999"Parameters
, LINKEND="X29354"text and image Functions
, LINKEND="X44102"Variables (Local and Global)System procedures     LINKEND="X32817"sp_addtype
MOREINFO="NONE", LINKEND="X84736"sp_bindefault
MOREINFO="NONE", LINKEND="X38718"sp_bindrule
MOREINFO="NONE", LINKEND="X68983"sp_droptype
MOREINFO="NONE", LINKEND="X91431"sp_help
MOREINFO="NONE", LINKEND="X37949"sp_rename
MOREINFO="NONE", LINKEND="X87638"sp_unbindefault
MOREINFO="NONE", LINKEND="X37191"sp_unbindrule
ID="IN439-201303206"Datatypes
 ID="IN4314-204306207"Disk mirroringdisk mirroring toID="X82597"Disk MirroringID="IN446-205308209"Addingmirror device
Creates a software mirror of a user database device, the masterID="IN4415-205308210"Failures, mediadisk mirroring and
 database device, or a database device used for user database transaction logs. If a database device fails, its mirror immediately takes over. 
Disk mirroring does not interfere with ongoing activities in the database. You can mirror or unmirror database devices without shutting down SQL Server. Deciding What to MirrorREMAP="BO--Body"You should mirror all default database devices so that you are still protected if a MOREINFO="NONE"create or MOREINFO="NONE"alter database command affects a database device in the default list. ID="IN4416-205308212"Database devicestransaction logs on separate
ID="IN4420-205308213"Separation, physicalSeparation, physicalof transaction log device;Transaction logs:on a separate device[Transaction logs:separate device]transaction log deviceREMAP="BO--Body"In addition to mirroring user database devices, you should always put their transaction logs on a separate database device. You can also mirror the database device used for transaction logs, for even greater protection. ID="IN4413-207310214"syslogs tableput on a separate deviceREMAP="BO--Body"To put a database's transaction log (that is, the system table syslogs) on a different device than the one on which the rest of the database is stored, name the database device and the log device when you create the database. You could also MOREINFO="NONE"alter database to a second device and then run the system procedure MOREINFO="NONE"sp_logdevice. Mirroring a DeviceREMAP="BO--Body"Use the MOREINFO="NONE"disk mirror command to mirror a database device. Its syntax is:ID="IN4419-210313216"disk mirror commandREMAP="SY--Syntax" FORMAT="LINESPECIFIC"disk mirror name = "MOREINFO="NONE"device_name" , mirror = "MOREINFO="NONE"physicalname" [ ,writes = { serial | noserial }] [ ,contiguous ] (OpenVMS only) REMAP="BO--Body"For example, to create a software mirror for the database device user_disk on the file mirror.dat:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"disk mirror   name = "user_disk",   mirror = "/server/data/mirror.dat" Specifying the Mirror DeviceREMAP="BO--Body"Use theMOREINFO="NONE" mirror = "physicalnameID="IN4427-214317217"mirror keyword, disk mirror
MOREINFO="NONE""ID="IN449-214317218"Path namemirror device
ID="IN4430-214317219"I/O devices, disk mirroring to
ID="IN445-214317220"Filesmirror device
 clause to specify the path to the mirror device, enclosed in single or double quotes. If the mirror device is a file, physicalname must unambiguously identify the path where SQL Server will create the file; it cannot specify the name of an existing file. ID="IN447-214317221"DevicessecondaryREMAP="BO--Body"A device and its mirror together constitute one logical device. The mirror device is used only as a secondary device and does not require a separate entry in sysdevices. SQL Server stores the physical name of the mirror device in the mirrorname column of the sysdevices table. Overriding Serial WritesID="IN4426-218321222"writes option, disk mirrorREMAP="BO--Body"By default (MOREINFO="NONE"writes = serialID="IN4426-226329223"serial option, disk mirror
), the write to the primary database device is guaranteed to finish before the write to the secondary device begins. When the primary and secondary devices are on different physical devices, serial writes help ensure that one of the disks is unaffected by a power failure. REMAP="BO--Body"MOREINFO="NONE"Use theMOREINFO="NONE" writes = noserial option to override serial writes.Requiring the Mirror File to Be Contiguous (OpenVMS Only)ID="IN4415-228331224"OpenVMS systemscontiguous option on
ID="IN4427-232335225"contiguous option (OpenVMS)disk mirrorREMAP="BO--Body"When creating a file as a secondary device, SQL Server tries to use contiguous space. If not enough contiguous blocks are found, the file is created discontiguously and a message printed.REMAP="BO--Body"Use the MOREINFO="NONE"contiguous option to force secondary files to be created contiguously. If you include the MOREINFO="NONE"contiguous option, the system creates a contiguous file or the command fails with an error message. ID="IN4415-232335226"Failures, mediaautomatic unmirroringAutomatic Unmirroring After Device FailureREMAP="BO--Body"When a read or write to a mirrored device is unsuccessful, SQL Server causes the bad device to become unmirrored, and prints error messages. SQL Server continues to run, unmirrored. The System Administrator must remirror the disk to restart mirroring.Disabling a MirrorREMAP="BO--Body"Use the MOREINFO="NONE"disk unmirror command to disable a mirror, either temporarily or permanently. Its syntax is:ID="IN4421-235338229"disk unmirror commandREMAP="SY--Syntax" FORMAT="LINESPECIFIC"disk unmirror name = "MOREINFO="NONE"device_name" [ ,side = { primary | secondary }] [ ,mode = { retain | remove }] REMAP="BO--Body"For example, to suspend software mirroring for the database device user_disk:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"disk unmirror   name = "user_disk" Choosing Which Device to DisableREMAP="BO--Body"Use theID="IN4426-239342230"side option, disk unmirror
MOREINFO="NONE" side clause to specify which device of a mirrored pair to disable. By default, SQL Server disables the secondary device (mirror). UseMOREINFO="NONE" side=primary to disable the device listed in the phyname column of sysdevicesID="IN4431-243346231"secondary option, disk unmirror
. Temporarily Deactivating a DeviceREMAP="BO--Body"ID="IN4426-247350232"mode option, disk unmirror
By defaultMOREINFO="NONE" (mode=MOREINFO="NONE"retain), SQL Server deactivates the specified device temporarily; you can reactivate it at a later time. This is similar to what happens when a device fails and SQL Server activates its mirror: MARK="BULL" REMAP="BU--Bullet"I/O is directed only at the remaining device of the mirrored pair.The status column of sysdevices is altered to indicate that the mirroring feature has been deactivated. The entries for primary (phyname) and secondary (mirrorname) disks are unchanged.Permanently Disabling a MirrorREMAP="BO--Body"MOREINFO="NONE"Use modeID="IN4428-251354233"remove option, disk unmirror
=MOREINFO="NONE"remove to completely disable disk mirroring. This option eliminates all references in the system tables to a mirror device. If you set MOREINFO="NONE"mode=MOREINFO="NONE"remove: MARK="BULL" REMAP="BU--Bullet"The status column is altered to indicate that the mirroring feature is to be completely ignored. The phyname column is replaced by the name of the secondary device in the mirrorname column if the primary device is the one being deactivated.The mirrorname column is set to NULL. MOREINFO="NONE"mode=remove does not remove an operating system file that has been used as a mirror.Re-enabling a MirrorREMAP="BO--Body"Use the MOREINFO="NONE"disk remirror command to re-enable a mirror that has been temporarily disabled by the MOREINFO="NONE"disk unmirror command or by device failure. Its syntax is:ID="IN4421-254357235"disk remirror commandREMAP="SY--Syntax" FORMAT="LINESPECIFIC"disk remirror name = "MOREINFO="NONE"device_name" REMAP="BO--Body"For example, to resume software mirroring on the database device user_disk:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"disk remirror   name = "user_disk" Backing Up master after the Disk Mirroring CommandsID="IN447-254357238"Backupsdisk mirroring andREMAP="BO--Body"It is important to back up the master database with the MOREINFO="NONE"dump MOREINFO="NONE"database command after each use of MOREINFO="NONE"disk mirror, MOREINFO="NONE"disk unmirror, or MOREINFO="NONE"disk remirror. This makes recovery easier and safer in case master is damaged. Mirroring the Master DeviceREMAP="BO--Body"If you mirror the database device for the master database, you can use the MOREINFO="NONE"-r option and the name of the mirror for UNIX, or the MOREINFO="NONE"/mastermirror option for OpenVMS, when you restart SQL Server with the MOREINFO="NONE"dataserver utility program. Add this option to the RUN_servername file for that server, so that the MOREINFO="NONE"startserver utility program will know about it. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"dataserver -dmaster.dat -rmirror.datREMAP="BO--Body"starts a master device named master.dat and its mirror, mirror.dat. For more information, see MOREINFO="NONE"dataserver and MOREINFO="NONE"startserver in the SQL Server Utility Programs for your platform. Getting Information About Devices and MirrorsREMAP="BO--Body"For a report on all SQL Server devices on your system (user database devices and their mirrors, as well as dump devices), execute the system procedure MOREINFO="NONE"sp_helpdevice. See AlsoCommands     LINKEND="X61977"alter database
MOREINFO="NONE", LINKEND="X75308"create database
MOREINFO="NONE",LINKEND="X64061"disk init
MOREINFO="NONE", LINKEND="X27321"disk mirror
MOREINFO="NONE", LINKEND="X86010"disk refit
MOREINFO="NONE", LINKEND="X47917"disk reinit
MOREINFO="NONE", LINKEND="X49953"disk remirror
MOREINFO="NONE", LINKEND="X45609"disk unmirror
MOREINFO="NONE",LINKEND="X68345"dump database
MOREINFO="NONE", LINKEND="X47924"dump transaction
MOREINFO="NONE",LINKEND="X28090"load database
MOREINFO="NONE", LINKEND="X75212"load transactionSystem procedures     LINKEND="X92302"sp_diskdefault
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
MOREINFO="NONE", LINKEND="X21496"sp_logdeviceUtility programs     BOOK="unix" LINKEND="X76998"dataserver
MOREINFO="NONE", BOOK="unix" LINKEND="X28711"startserverID="X20204"ExpressionsID="IN43119843"Expressionsdefinition of
ID="IN43119844"Expressionstypes of
An expression is a combination of one or more constants, literals, functions, column identifiers and/or variables, separated by operators, that returns a single value. Expressions can be of several types, including arithmetic, relational, logical (or ID="IN43199845"Boolean expressionssyntax
Boolean), and character stringID="IN43209576"Comparison operatorsComparison operatorsSee also Relational expressions!see also Relational expressions
ID="IN43792107"DevicesDevicesSee also sysdevices table!see also
. In some Transact-SQL clauses, a subquery can be used in an expression. ID="IN432892108"Arithmetic expression syntaxexpression syntaxArithmetic and Character ExpressionsREMAP="BO--Body"The general pattern for arithmetic and character expressions is: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{MOREINFO="NONE"constant |MOREINFO="NONE" column_name |MOREINFO="NONE" function | (MOREINFO="NONE"subquery)}    [{MOREINFO="NONE"arithmetic_operator |MOREINFO="NONE" bitwise_operator |MOREINFO="NONE"     string_operator |MOREINFO="NONE" comparison_operator }MOREINFO="NONE" {MOREINFO="NONE"constant | MOREINFO="NONE"column_name |MOREINFO="NONE" function | (MOREINFO="NONE"subquery)}]MOREINFO="NONE"...Relational and Logical ExpressionsID="IN4319921011"Logical expressionssyntax;Relational expressionsREMAP="BO--Body"A logical expression or relational expression returns TRUE, FALSE or UNKNOWN. The general patterns are:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"expressionMOREINFO="NONE" comparison_operator [any | all] MOREINFO="NONE"expression expression [not] in MOREINFO="NONE"expression  [not]exists MOREINFO="NONE"expression  expression [not] between expression and MOREINFO="NONE"expression expression [not] like "MOREINFO="NONE"match_string"  [escape "escape_character"] not expression like "MOREINFO="NONE"match_string"   [escape "escape_character"]MOREINFO="NONE"expression is [not] null  not MOREINFO="NONE"logical_expression logical_expression {and | or} MOREINFO="NONE"logical_expressionOperator PrecedenceID="IN439921013"Hierarchyoperators
ID="IN439921014"OperatorsPrecedenceprecedence;Precedence:of operators in expressionsoperators in expressionsREMAP="BO--Body"Operators have the following precedence levels, where 1 is the highest level and 6 is the lowest: REMAP="BO--Body"       1.        unary (single argument)  - + ~       2        * / %        3.      binary (two argument) + - & | ^        4.      MOREINFO="NONE"not        5.      MOREINFO="NONE"and        6.      MOREINFO="NONE"or ID="IN435921015"OrderOrderof execution of operators in expressionsexecution of operators in expressionsREMAP="BO--Body"When all operators in an expression are of the same level, the order of execution is left to right. You can change the order of execution with parentheses-the most deeply nested expression is handled first. Arithmetic OperatorsID="IN4320921017"Arithmetic operatorsArithmetic operatorsin expressionsexpressionsID="IN439921018"OperatorsarithmeticREMAP="BO--Body"SQL Server uses the following arithmetic operators:TOCENTRY="1"LBL="Table 3-12: "Arithmetic operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="9*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  +COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"addition COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  -COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"subtraction COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  *COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"multiplication COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  /COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"division COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  %COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"modulo (Transact-SQL extension) REMAP="BO--Body"Addition, subtraction, division, and multiplication can be used on int, smallint, tinyint, float, real, smallmoney and money columns. ID="IN4319901219"Modulo operator (%)use restrictionsREMAP="BO--Body"The modulo operator cannot be used on smallmoney, money, float or real ID="IN4342851720"Integer remainder. See Modulo operator (%)
columns. Modulo finds the integer remainder after a division involving two whole numbers. For example, 21 % 11 = 10 because 21 divided by 11 equals 1 with a remainder of 10.ID="IN439851721"Datatypesmixed, arithmetic operations on;Mixed datatypes, arithmetic operations onREMAP="BO--Body"When you perform arithmetic operations on mixed datatypes, for example float and int, the Server follows specific rules for determining the type of the result. See "LINKEND="X84316"Datatypes
" for more information.Bitwise OperatorsREMAP="BO--Body"TheID="IN439831923"OperatorsBitwise operatorsbitwise;Bitwise operators:in expressionsexpressions
 bitwise operators are a Transact-SQL extension for use with integer type data. These operators convert each integer operand into its binary representation, then evaluate the operands column by column. A value of 1 corresponds to true, a value of 0 to false. ID="IN4317831924"Bitwise operatorstruth tables;Truth tables:bitwise operationsREMAP="BO--Body"The following tables summarize the results for operands of 0 and 1. If either operand is NULL, the bitwise operator returns NULL.:TOCENTRY="1"LBL="Table 3-13: "Truth tables for bitwise operationsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="5*"COLNAME="C3" COLWIDTH="5*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"& ( and)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE" | ( or)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"^ (exclusive or)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"~ (not)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FALSECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID="IN4316831925"Binary datatypesbitwise operations on;Bitwise operators:binary representation by
ID="IN4311831926"TranslationTranslationof integer arguments into binary numbersinteger arguments into binary numbersREMAP="BO--Body"The following examples use two integer arguments,  A = 170 (10101010 in binary form) and B = 75 ( 01001011 in binary form): TOCENTRY="1"LBL="Table 3-14: "Examples of bitwise operationsCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="2*"COLNAME="C2" COLWIDTH="2*"COLNAME="C3" COLWIDTH="2*"COLNAME="C4" COLWIDTH="5*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OperationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Binary 
FormCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ResultCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ExplanationVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(A & B)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10101010
01001011
------------ 

00001010COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Result column equals 1 if both A and 
B are 1. Otherwise, result column 
equals 0.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(A | B)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10101010
01001011
------------ 

11101011COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"235COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Result column equals 1 if either A or 
B, or both, is 1. Otherwise, result 
column equals 0.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(A ^ B)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10101010 
01001011 
------------ 

11100001COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"225COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Result column equals 1 if either A or 
B, but not both, is 1.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"(~A)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10101010
------------ 

01010101 COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"85COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"All 1's are changed to 0's and all
0's to 1's.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID="IN439812127"OperatorsBitwise operatorsbitwise;Bitwise operators:in expressionsexpressionsThe String Concatenation OperatorREMAP="BO--Body"ID="IN437812129"Stringsconcatenating
The string operator MOREINFO="NONE"+ can be used to concatenate two or more character or binary expressions. For example: NUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"MOREINFO="NONE"select Name = (au_lname + ", " + au_fname) from authors REMAP="UN--Under"Displays author names under the column heading Name in last-name first-name order, with a comma after the last name, for example, Bennett, Abraham.MOREINFO="NONE"select "abc" + "" + "def" REMAP="UN--Under"Returns the string "abc def". The empty string is interpreted as a single space in all char, varchar, nchar, nvarchar, and text concatenation, and in varchar insert and assignment statements.ID="IN4310792330"ConversionConversionfor string concatenation;convert function:for non-character expressions[convert function:non-character expressions]string concatenationREMAP="BO--Body"When concatenating non-character, non-binary expressions, always use MOREINFO="NONE"convert: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select "The date is " +     convert(varchar(12), getdate()) The Comparison OperatorsREMAP="BO--Body"ID="IN4322762633"Relational expressionsRelational expressionsSee also Comparison operators!see also Comparison operators
ID="IN439762634"OperatorsComparison operatorscomparison;Comparison operators:in expressionsexpressions
SQL Server uses the following comparison operators: TOCENTRY="1"LBL="Table 3-15: "Comparison operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="22*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"equal toCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0">COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"greater thanCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"<COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"less thanCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0">=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"greater than or equal toCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"<=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"less than or equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"<>COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"!=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not equal to (Transact-SQL extension)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"!>COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not greater than (Transact-SQL extension)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"!<COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not less than (Transact-SQL extension) REMAP="BO--Body"In comparing character data, MOREINFO="NONE"< ID="IN4310762635"Sort ordercomparison operators and
means closer to the beginning of the server's sort order andMOREINFO="NONE" >ID="IN4316762636"Case sensitivityCase sensitivityin comparison expressionscomparison expressions
 means closer to the end of the sort order. Upper and lower case letters are equal in a case-insensitive sort order. Use MOREINFO="NONE"sp_helpsortID="IN436762637"Blanksexpressions with trailing;Blanks:ignored trailing
 to see the sort order for your SQL Server. Trailing blanks are ignored for comparison purposes. So, for example, "Dirk" is the same as "Dirk  ". REMAP="BO--Body"In comparing dates, MOREINFO="NONE"< means earlier and MOREINFO="NONE"> means later. ID="IN4321762638"" " (quotation marks)comparison operators and;Quotation marks (" "):comparison operators andREMAP="BO--Body"Put single or double quotes around all characterID="IN439723039"DatatypesComparisondatetime values comparison;datetime datatype:comparison of;Dates:comparing;Comparison:of date/time datatypesdate/time datatypes
 and datetime data used with a comparison operator:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"= "Bennet" > "May 22 1947"Nonstandard OperatorsREMAP="BO--Body"The following operators are Transact-SQL extensions:MARK="BULL" REMAP="BU--Bullet"Modulo operator: %Negative comparison operators: !>, !<, !=Bitwise operators: ~, ^, |, &Join operators: *= and =*Using any, all and inREMAP="BO--Body"ID="IN4311703244"any keywordany keywordin expressionsexpressions
MOREINFO="NONE"any is used with MOREINFO="NONE"<, >, or MOREINFO="NONE"= and a subquery. It returns results when any value retrieved in the subquery matches the value in the MOREINFO="NONE"where or MOREINFO="NONE"having clause of the outer statement. See "LINKEND="X45943"Subqueries
" for more information. REMAP="BO--Body"ID="IN4311683445"all keywordsubqueries using
MOREINFO="NONE"all is used with MOREINFO="NONE"< or MOREINFO="NONE"> and a subquery. It returns results when all values retrieved in the subquery are less than (MOREINFO="NONE"<) or greater than (MOREINFO="NONE">) the value in the MOREINFO="NONE"where or MOREINFO="NONE"having clause of the outer statement. See "LINKEND="X45943"Subqueries
" for more information. REMAP="BO--Body"ID="IN4310663646"in keywordin keywordin expressionsexpressions
MOREINFO="NONE"in ID="IN4310663647"SubqueriesSubqueriesin expressionsexpressions
returns results when any value returned by the second expression matches the value in the first expression. The second expression must be a subquery or a list of values enclosed in parentheses. MOREINFO="NONE"in is equivalent to MOREINFO="NONE"=ID="IN4310643848"Subqueriesany keyword and
 MOREINFO="NONE"any. See "LINKEND="X30827"where Clause
" for details. Negating and TestingREMAP="RI--RefIndent"ID="IN4311624051"not keywordnot keywordin expressionsexpressions
MOREINFO="NONE"not negates the meaning of a keyword or logical expression. REMAP="BO--Body"UseID="IN4314604252"exists keywordexists keywordin expressionsexpressions
MOREINFO="NONE" exists to test for the existence of some result. The following expression must be a subquery. RangesREMAP="BO--Body"ID="IN4315584454"between keyword
MOREINFO="NONE"betweenID="IN4328564655"Range-start keyword, between
ID="IN4311544856"and keywordrange-end
 is the range-start keyword; MOREINFO="NONE"andID="IN4322525057"Range-end keyword, and
 is the range-end keyword. The range:REMAP="UI--UserInput" FORMAT="LINESPECIFIC" where column1 between x and yREMAP="BO--Body" is inclusive. The range:REMAP="UI--UserInput" FORMAT="LINESPECIFIC" where column1 > x and column1 < yREMAP="BO--Body"is not inclusive. Pattern MatchingREMAP="BO--Body"ID="IN4312505259"like keywordlike keywordin expressionsexpressions
MOREINFO="NONE"like indicates that the following expression is a matching pattern. With MOREINFO="NONE"like, the second expression must always be a character string. MOREINFO="NONE"like is available for all character and datetime datatypes (but not to search for seconds or milliseconds). Using WildcardsREMAP="BO--Body"A match_stringID="IN4317505261"Character stringswildcards in
ID="IN4319505262"Wildcard charactersWildcard charactersin expressionsexpressions
 is a character string that can be used with a number of wildcards: TOCENTRY="1"LBL="Table 3-16: "Wildcards used with likeCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="16*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"%COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any string of 0 or more characters COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"_COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any single character COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"[ ]COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any single character within the specified range ([a-f]) or set 
([abcdef]) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"[^]COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any single character not within the specified range ([^a-f]) or 
set ([^abcdef]) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID="IN4319485463"Wildcard charactersWildcard charactersin a like match stringlike match string
ID="IN4312465664"like keywordwildcard characters used withREMAP="BO--Body"The wildcard and the match string must be enclosed in single or double quotes (MOREINFO="NONE"like "[dD]eFr_nce"). For complete information, including information on using alternative character set definitions in wildcards, see "LINKEND="X18218"Wildcard Characters
ID="IN4326465665"Single character wildcards
ID="IN435465666"Rangewildcard characters specifying
." Escape CharactersREMAP="BO--Body"The ID="IN4314445868"escape keywordescape keywordin expressionsexpressions
MOREINFO="NONE"escape keyword specifies an escape character with which you can search for literal occurrences of wildcard characters. See "LINKEND="X18218"Wildcard Characters
" for a complete explanation.ID="IN4312426070"null keywordnull keywordin expressionsexpressionsUsing NullsID="IN4315406272"is null keywordis null keywordin expressionsexpressionsREMAP="BO--Body"Use MOREINFO="NONE"is nullID="IN4334386473"is not null keyword in expressions
 or MOREINFO="NONE"is not null in queries on columns defined to allow null values. If MOREINFO="NONE"nullID="IN4316366674"not null keywordnot null keywordin expressionsexpressions
 is used to query columns defined as MOREINFO="NONE"not null, SQL Server displays an error message. ID="IN4311366675"Null valuesNull valuesin expressionsexpressionsREMAP="BO--Body"An expression with a bitwise or arithmetic operator evaluates to NULL if any of the operands are null. See "LINKEND="X98459"Null Values
" for more information.Connecting ExpressionsREMAP="BO--Body"ID="IN4311346877"and keywordand keywordin expressionsexpressions
MOREINFO="NONE"and connects two expressions and returns results when both are true. When more than one logical operator is used in a statement, MOREINFO="NONE"and is handled first. However, you can change the order of execution with parentheses. REMAP="BO--Body"ID="IN4310327078"or keywordor keywordin expressionsexpressions
MOREINFO="NONE"or connects two or more conditions and returns results when either of the conditions is true. When more than one logical operator is used in a statement, MOREINFO="NONE"or is evaluated after ID="IN4316307279"and (&) operatorlogical
MOREINFO="NONE"and. However, you can change the order of execution with parentheses. ID="IN4319287480"Logical expressionstruth tables for;Truth tables:logical expressionsREMAP="BO--Body"This table shows the results of logical operations, including those which involve null values:TOCENTRY="1"LBL="Table 3-17: "Truth tables for logical expressionsCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="8*"COLNAME="C4" COLWIDTH="8*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"andCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TRUECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FALSECOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"TRUECOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TRUECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FALSECOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UNKNOWNCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"FALSECOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FALSECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FALSECOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FALSECOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"NULLCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UNKNOWNCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FALSECOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UNKNOWNCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"orCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"TRUECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"FALSECOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"NULLCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"TRUECOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TRUECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TRUECOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TRUECOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"FALSECOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TRUECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FALSECOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UNKNOWNCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"NULLCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TRUECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UNKNOWNCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UNKNOWNCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"notCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"TRUECOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FALSECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"FALSECOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TRUECOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"NULLCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UNKNOWNCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"REMAP="BO--Body"The result UNKNOWN indicates that one or more of the expressions evaluates to NULL, and that the result of the operation cannot be determined to be either TRUE or FALSE. See "LINKEND="X98459"Null Values
ID="IN4319267681"Logical expressionstruth tables for;Truth tables:logical expressions
" for more information.Using Parentheses in ExpressionsID="IN4314237983"Parentheses ()Parentheses ()See also Symbols section of this index!see also
ID="IN4316237984"() (parentheses)in expressions;Parentheses ():in an expressionREMAP="BO--Body"Parentheses can be used to group the elements in an expression. When "expression" is given as a variable in a syntax statement, a simple expression is assumed. "Logical expression" is specified when only a logical expression is acceptable. Comparing Character ExpressionsID="IN439237986"ConstantsConstantsin expressionsexpressionsREMAP="BO--Body"Character constant expressions are treated as varchar. If they are compared with non-varcharID="IN4310237987"Conversionimplicit;Implicit conversion (of datatypes)
ID="IN4310237988"ConversionConversionof lower to higher datatypeslower to higher datatypes
 variables or column data, the datatype precedence rules are used in the comparison, that is, the "lower" datatype is converted to the "higher" datatype. If implicit conversion of the lower datatype to the higher datatype is not allowed, you must use MOREINFO="NONE"convertID="IN4335208289"Datatype precedence. See Precedence
ID="IN439178590"HierarchyHierarchySee also Precedence!see also Precedence
ID="IN4342148891"Lower and higher datatypes. See Precedence
ID="IN435119192"OrderOrderSee also Indexes; Precedence; Sort order!see also Indexes; Precedence; Sort order
. ID="IN4310119193"PrecedencePrecedenceof lower and higher datatypeslower and higher datatypes
ID="IN431399394"char datatypechar datatypein expressionsexpressionsREMAP="BO--Body"Comparison of a charID="IN431679595"varchar datatypevarchar datatypein expressionsexpressions
 expression to a varchar expression follows the datatype precedence rule; the "lower" datatype is converted to the "higher" datatype. All varchar expressions are converted to char (that is, trailing blanks are appended) for the comparison.ID="IN431779596"Character stringsempty
ID="IN432179597"Quotation marks (" ")Quotation marks (" ")for empty stringsempty stringsUsing the Empty String ID="IN431779599"Spaces, characterEmpty string (" ") or (' ')empty strings (" ") or (' ') as;" " (quotation marks):enclosing empty strings;Empty string (" ") or (' '):as a single spacesingle space
ID="IN436795100"Blanksappended;Blanks:expressions with trailingREMAP="BO--Body"The empty string ("") or (`') is interpreted as a single blank in MOREINFO="NONE"insert or assignment statements on varchar data. In concatenation of varchar, char, nchar, nvarchar data, the empty string is interpreted as a single space; for example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC""abc" + "" + "def"REMAP="BO--Body"is stored as "abc def". The empty string is never evaluated as NULL. ID="IN4317795101"Character stringsspecifying quotes withinIncluding Quotation Marks in Character ExpressionsID="IN4321795103"Quotation marks (" ")Quotation marks (" ")in expressions;" " (quotation marks):in expressions[" " (quotation marks):expressions]expressions
ID="IN4331795104"Literal character specificationquotes (" ");Quotation marks (" "):literal specification of;" " (quotation marks):literal specification ofREMAP="BO--Body"There are two ways to specify literal quotes within a char or varcharID="IN4315795105"Doubling quotesDoubling quotesin expressionsexpressions
ID="IN4331795106"Enclosing quotes in expressionsenclosing quotes in
 entry. The first method is to double the quotes. For example, if you began a character entry with a single quote but wanted to include a single quote as part of the entry, use two single quotes: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"'I don"t understand.' REMAP="UN--Under"With double quotes: REMAP="UI--UserInput" FORMAT="LINESPECIFIC""He said, ""It's not really confusing.""" REMAP="BO--Body"The second method is to enclose a quote in the opposite kind of quote mark. In other words, surround an entry containing a double quote with single quotes (or vice versa). Here are some examples: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"'George said, "There must be a better way."' "Isn't there a better way?" 'George asked, "Isn"t there a better way?"' ID="IN4352795107"\ (backslash), character string continuation withcontinuation with (\)Using the Continuation CharacterID="IN4336795109"Continuation lines, character stringREMAP="BO--Body"To continue a character string to the next line on your screen, enter a backslash ( \ ) before going to the next line. See AlsoCommands     LINKEND="X35229"select
, LINKEND="X30827"where ClauseTopics     LINKEND="X45943"Subqueries
, LINKEND="X18218"Wildcard CharactersSystem procedures     LINKEND="X90336"sp_helpjoins
ID="IN4311597111"Expressions
 REMAP="BO--Body"ID="X62459"IdentifiersID="IN4369484"Namingidentifiers;Naming:conventions;Naming:database objects
ID="IN43169485"Database objectsidentifier names
ID="IN43149486"Reserved wordsdatabase object identifiers and
Identifiers are names for  database objects such as databases, tables, views, columns, indexes, triggers, procedures, defaults, rules, and cursors. Valid IdentifiersID="IN431691118"Database objectsDatabase objectsSee also individual object names!see also
ID="IN43988149"DatabasesDatabasesSee also Database objects!see also Database objects
ID="IN437851710"IndexesIndexesSee also Clustered indexes; Database objects; Non-clustered indexes!see also
ID="IN4344822011"Objects. See Database objects; Databases
ID="IN435792312"RulesRulesSee also Database objects!see also Database objects
ID="IN438762613"TriggersTriggersSee also Database objects; Stored procedures!see also Database objects; Stored procedures
ID="IN4334732914"User objects. See Database objects
ID="IN4342703215"User-created objects. See Database objects
ID="IN435673516"ViewsViewsSee also Database objects; Multi-table views!see also Database objects; Multi-table views
ID="IN4322643817"Object names, databaseObject names, databaseSee also Identifiers!see also Identifiers
ID="IN4335614118"Column identifiers. See Identifiers
ID="IN435584419"NamesNamesSee also Identifiers!see also Identifiers
ID="IN434554720"SizeSizeSee also Length; Number (quantity of); Range; Size limit; Space allocation!see also
ID="IN435525021"RangeRangeSee also Numbers; Size!see also
ID="IN436495322"LengthLengthSee also Size!see also Size
ID="IN434495323"Sizeidentifiers (length)REMAP="BO--Body"SQL Server identifiers can be a maximum of 30 bytes in MOREINFO="NONE"lengthID="IN4314495324"_ (underscore)object identifier prefix;Underscore (_):object identifier prefix
, whether single-byte or multibyte characters are used. The first character of an identifier must be either an alphabetic character as defined in the current character set or the underscore (_ ) symbol. Temporary table names begin with # and local variable names with @.ID="IN4311495325"Punctuationcharacters allowed in identifiersID="IN437495326"SymbolsSymbolsin identifier namesidentifier namesID="IN4313495327"Money symbolsmoneyID="IN4317495328"Spaces, characternot allowed in identifiersREMAP="BO--Body"Subsequent characters can include letters,
numbers, the symbols #, @, _, or currency symbols such as $ (dollars), name='yen' font='' code='165'  charset='fontspecific' (yen) and £ (pound sterling). Identifiers cannot include special characters such as !%^&*. or embedded spaces.REMAP="BO--Body"ID="IN438495329"KeywordsTransact-SQL;Reserved words:database object identifiers and
You cannot use a reserved word, such as a Transact-SQL command, as an identifier. For a complete list of reserved words, see LINKEND="X94212"Appendix A, "Reserved Words"Object Names That Begin with # (Temporary Tables)REMAP="BO--Body"Tables whose names that begin with # are temporary tables. You cannot create other types of objects whose names begin with the pound sign. ID="IN4316495331"Temporary tablesnaming;Truncation:temporary table names
ID="IN4313495332"Padding, dataunderscores in temporary table names
ID="IN4314495333"_ (underscore)_ (underscore)in temporary table names;Underscore (_):in temporary table names[Underscore (_):temporary table names]temporary table namesREMAP="BO--Body"SQL Server performs special operations on temporary table names to maintain unique naming on a per-session basis. Long temporary tables names are truncated to 13 characters (including the pound sign); short names are padded to 13 characters with underscores (_). A 17-digit numeric suffix is appended that is unique for a SQL Server session.ID="IN4316495334"Case sensitivityCase sensitivityof identifier namesidentifier namesCase SensitivityID="IN4333465636"Lowercase letters, sort order andLowercase letters, sort order andSee also Case sensitivity!see also Case sensitivityREMAP="BO--Body"SQL Server's sensitivity to the case (upper or lower) of identifiers and data depends on the sort order installed on your Server. Case sensitivity can be changed for single-byte character sets by reconfiguring SQL Server's sort order. (See the System Administration GuideID="IN4327396337"Uppercase letter preferenceUppercase letter preferenceSee also Case sensitivity; order by clause!see also Case sensitivity; order by clause
ID="IN4316396338"Case sensitivityCase sensitivityof utility commandsutility commands
 for more information). Case is significant in utility program options. ID="IN4316396339"Case sensitivityCase sensitivityof identifier namesidentifier namesREMAP="BO--Body"If SQL Server is installed with a case-insensitive sort order, you cannot create a table named MYTABLE if a table named MyTable or mytable already exists. Similarly, this command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select * from MYTABLEREMAP="BO--Body"will return rows from MYTABLE, MyTable, or mytable, or any combination of upper and lower case letters in the name.UniquenessID="IN4327396341"Unique names as identifiersREMAP="BO--Body"Object names need not be unique in a
database. However, column names and index names must be unique within a table, and other object names must be unique for each owner within a database. Database names must be unique on SQL Server. Using Delimited IdentifiersREMAP="BO--Body"Delimited identifiers are object names enclosed in double quotes. Using delimited identifiers allows you to avoid certain restrictions on object names. Table, view, and column names can be delimited by quotes; other object names cannot.REMAP="BO--Body"Delimited identifiers can be reserved words, can begin with non-alphabetic characters, and can include characters that would not otherwise be allowed. They cannot exceed 28 bytes.Delimited identifiers may not be recognized by all front-ends and should not be used as parameters to system procedures.REMAP="BO--Body"Before creating or referencing a delimited identifier, you must execute:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set quoted_identifier onREMAP="BO--Body"Each time you use the delimited identifier in a statement, you must enclose it in double quotes. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table "1one"(col1 char(3))create table "include spaces" (col1 int) create table "grant"("add" int)insert "grant"("add") values (3)REMAP="BO--Body"While the MOREINFO="NONE"quoted_identifier option is turned on, do not use double quotes around character or date strings; use single quotes instead. Delimiting these strings with double quotes causes SQL Server to treat them as identifiers. For example, to insert a character string into col1 of 1table, use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert "1one"(col1) values (`abc')REMAP="BO--Body"not:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert "1one"(col1) values ("abc")REMAP="BO--Body"To insert a single quote into a column, use two consecutive single quotation marks. For example, to insert the characters a'b into col1 use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert "1one"(col1) values(`a"b')ID="IN4315396343"Qualifier namesqualifying database objectsUsing Qualified Object NamesID="IN4315396345"Database Ownersname as qualifier
ID="IN437396346"ColumnsColumn nameidentifying;Column name:as qualifierqualifier
ID="IN436396347"Tablesnames as qualifiers;Tables:identifying
ID="IN435396348"Viewsnames as qualifiers
ID="IN4310396349". (period)separator for qualifier names;Period (.) separator for qualifier namesREMAP="BO--Body"You can uniquely identify a table or column by adding other names that qualify it-the database name, owner's name, and (for a column) the table or view name. Each of these qualifiers is separated from the next by a period. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"database.MOREINFO="NONE"owner.MOREINFO="NONE"table_name.MOREINFO="NONE"column_name REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"database.MOREINFO="NONE"owner.MOREINFO="NONE"view_name.MOREINFO="NONE"column_name ID="IN4311396350"Conventionsidentifier nameREMAP="BO--Body"The naming conventions are: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"table_name REMAP="UI--UserInput" FORMAT="LINESPECIFIC"[[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"view_name ID="X64904"Using Delimited Identifiers Within an Object NameREMAP="BO--Body"If the MOREINFO="NONE"quoted_identifier option is set MOREINFO="NONE"on, you can use double quotes around individual parts of a qualified object name. Use a separate pair of quotes for each qualifier that requires quotes. For example, use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"database.owner."table_name"."column_name"REMAP="BO--Body"rather than:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"database.owner."table_name.column_name"  Omitting the Owner NameID="IN4335396351"Dots (..) for omitted name elements
ID="IN435396352"Namesomitted elements of (..);Periods (..) for omitted name elementsREMAP="BO--Body"You can omit the intermediate elements in a name and use dots to indicate their positions, as long as the system is given enough information to identify the object: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"database..MOREINFO="NONE"table_name REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"database..MOREINFO="NONE"view_name Referencing Your Own Objects in the Current DatabaseREMAP="BO--Body"You need not use the database name or owner name to reference your own objects in the current database. The default value for MOREINFO="NONE"owner is the current user, and the default value for database is the current database. ID="IN4322396353"Database object ownersidentifiers andREMAP="BO--Body"If you reference an object without qualifying it with the database name and owner name, SQL Server tries to find the object in the current database among the objects you own. Referencing Objects Owned by the Database OwnerID="IN4315396354"Database Ownersname as qualifier
ID="IN4315396355"Database Ownersobjects and identifiers;Users:other object ownerREMAP="BO--Body"If you omit the owner name and you don't own an object by that name, SQL Server looks for objects of that name owned by the Database Owner. You must qualify objects owned by the Database Owner only if you own an object of the same name, but want to use the object owned by the Database Owner. However, you must qualify objects owned by other users with the user's name, whether you own objects of the same name or not. Using Qualified Identifiers ConsistentlyID="IN4311396356"Expressionsname and table name qualifying;Matching:name and table nameREMAP="BO--Body"When qualifying a column name and table name in the same statement, be sure to use the same qualifying expressions for each; they are evaluated as strings and must match or an error is returned. The second of the following examples is incorrect because the syntax style for the column name does not match the syntax style used for the table name. NUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"select demo.mary.publishers.city from demo.mary.publishers REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"city ----------------------- Boston Washington Berkeley select demo.mary.publishers.city from demo..publishers REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"The column prefix "demo.mary.publishers" does not match a table name or alias name used in the query.Determining Whether an Identifier Is ValidID="IN4326356758"valid_name system functionchecking with valid_nameREMAP="BO--Body"You can use the system function MOREINFO="NONE"valid_name to determine if an identifier you have created is acceptable to SQL Server. Here is the syntax: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select valid_name(MOREINFO="NONE""string") REMAP="BO--Body"where string is the identifier you wish to check. If string is not valid as an identifier, SQL Server returns a 0 (zero). If string is a valid identifier, SQL Server returns a nonzero number. SQL Server returns a 0 if the characters used are illegal or if string is more than 30 bytes long. Use this function to check object names after changing character sets, or to verify names before creating tables and other database objects. ID="IN4311356759"IdentifiersrenamingRenaming Database ObjectsREMAP="BO--Body"Rename user objects (including user-defined datatypes) with MOREINFO="NONE"sp_rename. After you rename a table or column, be sure to redefine any procedures, triggers, and views that depend on the renamed object.Using Multibyte Character SetsID="IN4315356762"Qualifier namesqualifying database objects
ID="IN4340356763"Other users, qualifying objects owned byOwnershipof objects being referencedobjects being referenced
ID="IN4314356764"Character setsobject identifiers and;Character sets:multibyte;Multibyte character sets:identifier names
ID="IN4316356765"Greek characters
ID="IN4319356766"Cyrillic charactersREMAP="BO--Body"In multibyte character sets, a wider range of characters is available for use in identifiers. For example, on a server with the Japanese language installed, the following types of characters may be used as the first character of an identifier: Zenkaku or Hankaku Katakana, Hiragana, Kanji, Romaji, Greek, Cyrillic, or ASCII. ID="IN4310346867"Conversionbetween character sets
ID="IN4323346868"Japanese character setsobject identifiers andREMAP="BO--Body"Although Hankaku Katakana characters are legal in identifiers on Japanese systems, they are not recommended for use in heterogeneous systems. These characters cannot be converted between the EUC-JIS and Shift-JIS character sets. ID="IN4341346869"European characters in object identifiers
ID="IN4323346870"Macintosh character set
ID="IN4318346871"ISO character setsREMAP="BO--Body"The same is true for some 8-bit European characters. For example, the character "CE ," the OE ligature, is part of the Macintosh character set (codepoint 0xCE). This character does not exist in the ISO 8859-1 character set. If "CE " exists in data being converted from the Macintosh to the ISO 8859-1 character set, it causes a conversion error. ID="IN4310336972"Conversionbetween character setsREMAP="BO--Body"If an object identifier contains a character that cannot be converted, the client loses direct access to that object. Standards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="241*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"To be compliant, identifiers must not:
Begin with the pound sign (#)
Have more than 18 characters
Contain lowercase letters COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"To be entry level compliant, identifiers
 must not:
Begin with the pound sign (#)
Have more than 18 charactersSee AlsoCommands     LINKEND="X75308"create database
MOREINFO="NONE", LINKEND="X81463"create default
MOREINFO="NONE", LINKEND="X52197"create procedure
MOREINFO="NONE", LINKEND="X43186"create rule
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X19955"create trigger
MOREINFO="NONE", LINKEND="X30101"create view
MOREINFO="NONE", LINKEND="X35229"select
MOREINFO="NONE", LINKEND="X64136"setFunctions     LINKEND="X80972"System FunctionsTopics     LINKEND="X84316"DatatypesSystem procedures     LINKEND="X37949"sp_rename
ID="IN4311307276"IdentifiersRulesfor identifiersidentifiers
ID="IN436277577"Namingidentifiers;Naming:conventions;Naming:database objects
 ID="X01073"ID="IN4416208378"IDENTITY columnsIDENTITYIDENTITY ColumnsID="IN446208380"Valuessystem-generated;Columns:system-generated
ID="IN4411208381"Rows, tableuniquely identifying
ID="IN4416188582"IDENTITY columnsdatatype of
IDENTITY columns contain system-generated values that uniquely identify each row within a table. They are used to store sequential numbers, such as invoice numbers or employee numbers, that are generated automatically by SQL Server. The value of the IDENTITY column uniquely identifies each row in a table. Each table in a database can have a single IDENTITY column, of type numeric and scale zero. You can define an IDENTITY column when you create a table with a MOREINFO="NONE"create table or MOREINFO="NONE"select into statement, or add it later with an MOREINFO="NONE"alter tableID="IN4411168783"Null valuesnot allowed in IDENTITY columns
 statement.  By definition, IDENTITY columns cannot be updated and do not allow nulls. Each time you insert a row into a table, SQL Server automatically supplies a unique, sequential value for its IDENTITY column, beginning with the value "1". Manual insertions, deletions, transaction rollbacks, and server failures can create gaps in IDENTITY column values. ID="IN4416109384"IDENTITY columnscreating;IDENTITY columns:create table andID="X36521"Defining an IDENTITY Column in a New TableREMAP="BO--Body"You can define an IDENTITY column with any desired precision-from 1 to 38 digits-in a new table. Specify the ID="IN441679687"identity keyword
MOREINFO="NONE"identity keyword, instead of MOREINFO="NONE"null or MOREINFO="NONE"not null, in the MOREINFO="NONE"create table statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table table_name     (column_name numeric(precision,0) identity)REMAP="BO--Body"The following example creates a new table, my_table, with an IDENTITY column called id_col. Values for this column can range from 1 through 10 4 - 1, or 9,999:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table my_table     (id_col numeric(4,0) identity, col2 char(5))ID="IN4416310088"IDENTITY columnsalter table andAdding an IDENTITY Column to an Existing TableREMAP="BO--Body"To add an IDENTITY column to an existing table, specify the MOREINFO="NONE"identity keyword in the MOREINFO="NONE"alter table statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"alter table MOREINFO="NONE"table_name add MOREINFO="NONE"column_name    numeric(precision,0) identityREMAP="BO--Body"The following example adds an IDENTITY column, row_id, to the stores table:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"alter table stores add row_id numeric(5,0) identityREMAP="BO--Body"When you add an IDENTITY column to a table, SQL Server assigns a unique sequential value, beginning with the value 1, to each existing row. If the table contains a large number of rows, this process can be time consuming. If the number of rows exceeds the maximum value allowed for the column (in this case, 99,999), the MOREINFO="NONE"alter table statement fails. Creating "Hidden" IDENTITY Columns AutomaticallyREMAP="BO--Body"System Administrators can use the MOREINFO="NONE"auto identity database option to automatically include a 10-digit IDENTITY column in new tables. To turn this feature on in a database, use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_dboption database_name, "auto identity", "true" REMAP="BO--Body"Each time a user creates a new table without specifying either aMOREINFO="NONE" primary key, a MOREINFO="NONE"unique constraint, or an IDENTITY column, SQL Server automatically defines an IDENTITY column. The IDENTITY column is not visible when you use MOREINFO="NONE"select * to retrieve all columns from the table. You must explicitly include the column name, MOREINFO="NONE"SYB_IDENTITY_COL (all capital lettersMOREINFO="NONE"), in the select list. Referencing an IDENTITY Column with syb_identityID="IN4416110294"IDENTITY columnsselecting
ID="IN4420-310695"syb_identity keywordIDENTITY columns andREMAP="BO--Body"Once you have created an IDENTITY column, you do not need to remember its name. You can use the MOREINFO="NONE"syb_identity keyword, qualified by the table name where necessary, to reference the IDENTITY column in a MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"delete statement. REMAP="BO--Body"For example, the following MOREINFO="NONE"update statement finds the row in which the IDENTITY column equals 1 and changes the name of the store to Barney's:ID="IN4419-811196"select into commandIDENTITY columns andREMAP="UI--UserInput" FORMAT="LINESPECIFIC"update stores_calset stor_name = "Barney's"where syb_identity = 1Selecting an Existing IDENTITY Column into a New TableREMAP="BO--Body"To select an existing IDENTITY column into a new table, include the column name (or the MOREINFO="NONE"syb_identity keyword) in the MOREINFO="NONE"select statement's column_list:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select MOREINFO="NONE"column_list into MOREINFO="NONE"table_namefrom MOREINFO="NONE"table_nameREMAP="BO--Body"The following example creates a new table, stores_cal_pay30, based on columns from the stores table:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select row_id, stor_id, stor_nameinto stores_cal_pay30from stores_calwhere payterms = "Net 30"When the New Column Doesn't Inherit the IDENTITY PropertyREMAP="BO--Body"When you select an IDENTITY column into a new table, the new column inherits the IDENTITY property unless one of the following conditions would result:MARK="BULL" REMAP="BU--Bullet"A table with more than one IDENTITY columnAn IDENTITY column whose value must be computed An IDENTITY column value that cannot be guaranteed as uniqueSelecting the IDENTITY Column More Than Once REMAP="BO--Body"A table cannot have more than one IDENTITY column. If an IDENTITY column is selected more than once, it is defined as NOT NULL in the new table. It does not inherit the IDENTITY property. REMAP="BO--Body"In the following example, the row_id column, which is selected once by name and once by the MOREINFO="NONE"syb_identity keyword, is defined as NOT NULL in stores_cal_pay60:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select syb_identity, row_id, stor_id, stor_nameinto stores_cal_pay60from stores_calwhere payterms = "Net 60"Defining a Column Whose Value Must Be ComputedREMAP="BO--Body"IDENTITY column values are generated by SQL Server. New columns that are based on IDENTITY columns, but whose values must be computed rather than generated, cannot inherit the IDENTITY property. REMAP="BO--Body"If a table'sMOREINFO="NONE" select statement includes an IDENTITY column as part of an expression, the resulting column value must be computed. The new column is created as NULL if any column in the expression allows nulls, and NOT NULL otherwise. In the following  example, the new_id column, which is computed by adding 1000 to the value of row_id, is created NOT NULL.REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select new_id = row_id + 1000, stor_nameinto new_storesfrom stores_calREMAP="BO--Body"Column values are also computed if the select statement contains a MOREINFO="NONE"group MOREINFO="NONE"by clause or aggregate function. If the IDENTITY column is the argument of the aggregate function, the resulting column is created NULL. Otherwise it is created NOT NULL. Defining a Column Whose Value May Not Be UniqueREMAP="BO--Body"The value of the IDENTITY column uniquely identifies each row in a table. If a table's select statement contains a union or join, however, individual rows can appear multiple times in the result set. REMAP="BO--Body"An IDENTITY column that is selected into a table with a union or join does not retain the IDENTITY property. If the table contains the union of the IDENTITY column and a NULL column, the new column is defined as NULL. Otherwise, it is defined as NOT NULL.Adding a New IDENTITY Column with select intoREMAP="BO--Body"To define a new IDENTITY column in a table's MOREINFO="NONE"select into statement, add a description of the IDENTITY column before the MOREINFO="NONE"into clause. Note that the description includes the column precision, but not its scale:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select MOREINFO="NONE"column_list MOREINFO="NONE"identity_column_name = identity(precision) into MOREINFO="NONE"table_namefrom MOREINFO="NONE"table_nameREMAP="BO--Body"The following example creates a new table, new_discounts, from the discounts table and adds a new IDENTITY column, id_col:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select *, id_col=identity(5)into new_discountsfrom discountsID="IN4419-13116101"select into commandIDENTITY columns andREMAP="BO--Body"No table can have more than one IDENTITY column. If the column_list includes an existing IDENTITY column, and you add a description of a new IDENTITY column, the MOREINFO="NONE"select into statement fails.ID="IN4417-17120102"IDENTITY propertysp_help andUsing sp_help to Determine Whether a Column Has the IDENTITY PropertyID="IN4424-21124105"sp_help system procedureIDENTITY columns andREMAP="BO--Body"To determine whether a column has the IDENTITY property, use theMOREINFO="NONE" sp_help system procedure on the column's base table. This procedure lists each column in the table. Columns with the IDENTITY property have an "Identity" value of 1; others, an "Identity" value of 0. REMAP="BO--Body"Here is the result of running MOREINFO="NONE"sp_help on the publishers table:REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Name                   Owner          Type ---------------------- -------------- --------publisher              dbo            user tableREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Data_located_on_segment         When_created ------------------------------  --------------------default                         Jan  1 1900 12:00AMREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Column_name Type  Length Nulls   Default_name Rule_name Identity----------- ----- ------ -----   ------------ --------- --------pub_id      char       4     0   NULL         pub_idrule       0pub_name    varchar   40     1   NULL         NULL             0city        varchar   20     1   NULL         NULL             0state       char       2     1   NULL         NULL             0REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"index_name     index_description                      index_keys-----------    -------------------------------------- -------pubind         clustered, unique located on default   pub_id (1 row affected)REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"keytype object      related_object  object_keys   related_keys------- ------      --------------  ------------  ------------primary publishers  -- none --      pub_id, *, *, *, *, *, *, **, *, *, *, *, *, *, *foreign titles      publishers      pub_id, *, *, *, *, *, *, *pub_id, *, *, *, *, *, *, *REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"(return status = 0)ID="IN4416-23126106"IDENTITY columnssystem-generated valuesAutomatically Generating IDENTITY Column ValuesID="IN4414-27130109"insert commandIDENTITY columns andREMAP="BO--Body"The first time you insert a row into a table, SQL Server assigns the IDENTITY column a value of 1. Each new row you insert gets an IDENTITY column value one higher than the last. Server failures and transaction rollbacks can lead to gaps in these values.ID="IN4416-29132110"IDENTITY columnsinserting tables withREMAP="BO--Body"Because SQL Server automatically generates the IDENTITY column value, MOREINFO="NONE"insert statements should not list the IDENTITY column (or the MOREINFO="NONE"syb_identity keyword) or specify its value.REMAP="BO--Body"Following are two examples of MOREINFO="NONE"insert statements for a table with an IDENTITY column. The first statement has no column list:REMAP="UI--UserInput" FORMAT="LINESPECIFIC" insert stores_wash values ("Best Books", "Net 60")REMAP="BO--Body"The second statement includes a column list, but omits the IDENTITY column, row_id:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert stores_wash (stor_name, payterms)values ("Books And Stuff", "Net 30")REMAP="BO--Body"As it executes each statement, SQL Server automatically supplies a value for the row_id column:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select * from stores_washREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC" row_id  stor_name                               payterms      ------- ----------------------------------------  ------------       1  Doc-U-Mat: Quality Laundry and Books     Net 60             2  Eric the Read Books                     Net 60             3  Best Books                              Net 60             4  Books And Stuff                         Net 30       ID="IN4416-33136111"IDENTITY columnsset identity_insert on
ID="IN4416-35138112"IDENTITY columnsinserting explicit valuesAllowing Explicit Inserts by Setting identity_insert onREMAP="BO--Body"There may be times when you want to insert an explicit value into an IDENTITY column. For example, you may want the first value inserted into the table to have an IDENTITY value of 101, rather than 1. Or you may need to restore a row that was deleted in error. REMAP="BO--Body"Only the table owner, the Database Owner, or System Administrator can explicitly insert a value into an IDENTITY column. Before inserting the data, the user mustMOREINFO="NONE" set MOREINFO="NONE"identity_insert MOREINFO="NONE"on for the column's base table. At any given time, you can MOREINFO="NONE"set identity_insert on for one table in a database.REMAP="BO--Body"When MOREINFO="NONE"identity_insert is turnedMOREINFO="NONE" on, each insert statement for the table must include a column list. The values list must specify an explicit IDENTITY column value.REMAP="BO--Body"The following example enables explicit inserts to the sales_daily table and specifies a starting value of 101 for the IDENTITY column:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set identity_insert sales_daily oninsert into sales_daily (syb_identity, stor_id)values (101, "13-J-9")ID="IN447-37140114"IndexesIndexeson IDENTITY columnsIDENTITY columns
ID="IN4416-39142115"IDENTITY columnsunique values forREMAP="BO--Body"Unless you have created a unique index on the IDENTITY column, SQL Server does not verify the value's uniqueness before inserting it. You can insert any positive integer that falls within the column's range. This can cause gaps in IDENTITY column values.ID="IN4416-41144116"IDENTITY columnsretrieving last valueRetrieving IDENTITY Column Values with @@identityID="IN4426-44147120"@@identity global variableatatidentity global variable;identity global variableREMAP="BO--Body"Use the @@identity global variable to retrieve the last value inserted into an IDENTITY column. The value of @@ identity changes each time an insertMOREINFO="NONE", select into, orMOREINFO="NONE" bcp statement inserts a row into a table.MARK="BULL" REMAP="BU--Bullet"If the statement affects a table without an IDENTITY column, @@identity is set to 0. If the statement inserts multiple rows, @@identity reflects the last value inserted into the IDENTITY column. REMAP="BO--Body"This change is permanent. @@identity does not revert to its previous value if the insertMOREINFO="NONE", select into, orMOREINFO="NONE" bcp ID="IN4426-47150121"@@identity global variableatatidentity global variable;identity global variable
statement fails, or if the transaction that contains it is rolled back.ID="IN4416-49152122"IDENTITY columnsmaximum value ofReaching the Column's Maximum ValueREMAP="BO--Body"The maximum value that can be inserted into an IDENTITY column is 10 precision - 1. If you do not specify a precision for the IDENTITY column, SQL Server uses the default precision for numeric columns (18 digits).REMAP="BO--Body"Once an IDENTITY column reaches its maximum value, all further MOREINFO="NONE"insert statements return an error that aborts the current transaction.When this happens, use the MOREINFO="NONE"create MOREINFO="NONE"table statement to create a new table identical to the old, but with a larger precision for the IDENTITY column. Once you have created the new table, use the MOREINFO="NONE"insert statement or the MOREINFO="NONE"bcp utility to copy the data from the old table to the new.ID="IN4416-51154124"IDENTITY columnsbulk copy andBulk Copying a Table with an IDENTITY ColumnID="IN4423-55158127"bcp (bulk copy utility)IDENTITY columns andREMAP="BO--Body"By default, when you bulk copy data into a table with an IDENTITY column, MOREINFO="NONE"bcp assigns each row a temporary IDENTITY column value of 0. As it inserts each row into the table, the server assigns it a unique, sequential IDENTITY column value, beginning with the value 1. To enter an explicit IDENTITY column value for each row, specify theMOREINFO="NONE" -E(UNIX) or MOREINFO="NONE"/identity (OpenVMS) flag.REMAP="BO--Body"By default, when you bulk copy data from a table with an IDENTITY column,MOREINFO="NONE" bcp excludes all information about the column from the output file. To copy the existing IDENTITY column values into the output file, specify the MOREINFO="NONE"-E (UNIX) or MOREINFO="NONE"/identity (OpenVMS) flag. ID="IN445-58161129"ViewsIDENTITY columns and
Including an IDENTITY Column in a ViewID="IN4416-61164132"IDENTITY columnsviews andREMAP="BO--Body"You can define a view that includes an IDENTITY column by listing the column name, or theMOREINFO="NONE" syb_identity keyword, in the view's select_statement. You cannot add a new IDENTITY column to a view with the identity_column_nameMOREINFO="NONE" = identityMOREINFO="NONE"(precision) syntax.REMAP="BO--Body"The underlying column retains the IDENTITY property. When you update a row through the view, you cannot specify a new value for the IDENTITY column. When you insert a row through the view, SQL Server automatically generates a new, sequential value for the IDENTITY column. Only the table owner, Database Owner, or System Administrator can explicitly insert a value into the IDENTITY column after turningMOREINFO="NONE" identity_insert on for the column's base table. (Note: it is not sufficient to MOREINFO="NONE"set identity_insert on for the view.)REMAP="BO--Body"Although the column behaves like an IDENTITY column, SQL Server does not always recognize that it has the IDENTITY property. A view is considered not to have an IDENTITY column if it:MARK="BULL" REMAP="BU--Bullet"Joins columns from multiple tables orIncludes an aggregate function orSelects an IDENTITY column more than once orIncludes the IDENTITY column as part of an expression REMAP="BO--Body"Under these circumstances, you cannot use the MOREINFO="NONE"syb_identity keyword to select a column from the view. If you execute the MOREINFO="NONE"sp_help procedure on the view, all columns display an Identity value of 0, indicating that there is no IDENTITY column. REMAP="BO--Body"In the following example, the row_id column is not recognized as an IDENTITY column with respect to the store_discounts view because store_discounts joins columns from two tables:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create view store_discountsasselect stor_name, row_id, discountfrom stores, new_discountswhere stores.stor_id = new_discounts.stor_idID="IN4416-64167133"IDENTITY columnsviews and
ID="IN445-67170134"ViewsIDENTITY columns and
ID="IN4422-69172135"User-defined datatypesIDENTITY columns and
ID="IN4417-71174136"IDENTITY propertyuser-defined datatype specification andCreating a User-Defined Datatype with the IDENTITY PropertyREMAP="BO--Body"You can use the sp_addtype system procedure to create a user-defined datatype with the IDENTITY property. The new type must be based on a physical type of numeric with a scale of zero:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_addtype MOREINFO="NONE"typename, "numeric (precision , 0)", "identity"REMAP="BO--Body"The following example creates a user-defined type, IdentType, with the IDENTITY property:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_addtype IdentType, "numeric(4,0)", "identity"REMAP="BO--Body"When you create a column from an IDENTITY type, you can specify eitherMOREINFO="NONE" identity orMOREINFO="NONE" not null-or neither one-in the MOREINFO="NONE"create or MOREINFO="NONE"alter table statement. The column automatically inherits the IDENTITY property.REMAP="BO--Body"Following are three different ways to create an IDENTITY column from the IdentType user-defined type:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table new_table (id_col IdentType)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table new_table (id_col IdentType identity)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table new_table (id_col IdentType not null)If you try to create a null column from an IDENTITY type, the MOREINFO="NONE"create or MOREINFO="NONE"alter table statement fails.Creating IDENTITY Columns from Other User-Defined DatatypesREMAP="BO--Body"You can also create IDENTITY columns from user-defined datatypes that do not have the IDENTITY property. The user-defined types must have a physical datatype of numeric, a scale of zero, and must be defined asMOREINFO="NONE" not null. ID="IN4430-80183140"Gaps in IDENTITY column valuesgaps in values;Columns:gaps in IDENTITY valuesControlling Gaps in IDENTITY Column ValuesREMAP="BO--Body"IDENTITY column values can range from a low of 1 to a high of 10 column precision - 1. SQL Server divides the set of possible values into blocks of consecutive numbers, and makes one block of numbers at a time available in memory.REMAP="BO--Body"When assigning an IDENTITY column value, SQL Server draws the next available value from the block. Once all the values in the block have been used, SQL Server makes the next block available. Choosing the next IDENTITY value from a block of avidentityailable numbers improves server performance, but can lead to gaps in column values.Gaps Due to Server FailuresREMAP="BO--Body"Whenever SQL Server fails, it discards any remaining values in the current block. When you restart SQL Server, it makes the next block of numbers available for the IDENTITY column.REMAP="BO--Body"For example, a two-digit IDENTITY column can have values ranging from 1-99. SQL Server might make values 1-5 available for the first set of insertions: COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="72*"COLNAME="C2" COLWIDTH="144*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Potential IDENTITY Column ValuesVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 - 5COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6 - 99COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"availableCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"not yet availableMARK="BULL" REMAP="BU--Bullet"The first time you insert a row, SQL Server assigns the IDENTITY column a value of 1. The second time you insert a row, SQL Server assigns a value of 2. If SQL Server fails at this point, it discards the remaining numbers in the block (3, 4, and 5).When you restart SQL Server, it makes a new block of numbers (6 through 10) available: COLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="106*"COLNAME="C2" COLWIDTH="161*"COLNAME="C3" COLWIDTH="254*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Potential IDENTITY Column ValuesVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 - 5COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6 - 10COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"11 - 99COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"no longer availableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0" availableCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not yet availableThe next time you insert a row, SQL Server assigns the IDENTITY column a value of 6. The values 3, 4, and 5 are skipped.REMAP="BO--Body"You use the ID="IN4431-82185143"identity configuration variable
MOREINFO="NONE"identity burning set factor configuration variable to control the size of gaps resulting from server failure. This variable, which is set during installation, determines what percentage of the potential column values is contained in each block of available numbers. The default value, 5000, releases .05% of potential column values for use at a time. REMAP="BO--Body"System Administrators can reset theMOREINFO="NONE" identity MOREINFO="NONE"burning set factor variable using the MOREINFO="NONE"-y option of MOREINFO="NONE"buildmaster or the MOREINFO="NONE"sp_configure system procedure:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_configure "identity burning set factor", valueREMAP="BO--Body"Determine what percentage of available numbers
you want to make available at a time. This number should be high enough for good performance, but not so high that gaps are unacceptably large. Express the number in decimal form, then multiply it by  10,000,000 (10 raised to the power 7) to get the correct value for MOREINFO="NONE"sp_configure.REMAP="BO--Body"For example, to release 15% (.15) of the potential IDENTITY column values at a time, you specify a value of .15 times 107 (or 1,500,000) in MOREINFO="NONE"sp_configure:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_configure "identity burning set factor", 1500000REMAP="BO--Body"Then execute the MOREINFO="NONE"reconfigure command to implement the change.Gaps Due to Insertions, Deletions, and RollbacksREMAP="BO--Body"Manual insertions into the IDENTITY column, deletion of rows, and transaction rollbacks can all create gaps in IDENTITY column values. These gaps are not affected by the setting of theMOREINFO="NONE" identity burning set factor configuration variable. REMAP="BO--Body"For example, assume you have an IDENTITY column with the following values:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select syb_identity from stores_calREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC" id_col   -------       1       2       3       4       5 REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"(5 rows affected)REMAP="BO--Body"You can delete all rows for which the IDENTITY column falls between 2 and 4, leaving gaps in the column values:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"delete stores_calwhere syb_identity between 2 and 4REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select syb_identity from stores_calREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC" id_col   -------        1       5 REMAP="BO--Body"After turning MOREINFO="NONE"identity_insert on for the table, the table owner, Database Owner, or System Administrator can manually insert any legal value greater than 5. For example, inserting a value of 55 would create a large gap in IDENTITY column values:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert stores_cal (syb_identity, stor_id, stor_name)values (55, "5025", "Good Reads")REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select syb_identity from stores_calREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"id_col   -------        1       5      55REMAP="BO--Body"If MOREINFO="NONE"identity_insert is then turned off, SQL Server assigns an IDENTITY column value of 55 + 1, or 56, for the next insertion. If the transaction that contains the MOREINFO="NONE"insert statement is rolled back, SQL Server discards the value 56 and uses a value of 57 for the next insertion.ID="IN4430-91194144"Gaps in IDENTITY column valuesgaps in values;Columns:gaps in IDENTITY valuesStandards and ComplianceCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="196*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transact-SQL extensionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"transact-SQL extensionSee AlsoCommands     LINKEND="X68185"alter table
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X45593"delete
MOREINFO="NONE", LINKEND="X91835"insert
MOREINFO="NONE",  LINKEND="X35229"select
MOREINFO="NONE", LINKEND="X64136"set
MOREINFO="NONE", LINKEND="X54355"update
MOREINFO="NONE", LINKEND="X30827"where ClauseTopics     LINKEND="X84316"Datatypes
, LINKEND="X98459"Null ValuesSystem procedures     LINKEND="X29657"sp_dboption
ID="IN4416-98201148"IDENTITY columnsIDENTITY
 ID="IN445-100203149"JoinsID="X70715"JoinsID="IN457-101205151"Columnscomparing and concatenating
ID="IN456-102206152"Tablesjoins of
ID="IN455-103207153"Viewsjoins and
ID="IN4513-104208154"ConcatenationConcatenationof rows with matching valuesrows with matching values
ID="IN458-105209155"Matchingvalues in joins
Joins compare two or more tables (or views) by specifying a column from each, comparing the values in those columns row by row, and concatenating rows that have matching values. Joins can also be stated as subqueries. (See "LINKEND="X45943"Subqueries
" for more information.) FORMAT="LINESPECIFIC"ID="IN4525-105209157"Embedding join operationsREMAP="BO--Body"A join can be embedded in a MOREINFO="NONE"select, MOREINFO="NONE"update, MOREINFO="NONE"insert, MOREINFO="NONE"delete, or subquery. Other search conditions and clauses may follow the join condition(s). Joins use the following syntax:FORMAT="LINESPECIFIC"Start of MOREINFO="NONE"select, update, insert, delete, or MOREINFO="NONE"subquery MOREINFO="NONE"from {MOREINFO="NONE"table_listMOREINFO="NONE" | MOREINFO="NONE"view_listMOREINFO="NONE"} where [not]     [MOREINFO="NONE"table_name. | MOREINFO="NONE"view_name.]MOREINFO="NONE"column_name MOREINFO="NONE"                   join_operator     [MOREINFO="NONE"table_name. | MOREINFO="NONE"view_name.]MOREINFO="NONE"column_name[{and | or} [not]    [MOREINFO="NONE"table_name.|MOREINFO="NONE"view_name.]MOREINFO="NONE"column_name                  join_operator     [MOREINFO="NONE"table_name.|MOREINFO="NONE"view_name.]MOREINFO="NONE"column_name]...FORMAT="LINESPECIFIC"End ofMOREINFO="NONE" select, update, insert, delete, or MOREINFO="NONE"subquerySpecifying Which Tables and Views to JoinREMAP="BO--Body"UseID="IN4512-107211159"from keywordjoins
MOREINFO="NONE" from to specify which tables and views to join. All tables and/or views referenced elsewhere in the statement must be included in the MOREINFO="NONE"from clause.ID="IN4520-107211160"Number (quantity of)tables allowed in a query
ID="IN455-111215161"Viewsnumber allowed in a from clause;Number (quantity of):tables allowed in a query;Tables:number allowed in a from clauseREMAP="BO--Body" At most, a query can reference 16 tables. This maximum includes:MARK="BULL" REMAP="BU--Bullet"Tables (or views on tables) listed in the MOREINFO="NONE"from clauseEach instance of multiple references to the same table (self-joins)Tables referenced in subqueriesWork tables created as a result of the queryREMAP="BO--Body"The following example joins columns from the tiles and publishers tables, doubling the price of all books published in California:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update titles   set price = price * 2   from titles, publishers   where titles.pub_id = publishers.pub_id   and publishers.state = "CA"Determining Which Rows to Include in the ResultsREMAP="BO--Body"Use ID="IN4512-113217163"where clausejoins and
MOREINFO="NONE"where to determine which rows are included in the results. MOREINFO="NONE"where specifies the connection between the table(s) and view(s) named in the MOREINFO="NONE"from clause. Be sure to qualify column names if there is ambiguity about the table or view to which they belong. Joined Columns Must Have Comparable DatatypesID="IN457-113217165"Columnsjoins andREMAP="BO--Body"ID="IN4533-116220166"Column pairs. See Joins; KeysID="IN457-119223167"NestingNestingSee also Joins!see also JoinsID="IN4543-122226168"Pair of columns. See Common keys; JoinsID="IN4510-125229169"SubqueriesSubqueriesSee also Joins!see also JoinsID="IN4525-128232170"Fields, data. See ColumnsID="IN4526-131235171"Table columns. See ColumnsID="IN4527-134238172"Table rows. See Rows, tableID="IN459-134238173"DatatypesComparing valuesjoins;Comparing values:for joinsjoinsID="IN455-134238174"JoinsrestrictionsThe columns being joined must have the same or comparable datatypes. Use the MOREINFO="NONE"convert function when comparing columns whose datatypes cannot be implicitly converted. Joins cannot be used for columns containing text or image values. ID="IN4511-134238175"Theta joinstheta;Joins:operators forComparison OperatorsREMAP="BO--Body"Joins based on a comparison of scalar values are called theta joins. Theta joins use the following comparison operators: TOCENTRY="1"LBL="Table 3-18: "Comparison  operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="14*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE">COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"greater than COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"<COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"less than COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE">=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"greater than or equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"<=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"less than or equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"!=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"<>COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"!>COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not greater than COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"!<COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not less than ID="IN455-134238177"JoinsconnectingConnecting Join ExpressionsREMAP="BO--Body"You can use more than one join operator to join more than two tables or to join more than two pairs of columns. These "join expressions" are usually connected with ID="IN4511-136240179"and keywordand keywordin joinsjoins
MOREINFO="NONE"andID="IN4510-138242180"or keywordor keywordin joins joins
, although MOREINFO="NONE"or is also legal. REMAP="BO--Body"Following are two examples of joins connected byMOREINFO="NONE" and. The first lists information about books (type of book, author, and title), ordered by book type. Books with more than one author have multiple listings, one for each author.REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select type, au_lname, au_fname, title from authors, titles, titleauthor where authors.au_id = titleauthor.au_id and titles.title_id = titleauthor.title_id order by type REMAP="BO--Body"The second finds the names of authors and publishers that are located in the same city and state:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_fname, au_lname, pub_name from authors, publishers where authors.city = publishers.city and authors.state = publishers.state ID="IN4511-140244181"not keywordnot keywordin joinsjoinsUsing the not OperatorREMAP="BO--Body"The expression:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"notMOREINFO="NONE" column_name = MOREINFO="NONE"column_name REMAP="BO--Body"is equivalent to:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"column_name != column_nameEquijoinsREMAP="BO--Body"ID="IN459-140244184"Equijoinsequijoins
Joins based on equality ( MOREINFO="NONE"= ) are called equijoins. A natural join is an equijoin with only one of the matching columns displayed in the results. For example, the following join finds the names of authors and publishers that are located in the same city:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_fname, au_lname, pub_name from authors, publishers where authors.city = publishers.city Not Equal JoinsREMAP="BO--Body" ID="IN4526-145249186"Not equal joins (!= or <>)not-equal
The not equal join (MOREINFO="NONE"!= or MOREINFO="NONE"<>) is usually best used with a self-join. For each book in titles, the following example finds all other books of the same type that have a different price:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select titles.type, t1.title_id, t1.price, t2.title_id, t2.price from titles t1, titles t2 where t1.type = t2.type and t1.price != t2.price REMAP="BO--Body"Exercise caution when interpreting the results of a not equal join. For example, it would be easy to think you could find the authors that do not live in a city in which a publisher is located with a not equal join: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"/*Incorrect Statement*/    select distinct au_lname, authors.city    from publishers, authors    where publishers.city != authors.city REMAP="BO--Body"However, this query actually finds the authors who live in a city where someID="IN4510-145249187"Subqueriesjoins as;Joins:subqueries compared to
 publisher is not located-which is all of them. The correct SQL statement is a subquery: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"select distinct au_lname, authors.city from publishers, authors where authors.city not in (select city from publishers  where authors.city = publishers.city) ID="IN4510-145249188"Self-joinsdefinition of;Joins:self-joinsSelf-JoinsREMAP="BO--Body"Joins that compare values within the same column of one table are called self-joins. To distinguish the two roles in which the table appears, use aliases. ID="IN4511-145249190"Duplicationjoins without row;Names:finding non-duplicate in joinsREMAP="BO--Body"For example, the following join finds the authors with the same postal code as other authors, eliminating the rows where the author's name matches itself. It uses the aliases au1 and au2 for the authors table:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au1.au_fname, au1.au_lname, au2.au_fname, au2.au_lname from authors au1, authors au2 where au1.postalcode = au2.postalcode and (au1.au_lname + au1.au_fname) !=     (au2.au_lname + au2.au_fname) Outer JoinsID="IN456-145249192"Tablesinner;Inner table of an outer join
ID="IN458-145249193"Matchingrow (*= or =*), outer join
ID="IN4540-145249194"*= (asterisk equals) outer join operator
ID="IN4511-146250195"Outer joinsouterREMAP="BO--Body"Joins that include all rows regardless of whether there is a matching row are called outer joins. SQL Server supports both left and right outer joins.REMAP="BO--Body"The left outer joinMOREINFO="NONE", *=,  selects all rows from the first table that meet the statement's restrictions. The second table generates values if there is a match on the join condition. Otherwise, the second table generates null values. For example, the following left outer join lists all authors and finds the publishers (if any) in their city:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_fname, au_lname, pub_name from authors, publishers where authors.city *= publishers.city REMAP="BO--Body"The right outer joinID="IN4540-146250196"=* (equals asterisk) outer join operator
, MOREINFO="NONE"=*,  selects all rows from the second table that meet the statement's restrictions. The first table generates values if there is a match on the join condition. Otherwise, the first table generates null values. REMAP="BO--Body"A table is either an inner or an outer member of an outer join: if the join operator is MOREINFO="NONE"*= the second table is the inner table; if the join operator is MOREINFO="NONE"=* the first table is the inner table. You can compare a column from the inner table to a constant as well as using it in the outer join. For example, if you wanted to find out which title had sold more than 4,000 copies: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select qty, title from salesdetail, titleswhere qty > 4000 and titles.title_id *= salesdetail.title_idREMAP="BO--Body"However, the inner table in an outer join cannot also participate in a regular join clause. Comparison of NullsID="IN4511-146250198"Null valuesjoins and;Joins:null values andREMAP="BO--Body"Null values in tables or views being joined will never match each other. Since bit columns do not permit NULLs, a value of "0" appears in an outer join when there is no match for a bit column that is in the inner table. Join ViewsREMAP="BO--Body"If you define a view with an outer join, and then query the view with a qualification on a column from the inner table of the outer join, the results may be other than what you expect. All rows from the inner table are returned. Rows that do not meet the qualification show a NULL value in the appropriate columns of those rows. REMAP="BO--Body"The following rules determine what types of updates you can make to columns through join views:MARK="BULL" REMAP="BU--Bullet"ID="IN4517-148252200"Multi-table viewsdelete and
MOREINFO="NONE"delete statements are not allowed on join views.ID="IN455-150254201"Viewswith check option
MOREINFO="NONE"insertID="IN4517-152256202"Multi-table viewsinsert and
 statements are not allowed on join views created MOREINFO="NONE"with check option.ID="IN4514-154258203"update commandviews and;Multi-table views
MOREINFO="NONE"update statements are allowed on join views MOREINFO="NONE"with check option. The update fails if any of the affected columns appears in the MOREINFO="NONE"where clause, in an expression that includes columns from more than one table.If you insert or update a row through a join view, all affected columns must belong to the same base table.ID="IN4510-154258204"Subqueriesjoins asUsing Joins in Cursor DefinitionsID="IN457-154258206"CursorsCursorsin joinsjoinsREMAP="BO--Body"If you use a join in a cursor definition, you cannot MOREINFO="NONE"delete rows from the cursor result set, even if the cursor is updatable. Standards and ComplianceREMAP="BO--Body"Any statement that contains the join operators *= or =* is a Transact-SQL extension. See AlsoCommands     LINKEND="X45593"delete
MOREINFO="NONE", LINKEND="X91835"insert
MOREINFO="NONE", LINKEND="X35229"select
MOREINFO="NONE", LINKEND="X54355"update
MOREINFO="NONE", LINKEND="X30827"where ClauseFunctions     LINKEND="X13154"Datatype Conversion FunctionsTopics     LINKEND="X45943"SubqueriesSystem procedures     LINKEND="X90336"sp_helpjoins
ID="IN455-159263209"Joinsjoins of;Views:joins and;Matching:values in joins
ID="IN457-161265210"ColumnsConcatenationcomparing and concatenating;Concatenation:of rows with matching valuesrows with matching values
 ID="IN4516-163267211"Login managementID="X16582"Login ManagementID="IN465-166271213"Usersmanagement;Identities:users;Logins:management
ID="IN4636-169274214"Finding users. See Logins; Users
ID="IN469-172277215"IDs, userIDs, userSee also Logins!see also Logins
ID="IN4610-175280216"User namesUser namesSee also Database object owners; Logins!see also Database object owners; Logins
Mechanisms used to verify the identities of SQL Server users and to administer SQL Server login accounts.ID="IN4617-175280217"System proceduresSystem proceduresfor login managementlogin managementLogin Management System ProceduresREMAP="BO--Body"The following system procedures are used to manage SQL Server login accounts:TOCENTRY="1"LBL="Table 3-19: "System procedures for managing  login accountsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ProcedureCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"FunctionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addlogin  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Adds new user accounts to SQL Server . It allows you 
to specify the login name, password, default database, 
default language, and the user's full name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addremotelogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Authorizes an existing user on
another SQL Server to execute remote procedure calls to this SQL Server . COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_configurelogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Configures the password, clearance, minwrite, maxwrite, 
and maxread for a new SQL Server login.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_displaylogin  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays information about SQL Server login 
accounts.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_droplogin  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a SQL Sever login account. An account cannot be dropped if the owner is a user in any database on 
the server. It is recommended that accounts be locked 
rather than dropped.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropremotelogin  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a remote user's login.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpremotelogin  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information on a particular remote server's 
logins, or on all remote servers' logins.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_locklogin  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Locks or unlocks a SQL Server account so that the user 
cannot log in. Locked accounts can own objects and 
can be Database Owners.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_modifylogin  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allows you to add or modify a
SQL Server user's 
default database, default language, or full name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_password  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Changes a user's SQL password. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_serveroptionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays or changes server options. The MOREINFO="NONE"net password encryption option specifies that passwords are to be  
encrypted when sent across the network in remote 
procedure calls. The MOREINFO="NONE"timeouts option disables the 
normal timeout code used by the local server, so the 
site connection handler does not automatically drop 
the physical connection after a minute with no logical 
connection.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_trustlogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reconfigures boundary labels for  logins.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_whoCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays information about a
particular SQL Server user or all current SQL Server users and processes.ID="IN469-175280219"PasswordsPassword ManagementID="IN468-175280221"SecuritypasswordsREMAP="BO--Body"Management of passwords is essential to the security of any system. Password secrecy in SQL Server is ultimately the responsibility of the individual user, but the following features help to keep passwords confidential:MARK="BULL" REMAP="BU--Bullet"Passwords must be at least 6 bytes long. This is enforced by MOREINFO="NONE"sp_addlogin and MOREINFO="NONE"sp_password.User passwords are stored in master..syslogins in encrypted form, using an exportable one-way encryption algorithm.You can globally enforce password expiration using the MOREINFO="NONE"password MOREINFO="NONE"expiration interval option to MOREINFO="NONE"sp_configure. This variable sets the number of days that passwords remain in effect after they are changed. Users are warned before their passwords expire. Warnings begin when the number of days remaining before expiration is less than 25% of the value of MOREINFO="NONE"password MOREINFO="NONE"expiration interval or seven days, whichever is greater. When a user's password has expired, the user can log into SQL Server but cannot execute any commands until he or she has changed the password using MOREINFO="NONE"sp_password. See the System Administration Guide for more information.By setting the MOREINFO="NONE"net password encryption option to MOREINFO="NONE"sp_serveroption, you may choose to send either unencrypted passwords or client-side encrypted passwords across the network when executing remote procedure calls. Similarly, you can use the MOREINFO="NONE"isql encryption optionMOREINFO="NONE" (-X for UNIX, MOREINFO="NONE"/encrypt for OpenVMS) to establish password encryption between MOREINFO="NONE"isql and the server. See MOREINFO="NONE"sp_serveroption and the SQL Server Utility Programs for more information.If all System Security Officer passwords are lost or
forgotten, there is an option to the MOREINFO="NONE"dataserver command that generates a new password for a System Security Officer's account. See BOOK="unix" LINKEND="X76998"dataserver in the SQL Server Utility Programs for more information.See AlsoTopics     LINKEND="X96191"RolesSystem procedures     LINKEND="X25636"sp_addlogin
MOREINFO="NONE", LINKEND="X52745"sp_addremotelogin
MOREINFO="NONE", LINKEND="X60334"sp_configure
MOREINFO="NONE", LINKEND="X49053"sp_droplogin
MOREINFO="NONE", LINKEND="X85991"sp_dropremotelogin
MOREINFO="NONE", LINKEND="X98458"sp_locklogin
MOREINFO="NONE", LINKEND="X24535"sp_modifylogin
MOREINFO="NONE", LINKEND="X96621"sp_password
MOREINFO="NONE", LINKEND="X71283"sp_serveroptionUtility programsBOOK="unix" LINKEND="X76998"dataserver
BOOK="unix" LINKEND="X33269"isqlID="X98459"Null ValuesID="IN4369574"Blanksusing null or
ID="IN4369575"Zeroesusing NULL or
Nulls mark columns having an unknown value (as opposed to those that have 0 or blank as a value). NULL allows you to distinguish between a deliberate entry of zero (for numerical columns) or blank (for character columns) and a non-entry (NULL for both numerical and character columns). Declaring a Column's Null TypeREMAP="BO--Body"When you create a column, you specify either a null type or the IDENTITY property. The null type determines whether the column requires an explicit entry. Creating a New TableREMAP="BO--Body"In MOREINFO="NONE"create table statements, declare each columns as MOREINFO="NONE"null, MOREINFO="NONE"not null, orMOREINFO="NONE" identity or accept the default null type for the database: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"MOREINFO="NONE"     column_name MOREINFO="NONE"datatype [null | not null | identity]REMAP="BO--Body"ID="IN43129397"null keyword
MOREINFO="NONE"null ID="IN432090128"create table commandnull values and
indicates that no entry is required for the column. ID="IN431688149"not null keyword
MOREINFO="NONE"not null means that a user must provide a value for the column if no defined default value exists. By definition, columns with the IDENTITY property do not allow nulls.ID="IN4316861610"IDENTITY columnsnull values andREMAP="BO--Body"The default null type for a column in a MOREINFO="NONE"create table statement is to not allow nulls. To operate in ANSI "null mode," which requires that columns allow nulls by default, use MOREINFO="NONE"sp_dboption to set the MOREINFO="NONE"allow nulls by default option to MOREINFO="NONE"true.Adding a Column to an Existing TableREMAP="BO--Body"When adding a column to an existing table, you can specify it as MOREINFO="NONE"null or MOREINFO="NONE"identityID="IN4319841811"alter table commandnull values and
:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"MOREINFO="NONE"        column_name MOREINFO="NONE"datatype [null | identity]REMAP="BO--Body"When you add a column other than an IDENTITY column, SQL Server sets each existing row to NULLDisplaying a Column's Null TypeREMAP="BO--Body"The system procedure MOREINFO="NONE"sp_help reports the nulltype of a column (1 or 0, depending on whether or not the column accepts null values). Nulls Require Variable Length DatatypesREMAP="BO--Body"Only columns with variable-length datatypes can store null values. When you create a NULL column with a fixed-length datatype, SQL Server automatically converts it to the corresponding variable-length datatype. SQL Server does not inform you of the type change.REMAP="BO--Body"The following chart lists the fixed-length datatypes and the variable-length datatypes to which they are converted. Certain variable-length datatypes, such as moneyn, are reserved types; you cannot use them to create columns, variables, or parameters:TOCENTRY="1"LBL="Table 3-20: "Conversion of fixed-length to variable-length datatypesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="17*"COLNAME="C2" COLWIDTH="9*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Original Fixed-Length DatatypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Converted ToVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nchar COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nvarchar COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binary COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinary COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetimn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"float COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"floatn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int, smallint, and tinyint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimal COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimaln COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numeric COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numericn COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"money and smallmoney COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"moneyn ID="IN4310841814"Conversiondatatypes;Datatypes:convertingREMAP="BO--Body"These changes affect the handling of char, nchar, and binaryID="IN437841815"Columnslength definition;Columns:rules conflict with definitions of
ID="IN4323841816"Variable-length columnsnull values in;Columns:variable-length
ID="IN4313841817"Padding, datanull values and
 data. Data entered into these columns follow the rules for variable-length columns, rather than being padded with spaces or zeros to the full length of the column specification.Testing a Column for Null ValuesREMAP="BO--Body"UseMOREINFO="NONE" is null in MOREINFO="NONE"where, MOREINFO="NONE"if, and MOREINFO="NONE"while clauses to compare column values to NULL and to select them or perform a particular action based on the results. Only columns that return a value of TRUE are selected or result in the specified action; those that return FALSE or UNKNOWN do not. REMAP="BO--Body"The following example selects only rows for which advance is $5000 or null:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select title_id, advance from titles where advance < $5000 or advance is nullComparisons that Return TRUEREMAP="BO--Body"In general, the result of comparing null values is UNKNOWN, since it is not possible to determine if NULL is equal (or not equal) to a given value or to another NULL.ID="IN4310841819"Retrievingnull values
 There are three exceptions. The following cases return TRUE when expression is any column, variable or literal, or combination of these, which evaluates as NULL:MARK="BULL" REMAP="BU--Bullet"expression MOREINFO="NONE"is [not] null expression = MOREINFO="NONE"null and expression != MOREINFO="NONE"nullexpression = @x and expression != @x, where @x is a variable or parameter containing NULLID="IN4311841820"Null valuesdefault parameters as
. This exception facilitates writing stored procedures with null default parameters.REMAP="BO--Body"Note that the right-hand side of all of these exceptions is a literal null, or a variable or parameter containing NULL. If the right hand side of the comparison is an expression (such as @nullvar + 1), the entire expression evaluates to NULL.ID="IN435841821"Joinsnull column values and
ID="IN4312822022"where clausenull values in aREMAP="BO--Body"Following these rules, null column values do not join with other null column values. Comparing null column values to other null column values in a MOREINFO="NONE"where clause always returns UNKNOWN for null values, regardless of the comparison operator, and the rows are not included in the results. For example, this query returns no result rows where column1 contains NULL in both tables (although it may return other rows):REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select column1 from table1, table2 where table1.column1 = table2.column1Difference Between FALSE and UNKNOWNREMAP="BO--Body"Although neither FALSE nor UNKNOWN returns values, there is an important logical difference between FALSE and UNKNOWN, because the opposite of false ("not false") is true. For example, "1 = 2" evaluates to false, and its opposite, "1 != 2", to true. But "not unknown" is still unknown. If null values are included in a comparison, you can't negate the expression to get the opposite set of rows or opposite truth value.Inserting a Null Value into a ColumnID="IN4314802224"insert commandnull/not null columns andREMAP="BO--Body"You can explicitly insert NULL into a column: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"       values({MOREINFO="NONE"expression | null}         [, {MOREINFO="NONE"expression | null}]...)REMAP="BO--Body"The following example shows two equivalent MOREINFO="NONE"insert statements. In the first statement, the user explicitly inserts a NULL into column t1. In the second, SQL Server provides a NULL value for t1 because the user has not specified an explicit column value:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table test (t1 char(10) null, t2 char(10) not null) REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"insert test values (null, "stuff") REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"insert test (t2) values ("stuff") Changing a Column's Value to NullID="IN4314782426"update commandnull values andREMAP="BO--Body"Use the MOREINFO="NONE"update statement to set a column value to NULL. It's syntax is: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"set MOREINFO="NONE"column_name = {MOREINFO="NONE"expression | null}         [, MOREINFO="NONE"column_name = {MOREINFO="NONE"expression | null}]...REMAP="BO--Body"The following example finds all rows in which the title_id is TC3218 and replaces the advance with NULL.REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update titles set advance = null where title_id = "TC3218" Declaring NULL as the Default for a ParameterID="IN4311742828"Null valuescreate procedure and;create procedure command:null values andREMAP="BO--Body"In the MOREINFO="NONE"create procedure statement, you can declare NULL as the default value for individual parameters: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"create procedure procedure_name         @MOREINFO="NONE"param MOREINFO="NONE"datatype [ = null ]        [, @MOREINFO="NONE"param MOREINFO="NONE"datatype [ = null ]]...REMAP="BO--Body"The following example creates a stored procedure, and assigns the parameter @id a default value of NULL:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create procedure myproc @id varchar(6) = nullasselect title_id, pub_id from titles where title_id = @idREMAP="BO--Body"For information on NULL as a parameter default, see "LINKEND="X52197"create procedure
". Substituting a Value for NullsID="IN4322713130"isnull system functionREMAP="BO--Body"Use the MOREINFO="NONE"isnull built-in function to substitute a particular value for nulls. The substitution is made only for display purposes; actual column values are not affected. The syntax is: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"MOREINFO="NONE"      isnull(MOREINFO="NONE"expression, MOREINFO="NONE"value) REMAP="BO--Body"For example, use the following statement to select all the rows from test, and display all the null values in column t1 with the value unknown. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select isnull(t1, "unknown") from testID="IN4315693331"is null keywordREMAP="BO--Body"If you use MOREINFO="NONE"is null or "= NULL" to try to find null values in columns defined as MOREINFO="NONE"not null, SQL Server generates an error message.Rules and Null ValuesREMAP="BO--Body"It is not possible to define a column to allow nulls, and then to override this definition with a rule that prohibits null values. For example, if a column definition specifies NULL and the rule specifies this:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"@val in (1,2,3)REMAP="BO--Body"an implicit or explicit NULL does not violate the rule. The column definition overrides the rule, even a rule that specifies:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"@val is not nullDefaults and Null ValuesID="IN437693334"Columnsnull values and default;Null values:null defaults andREMAP="BO--Body"If you specify NOT NULL when you create a column and do not create a default for it, an error message occurs when a user fails to make an entry in that column during an insert. In addition, the user cannot MOREINFO="NONE"insertID="IN4314673535"update commandnull values and
 or MOREINFO="NONE"update such a column with NULL as a value. The following table illustrates the result of the relationship between the existence of a default and the definition of a column as NULL or NOT NULL The three possible results are: a null value for the column; the default value for the column or an error message.TOCENTRY="1"LBL="Table 3-21: "Column definition and null defaultsCOLS="5" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"COLNAME="C4" COLWIDTH="1*"COLNAME="C5" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column 
DefinitionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"No Entry,
No DefaultCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"No Entry, 
DefaultCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enter NULL, 
No DefaultCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enter NULL, 
DefaultVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"null valueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"default valueCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"null valueCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"null valueCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULLCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"errorCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"default valueCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"errorCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"errorREMAP="BO--Body""No Entry" means that the MOREINFO="NONE"insert statement has a column list which does not include the column.text and image ColumnsREMAP="BO--Body"ID="IN4313653738"text datatypeinitializing with null values
textID="IN4314614139"image datatypeinitializing with null values;image datatype:null values in
 and image columns created with MOREINFO="NONE"insert and NULLID="IN4311594340"Permissionsreadtext and column
 are not initialized and contain no value. They do not use storage space and cannot be accessed with MOREINFO="NONE"readtextID="IN4311574541"Permissionswritetext and column
 or MOREINFO="NONE"writetext. However, when a NULL value is written in a text or imageID="IN4314554742"update commandnull values and
 column with MOREINFO="NONE"update, the column is initialized, a valid text pointer to the column is inserted into the table, and a 2K data page is allocated to the column. Once the column is initialized, it can be accessed by MOREINFO="NONE"readtext and MOREINFO="NONE"writetext. See"LINKEND="X39672"text and image Datatypes
" for more information. Using the "null" Character StringREMAP="BO--Body"Only columns for which NULLID="IN4320525044"create table commandnull values and
 was specified in the MOREINFO="NONE"create table statement and into which you have explicitly entered NULLID="IN4319525045"Character datatypesavoiding Ò NULLÓ  in
ID="IN4332525046"Null string in character columns
 (no quotes), or into which no data has been entered, contain null values. Avoid entering the character string "NULLID="IN4338525047"Ò N/AÓ , using Ò NULLÓ  orN/A, using NULL or
" (with quotes) as data for a character column. It can only lead to confusion. Use "N/AID="IN4339525048"Ò noneÓ , using Ò NULLÓ  ornone, using NULL or
," "none," or the like instead. When you want to enter the value NULLID="IN4319525049"Explicit null value
 explicitly, do not use single or double quotes. Nulls versus the Empty StringID="IN4329525051"Empty string (" ") or (' ')not evaluated as null;Spaces, character:empty strings (" ") or (' ') as
ID="IN4321525052"" " (quotation marks)Quotation marks (" ")enclosing empty strings;Quotation marks (" "):for empty stringsempty stringsREMAP="BO--Body"The empty string (" "or ` ') is always stored as a single space in variables and column data. This concatenation statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC""abc" + "" + "def" REMAP="BO--Body"is equivalent to "abc def", not to "abcdef". The empty string is never evaluated as NULL. Aggregates and NullsID="IN4319525054"Aggregate functionsnull values andREMAP="BO--Body"By default, the MOREINFO="NONE"ansinull option is set MOREINFO="NONE"offID="IN4327505255"count(*) aggregate functionincluding null values
. Aggregates ignore null values, except MOREINFO="NONE"count(*), which includes them. For example, in the calculation MOREINFO="NONE"avg(advance), null values in the advance column are not counted, either in calculating the total amount or the number of values. REMAP="BO--Body"For SQL92 compliance, MOREINFO="NONE"set ansinull on. Aggregates that encounter nulls generate a warning.ID="IN4315485457"group by clausenull values and
group by Clauses and NullsREMAP="BO--Body"When the MOREINFO="NONE"group by clause is used, null values form their own group.order by Clauses and NullsID="IN4311485460"Null valuesOrdersort order of;Order:of null valuesnull valuesREMAP="BO--Body"With MOREINFO="NONE"order by, null values come before all others. select distinct and NullsID="IN4314426063"select commandselect commandwith distinct, null values anddistinct, null values and
ID="IN4316386464"distinct keywordselect, null values andREMAP="BO--Body"In a MOREINFO="NONE"select clause with the keyword MOREINFO="NONE"distinctID="IN4311386465"Duplicationnull values considered as
, which only selects unique rows, null values are considered duplicates of each other. Only one NULL is selected, no matter how many are encountered. Subqueries That Return No ValuesID="IN4310386467"Subqueriesnull values andREMAP="BO--Body"The result of a subquery that returns no values is NULL. If a subquery returns NULL, the query failed. Inserting Nulls into Columns That Do Not Allow ThemID="IN4314366669"insert commandnull/not null columns and
ID="IN4311366670"Null valuesinserting substitute values forREMAP="BO--Body"To insert data with MOREINFO="NONE"select from a table that has null values in some fields into a table that does not allow null values, you must provide a substitute value for any NULL entries in the original table. For example, to insert data into an advancesID="IN436366671"Zeroesusing NULL or
 table that won't allow null values, this example substitutes "0" for the NULL fields:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert advancesselect pub_id, isnull(advance, 0) from titlesID="IN436346872"Tablesisnull system function and
ID="IN4322307273"isnull system functioninsert andREMAP="BO--Body"Without the MOREINFO="NONE"isnull function, this command would insert all the rows with non-null values into advances, and produce error messages for all the rows where the advance column in titles contained NULL.REMAP="BO--Body"If this kind of substitution cannot be made for your data, it is not possible to insert the data containing null values into the columns with the NOT NULL specification.ID="IN4314307275"Literal valuesnull
Expressions That Evaluate to NullID="IN4311307277"Null valuesnew rules and column definition;Rules:column definition conflict with
ID="IN4311307278"Expressionsincluding null valuesREMAP="BO--Body"An expression with an arithmetic or bitwise operator evaluates to NULL if any of the operands are null. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"1 + column1REMAP="BO--Body"evaluates to NULL if column1 is NULL. See AlsoCommands     LINKEND="X52197"create procedure
, LINKEND="X80969"create table
, LINKEND="X96182"group by and having Clauses
, LINKEND="X91835"insert
, LINKEND="X35229"select
, LINKEND="X54355"updateFunctions     LINKEND="X79130"Aggregate FunctionsTopics     LINKEND="X45943"Subqueries
, LINKEND="X29354"text and image FunctionsSystem procedures     LINKEND="X91431"sp_help
ID="IN4311287480"Null values
ID="IN437277581"Resultsnull value operations and
ID="IN4311257782"Null values
ID="IN437247883"Resultsnull value operations and
 ID="IN4321218184"Parameters, procedureparametersID="X72999"ParametersID="IN449218286"Argumentsstored procedures (parameters)
Parameters are arguments to a stored procedure. You define parameters when you create the procedure and supply their values when you execute the procedure. Not all procedures require parameters.Declaring Procedure ParametersREMAP="BO--Body"You declare procedure parameters in the MOREINFO="NONE"create procedure statement. The declaration must include the parameter name and datatype and can include other optional information:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"create procedure [MOREINFO="NONE"owner.]MOREINFO="NONE"procedure_name[;number][ [(] @MOREINFO="NONE"parameter_name MOREINFO="NONE"datatype [= MOREINFO="NONE"default] [output]     [,@MOREINFO="NONE"parameter_name MOREINFO="NONE"datatype [=MOREINFO="NONE" default] [output]]     ... [)] ][with recompile] as MOREINFO="NONE"SQL_statements Parameter NamesREMAP="BO--Body"Parameter names must be preceded by the "@" symbol and conform to the rules for identifiers. Enclose any parameter value that includes punctuation (such as an object name qualified by a database name or owner name) in single or double quotes. REMAP="BO--Body"Parameter names are local to the procedure; the same parameter names can be used in multiple procedures. Parameter DatatypesREMAP="BO--Body"Parameters can have any datatype except text or image. Some datatypes expect a length or precision and scale in parentheses. See the "LINKEND="X84316"Datatypes
" section for a list of SQL Server-supplied datatypes and their syntax.Default Parameter ValuesREMAP="BO--Body"ID="IN448218288"Defaultsprocedure parameter
To make a parameter optional, specify a default value. Users can execute the procedure without specifying an explicit value for that parameter. REMAP="BO--Body"The default must be a constant. It can include wildcard characters (%, _, [], and [^]) if the procedure uses the parameter name with the keyword MOREINFO="NONE"like. REMAP="BO--Body"The default can be NULL. The procedure definition can specify that some action be taken if the parameter value is NULL. See LINKEND="X52197"create procedure
 for examples. Output ParametersID="IN4413178689"output optionreturn parameter;Return parameters:output keywordREMAP="BO--Body"Use theMOREINFO="NONE" output keyword for return parameters. When the procedure is executed, these parameters return their values to the calling procedure or batch. See LINKEND="X30305"execute
 for more information. Specifying Parameter ValuesREMAP="BO--Body"You specify parameter values when you execute the stored procedure:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"[execute] [@return_status = ][[server.]MOREINFO="NONE"database.]MOREINFO="NONE"owner.]MOREINFO="NONE"procedure_name[;MOREINFO="NONE"number][[@MOREINFO="NONE"parameter_name =] MOREINFO="NONE"value |     [@MOREINFO="NONE"parameter_name =] @MOREINFO="NONE"variable [output] [,[@MOREINFO="NONE"parameter_name =] MOREINFO="NONE"value |     [@MOREINFO="NONE"parameter_name =] @MOREINFO="NONE"variable [output]... ]] [with recompile] REMAP="BO--Body"The value can be a constant or the name of a database object such as a table or column. It cannot be of type text or image.Specifying Values by NameREMAP="BO--Body"You can specify parameter values in any order using the parameter_name = value syntax. If a parameter has a default, you do not need to specify its value.REMAP="BO--Body"The following procedure shows the datatype of any column. Here, the procedure displays the datatype of the qty column from the salesdetail table. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create procedure showtype @tabname varchar(18), @colname varchar(18) as   select syscolumns.name, syscolumns.length,   systypes.name   from syscolumns, systypes, sysobjects   where sysobjects.id = syscolumns.id   and @tabname = sysobjects.name   and @colname = syscolumns.name   and syscolumns.type = systypes.typeREMAP="BO--Body"When the procedure is executed, the @tabname and @colname values can be given in a different order from the MOREINFO="NONE"create procedure statement if they are specified by name:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"exec showtype @colname = qty , @tabname = salesdetail Specifying Values by OrderREMAP="BO--Body"If you omit the parameter names, you must supply them in the order in which they were defined in the MOREINFO="NONE"create procedure statement. Use commas between parameter values. In the following example, the values for @tabname and @colname are specified without names but in the same order as in the MOREINFO="NONE"create procedure statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"exec showtype salesdetail, qty REMAP="BO--Body"If a parameter has a default, you do not need to specify its value. Use a comma for each optional parameter whose value you do not specify. ID="IN4413178691"Return statusstored procedure;Stored procedures:return statusReturning an Execution StatusREMAP="BO--Body"Use @return_status = ID="IN4417178692"Calling procedurereturn parameter
to return an execution status to the calling procedure or batch. The execution status can be a SQL Server-supplied value or a value supplied by the user in a MOREINFO="NONE"return command. ID="IN4411178693"PunctuationPunctuationin parameter values;Quotation marks (" "):enclosing punctuation;" " (quotation marks):enclosing punctuationparameter valuesStandards and ComplianceREMAP="BO--Body"Stored procedures and their parameters are Transact-extensions. See AlsoCommands     LINKEND="X52197"create procedure
MOREINFO="NONE", LINKEND="X40303"declare
MOREINFO="NONE", LINKEND="X21497"drop procedure
MOREINFO="NONE", LINKEND="X30305"executeTopics     LINKEND="X84316"Datatypes
, LINKEND="X44102"Variables (Local and Global)
ID="IN4421148996"Parameters, procedureparameters
) ID="IN445129197"RolesID="X96191"RolesID="IN452599599"Accountability. See Roles
Roles provide individual accountability for users performing system administration and security-related tasks in SQL Server.About RolesREMAP="BO--Body"Individual server login accounts can be granted specific roles. When a user with the System Administrator role logs in, he or she can perform system administration tasks that can then be audited and attributed to the individual login.REMAP="BO--Body"The roles are:ID="IN455995101"RolesSystem Administrator;System Administrator
ID="IN455995102"RolesSystem AdministratorMARK="BULL" REMAP="BU--Bullet"System Administrator (MOREINFO="NONE"sa_role), required for system administration tasks such as:MARK="DASH" REMAP="BS--BulletSub"Installing SQL ServerManaging disk storageGranting permissions to SQL Server usersTransferring bulk data between SQL Server and other software programsModifying, dropping, and locking server login accountsMonitoring SQL Server's automatic recovery procedureDiagnosing system problems and reporting them as appropriateFine-tuning SQL Server by changing the configurable system parametersCreating user databases and granting ownership of themGranting and revoking the System Administrator roleSetting up groups (which are convenient in granting and revoking permissions) REMAP="UN--Under"SQL Server does no permission checking on objects accessed by System Administrators. In addition, a System Administrator becomes the Database Owner in any database he or she is using by assuming user ID 1.ID="IN455995103"RolesSystem Security Officer
ID="IN4523995104"System Security OfficerSystem Security Officer (MOREINFO="NONE"sso_role), required for security-related tasks such as:MARK="DASH" REMAP="BS--BulletSub"Creating server login accountsGranting and revoking the System Security Officer and Operator rolesChanging the password of any accountSetting the password expiration intervalManaging the audit systemREMAP="UN--Under"A System Security Officer is not exempt from permission checking, and is not automatically treated as Database Owner in any database he or she is using.ID="IN458995105"OperatorOperator
Operator (MOREINFO="NONE"oper_role), used to back up and restore databases on a server-wide basis. These operations can be performed in a single database by the Database Owner,j or by a System Administrator. The Operator role allows a single user to back up and restore multiple databases without having to be a user in each one.REMAP="BO--Body"More than one login account on a SQL Server can be granted any role, and one login can be granted more than one role.REMAP="BO--Body"The system procedures MOREINFO="NONE"sp_droplogin, MOREINFO="NONE"sp_locklogin, and MOREINFO="NONE"sp_role ensure that there is always at least one unlocked login account that has been granted the System Security Officer role, and one that has been granted the System Administrator role. You cannot lock or drop the last remaining System Security Officer or System Administrator login.Role ManagementGranting and Revoking Roles to UsersREMAP="BO--Body"Roles are granted to and revoked from individual users with the MOREINFO="NONE"sp_role system procedure. Only a System Administrator can grant the System Administrator role, and only a System Security Officer can grant the System Security Officer and Operator roles.Roles and Stored ProceduresREMAP="BO--Body"You can use the MOREINFO="NONE"grant execute command to grant execute permission on a stored procedure to all users who have been granted a specified role. Similarly, MOREINFO="NONE"revoke execute removes this permission.REMAP="BO--Body"However, MOREINFO="NONE"grant execute permission does not prevent users who do not have the specified role from being granted execute permission on a stored procedure. If you want to ensure, for example, that all users who are not System Administrators can never be granted permission to execute a stored procedure, you can use the MOREINFO="NONE"proc_role system function within the stored procedure itself. It checks to see whether the invoking user has the correct role to execute the procedure. See "LINKEND="X80972"System Functions
" for more information.Enabling and Disabling Roles in a SessionREMAP="BO--Body"The MOREINFO="NONE"role option of the MOREINFO="NONE"set command allows you to turn a specified role on or off for your current session. When you log in, all roles that have been granted to you are enabled. If, for example, you have been granted the System Administrator role, you assume the identity of Database Owner in any database you use. You may want to disable your System Administrator role at times and assume your "real" user identity instead, using this command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set role "sa_role" offDisplaying Role InformationMARK="BULL" REMAP="BU--Bullet"The MOREINFO="NONE"sp_displaylogin system procedure displays information about a server login, including server user ID, name, roles granted to the login, date of last password change, and whether the login is locked.The MOREINFO="NONE"show_role system function returns the user's current active roles, if any. See "LINKEND="X80972"System Functions
" for more information.ID="IN458995107"CommandsrolesCommands Requiring Specific RolesREMAP="BO--Body"The following tables list SQL commands and system procedures that require the user who is executing them to have a particular role (System Administrator, System Security Officer, or Operator) or status (Database Owner, table owner).ID="IN454995109"Listcommands requiring roles
ID="IN455896110"Rolescommands requiring, list ofSQL Commands that Require RolesTOCENTRY="1"LBL="Table 3-22: "Roles required for SQL commandsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="13*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommandsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Required Role or User Status VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"alter databaseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create databaseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or permission granted with MOREINFO="NONE"grantCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SomeMOREINFO="NONE" dbcc commandsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA, Database Owner, table ownerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk init
MOREINFO="NONE"disk refit
MOREINFO="NONE"disk reinitCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk mirror
MOREINFO="NONE"disk uremirror
MOREINFO="NONE"disk unmirrorCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop databaseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump database
MOREINFO="NONE"dump transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Operator or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"grant all
MOREINFO="NONE"grant create database
MOREINFO="NONE"grant with grant optionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or object owner
SA
SA or object ownerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"killCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load database
MOREINFO="NONE"load transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Operator or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"reconfigureCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"revoke all
MOREINFO="NONE"revoke create databaseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or object owner
SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"setuserCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"shutdownCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"update statisticsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or table ownerSystem Procedures that Require Specific RolesTOCENTRY="1"LBL="Table 3-23: "Roles required for system proceduresCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="17*"COLNAME="C2" COLWIDTH="23*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"System ProceduresCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Required Role or User StatusVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addaliasCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addgroupCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addlanguageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addremoteloginCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addsegmentCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addumpdeviceCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_adduserCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditdatabaseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSOCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditobjectCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSO COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditoptionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSO COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditsprocCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSO COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditloginCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSO COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_changedbownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_changegroupCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_clearstatsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_configure  without parameters
MOREINFO="NONE"  general updates options
MOREINFO="NONE"  allow updates option
MOREINFO="NONE"  audit queue size option
MOREINFO="NONE"  passwordexp optionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"
any user
SA 
SSO 
SSO 
SSO COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_configurelogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSOCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dboption   without parameters
  with parametersCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"
any user
SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_diskdefaultCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_displayloginCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA, SSO, or account ownerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropaliasCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropdeviceCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropgroupCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_droplanguageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_droploginCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropmessageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA, Database Owner, or object ownerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropremoteloginCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropsegmentCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropserverCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSOCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropuserCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_extendsegmentCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_lockloginCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSO or SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_logdeviceCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA or Database OwnerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_modifyloginCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_monitorCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_passwordCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSO or account ownerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_placeobjectCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA, Database Owner, table ownerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_remoteoption with 
parametersCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSOCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_renameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SA, Database Owner, object ownerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_renamedbCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_reportstatsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_roleCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSO for SSO and Oper. roles; SA for SA roleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_serveroption  MOREINFO="NONE"net password encryption 
option
 MOREINFO="NONE"timeouts optionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"
SSO
SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_setlangaliasCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_sortorderCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SACOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sp_sproclabelsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSOCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sp_trustloginCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SSOID="IN455797111"Rolescommands requiring, list ofSee AlsoCommands     LINKEND="X69087"grant
MOREINFO="NONE", LINKEND="X29921"revoke
MOREINFO="NONE", LINKEND="X64136"setFunctions     LINKEND="X80972"System FunctionsSystem procedures     LINKEND="X60334"sp_configure
MOREINFO="NONE", LINKEND="X68664"sp_displaylogin
MOREINFO="NONE", LINKEND="X98458"sp_locklogin
MOREINFO="NONE", LINKEND="X39296"sp_role
ID="IN455599113"RolesREMAP="BO--Body"Search Conditions
Search condition set the conditions in a MOREINFO="NONE"where or MOREINFO="NONE"having clause. (Joins and subqueries are specified in the search conditions: see the "LINKEND="X70715"Joins
" and "LINKEND="X45943"Subqueries
ID="IN43249573"Finding database objectsFinding database objectsSee also Retrieving; Search conditions!see also Retrieving; Search conditions
ID="IN431090124"RetrievingRetrievingSee also Search conditions; select command!see also
ID="IN43090125"
ID="IN431785176"Search conditionsSearch conditionsSee also like keyword; Retrieving!see also
" sections for full details.) Using Search ConditionsREMAP="BO--Body"Search conditions immediately follow the keywords MOREINFO="NONE"where or MOREINFO="NONE"having in a MOREINFO="NONE"select, insert, update, or MOREINFO="NONE"delete statement. A MOREINFO="NONE"where clause can include a maximum of 128 search conditions per table.MOREINFO="NONE"Comparing MOREINFO="NONE"where and havingID="IN431377258"having clausedifference from where clause;where clause:difference from having clauseREMAP="BO--Body"MOREINFO="NONE"having search conditions differ from MOREINFO="NONE"where search conditions only in that aggregate functions are not allowed in MOREINFO="NONE"where clauses:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"having avg(price) > $20REMAP="BO--Body"is legal;REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where avg(price) > $20REMAP="BO--Body"is not. See "LINKEND="X79130"Aggregate Functions
" for information on the use of aggregate functions. MOREINFO="NONE"having Without MOREINFO="NONE"group byID="IN431773299"Search conditionsgroup by and having queryREMAP="BO--Body"You can use a MOREINFO="NONE"having clause without a MOREINFO="NONE"group by clause. REMAP="BO--Body"If there are columns in the select list that neither have aggregate functions applied to them nor are included in the query's MOREINFO="NONE"group by clause (illegal in standard SQL), the meanings of MOREINFO="NONE"having and MOREINFO="NONE"where are somewhat different. REMAP="BO--Body"In this situation, a MOREINFO="NONE"where clause restricts the rows that are included in the calculation of the aggregate, but does not restrict the rows returned by the query. Conversely, a MOREINFO="NONE"having clause restricts the rows returned by the query, but does not affect the calculation of the aggregate. See "LINKEND="X96182"group by and having Clauses
" for examples. Expressions in Search ConditionsREMAP="BO--Body"Search conditions with expressions use the following format:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not]MOREINFO="NONE"expression MOREINFO="NONE"comparison_operator MOREINFO="NONE"expression REMAP="BO--Body"See LINKEND="X20204""Expressions" for an explanation of expression and the available comparison_operators.Negating ExpressionsREMAP="BO--Body"ID="IN4311713112"not keywordsearch conditions
MOREINFO="NONE"not can negate any logical expression and keywords such as MOREINFO="NONE"like, NULL, MOREINFO="NONE"between,MOREINFO="NONE" in, and MOREINFO="NONE"exists. REMAP="BO--Body"For example,REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where phone not like '415%' REMAP="BO--Body"Finds all the rows in which the phone number does not begin with 415. Using likeREMAP="BO--Body"The ID="IN4312693315"like keywordsearch conditions and
MOREINFO="NONE"like keyword indicates that the following character string (enclosed by single or double quotes) is a matching pattern. MOREINFO="NONE"like is available for char, varchar, and datetime columns (but not to search for seconds or milliseconds). Search conditions can specify the MOREINFO="NONE"like keyword in the following format:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not] MOREINFO="NONE"column_name [not] like  "MOREINFO="NONE"match_string" ID="IN4319693316"Wildcard characterssearch conditionsREMAP="BO--Body"The wildcards are: TOCENTRY="1"LBL="Table 3-24: "Wildcards used in match stringsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  %COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any string of 0 or more characters COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  _COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any single character COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  [ ]COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any single character within the specified range 
([a-f]) or set ([abcdef]) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  [^]COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"any single character not within the specified 
range ([^a-f]) or set ([^abcdef]) REMAP="BO--Body"The wildcard and the string must be enclosed in single or double quotes. For complete information, including information on using alternative character set definitions in wildcards, see "LINKEND="X18218"Wildcard Characters
." REMAP="BO--Body"The following example finds the rows for authors named Carson, Carsen, Karsen, and Karson. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where au_lname like "[CK]ars[eo]n" REMAP="BO--Body"You can use the keyword MOREINFO="NONE"like and wildcard characters with datetime data as well as with char, varchar and text. When you use MOREINFO="NONE"like with datetime values, SQL Server converts the dates to the standard datetime format, and then to varchar. Use the MOREINFO="NONE"convert function to display seconds and milliseconds. REMAP="BO--Body"It is a good idea to use MOREINFO="NONE"like when you search for datetime values, since datetime entries may contain a variety of date parts. For example, if you insert the value `9:20' into a column named arrival_time, the clause:REMAP="UI--UserInput" FORMAT="LINESPECIFIC" where arrival_time = `9:20' REMAP="BO--Body"would not find it because SQL Server converts the entry into "Jan 1, 1900 9:20AM." However, the clause:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where arrival_time like `%9:20%' REMAP="BO--Body"would find it. ID="IN4311693318"Null valuesNull valuesin search conditionssearch conditions
Using nullsREMAP="BO--Body"ID="IN4315693321"Not null valuessearch conditions
MOREINFO="NONE"is [MOREINFO="NONE"not] MOREINFO="NONE"null is used when searching for null values (or all values except null values). It is allowed only if the column has been defined to allow null values in the MOREINFO="NONE"create table statement. REMAP="BO--Body"An expression with a bitwise or arithmetic operator evaluates to NULL if any of the operands are null. REMAP="BO--Body"The general syntax is:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not] MOREINFO="NONE"column_name is [not] null REMAP="BO--Body"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where advance < $5000 or advance is null ID="IN435693322"RangeRangein search conditionssearch conditionsRangesREMAP="BO--Body"Specify ranges in search conditions as follows:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not] MOREINFO="NONE"expression [not] between MOREINFO="NONE"expression and MOREINFO="NONE"expression REMAP="BO--Body"ID="IN4315653724"between keywordsearch conditions;Range-start keyword, between
MOREINFO="NONE"betweenID="IN4311614125"and keywordand keywordin search conditions;Range-end keyword, andsearch conditions
 is the range-start keyword. Use MOREINFO="NONE"and for the range-end value. The range:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"between x and yREMAP="BO--Body"is inclusive, unlike the range:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"> x < y REMAP="BO--Body"For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where total_sales between 4095 and 12000 Matching ListsREMAP="BO--Body"The ID="IN4310594327"in keywordsearch conditions
MOREINFO="NONE"in keyword allows you to select values that match any one of a list of values. The expression can be a constant or a column name, and the values list can be a set of constants or, more commonly, a subquery. (See "LINKEND="X45943"Subqueries
" for information on using MOREINFO="NONE"in
 with a subquery.) REMAP="BO--Body"Enclose the list of values in parentheses. Put single or double quotes around char, varchar, and datetime values, and separate each value from the following one with a comma. The syntax is as follows:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not] MOREINFO="NONE"expression [not] in ({MOREINFO="NONE"value_list | MOREINFO="NONE"subquery}) REMAP="BO--Body"The following example finds the rows in which the state is one of the three in the list.REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where state in (`CA', `IN', `MD')Testing for ExistenceREMAP="BO--Body"The ID="IN4314574529"exists keywordsearch conditions
MOREINFO="NONE"exists keyword is used with a subquery to test for the existence of some result from the subquery. (See "LINKEND="X45943"Subqueries
" for more information.) The general syntax follows:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not] exists (MOREINFO="NONE"subquery) Using any and allREMAP="BO--Body"ID="IN4311554733"any keywordsearching with
MOREINFO="NONE"any is used with <, >, or = and a subquery. It returns results when any value retrieved in the subquery matches the value in the MOREINFO="NONE"where or MOREINFO="NONE"having clause of the outer statement. (See "LINKEND="X45943"Subqueries
" for more information.) REMAP="BO--Body"ID="IN4311534934"all keywordsearching with
MOREINFO="NONE"all is used with MOREINFO="NONE"< or MOREINFO="NONE"> and a subquery. It returns results when all values retrieved in the subquery match the value in the MOREINFO="NONE"where or MOREINFO="NONE"having clause of the outer statement. (See "LINKEND="X45943"Subqueries
" for more information.) REMAP="BO--Body"The syntax for MOREINFO="NONE"any and MOREINFO="NONE"all is:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not] MOREINFO="NONE"expression MOREINFO="NONE"comparison_operator {any |all} (MOREINFO="NONE"subquery) Join OperatorsREMAP="BO--Body"The syntax of join operators in search conditions is:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not] MOREINFO="NONE"column_name MOREINFO="NONE"join_operator MOREINFO="NONE"column_name REMAP="BO--Body"where join_operator is a comparison operator, MOREINFO="NONE"=*, or MOREINFO="NONE"*= (see "LINKEND="X70715"Joins
" for more information) and column_name is the name of a column used in the comparison. Qualify the name of the column if there is any ambiguity.Connecting Search ConditionsREMAP="BO--Body"If you use more than one of the search conditions in a single statement, connect the conditions with MOREINFO="NONE"and orMOREINFO="NONE" or. The syntax is:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not] MOREINFO="NONE"logical_expression {and | or} MOREINFO="NONE"logical_expression REMAP="BO--Body"ID="IN4311515137"and keywordand keywordin search conditionssearch conditions
MOREINFO="NONE"and joins two conditions and returns results when both of the conditions are true. REMAP="BO--Body"ID="IN4310495338"or keywordsearch conditions
MOREINFO="NONE"or joins two conditions and returns results when either of the conditions is true. REMAP="BO--Body"When more than one logical operator is used in a statement, MOREINFO="NONE"and operators are normally evaluated beforeMOREINFO="NONE" or operators. You can change the order of execution with parentheses. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where (type = "business" or type = "psychology") and advance > $5500 Standards and ComplianceCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="60*"COLNAME="C2" COLWIDTH="181*"COLNAME="C3" COLWIDTH="352*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StandardCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Compliance LevelCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CommentsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL89COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CompliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The following are Transact-SQL 
extensions:
name='bull' font='symbol' code='168'  charset='fontspecific' Modulo operator %
name='bull' font='symbol' code='168'  charset='fontspecific' Negative comparison operators !>, 
!<, and !=
name='bull' font='symbol' code='168'  charset='fontspecific' Bitwise operators ~, ^, |, and &
name='bull' font='symbol' code='168'  charset='fontspecific' Join operators *= and =*
name='bull' font='symbol' code='168'  charset='fontspecific' Wildcards [] and -
name='bull' font='symbol' code='168'  charset='fontspecific' Not operator ^COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"SQL92COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry level compliantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"See AlsoCommands     LINKEND="X45593"delete
MOREINFO="NONE", LINKEND="X30305"execute
MOREINFO="NONE", LINKEND="X91835"insert
MOREINFO="NONE", LINKEND="X35229"select
MOREINFO="NONE", LINKEND="X54355"updateFunctions     LINKEND="X79130"Aggregate FunctionsTopics     LINKEND="X20204"Expressions
, LINKEND="X70715"Joins
, LINKEND="X45943"Subqueries
, LINKEND="X18218"Wildcard CharactersSystem procedures     LINKEND="X90336"sp_helpjoins
ID="IN4317485442"Search conditions
ID="IN4310435943"Subqueriesnesting;Nesting:subqueries;Queries:nesting subqueriesID="X45943"Subqueries
Subqueries "nest" a MOREINFO="NONE"select statement inside a MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"delete statement, another subquery, or anywhere an expression is allowed (if it returns a single value). A subquery is always enclosed in parentheses. How to Define SubqueriesID="IN4415416246"order by clausenot allowed in subqueriesREMAP="BO--Body"You can use a subquery almost anywhere an expression can be used if it returns a single value. You must always enclose subqueries in parentheses. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select distinct pub_name from publisherswhere "business" in    (select type from titles    where pub_id = publishers.pub_id)REMAP="BO--Body"Subqueries cannot be used in an MOREINFO="NONE"order by list. text and image datatypes are not allowed in subqueries. Be sure to qualify column names with table or view names if there is ambiguity about the table or view to which they belong. REMAP="BO--Body"A subquery has this restricted MOREINFO="NONE"select syntax: REMAP="SY--Syntax" FORMAT="LINESPECIFIC"MOREINFO="NONE"(select [all | distinct] MOREINFO="NONE"subquery_select_list [from [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name | MOREINFO="NONE"view_name}    [holdlock] [, [[MOREINFO="NONE"database.]MOREINFO="NONE"owner.]{MOREINFO="NONE"table_name |MOREINFO="NONE" view_name}     [holdlock]]...] [where MOREINFO="NONE"search_conditions] [group by MOREINFO="NONE"aggregate_free_expression    [, MOREINFO="NONE"aggregate_free_expression]...][having MOREINFO="NONE"search_conditions])REMAP="BO--Body"The subquery_select_list is a restricted select_list for use with subqueries introduced with MOREINFO="NONE"in or a comparison operator. It consists of one expression. If a column name is used in the MOREINFO="NONE"where clause of the outer statement, a column name in the subquery_select_list must be join compatible with it. REMAP="BO--Body"The select_list must consist of only one column name, except in the MOREINFO="NONE"exists subquery, in which case the asterisk (*) is usually used in place of the single column name. Do not specify more than one column name. REMAP="BO--Body"See MOREINFO="NONE"select for more information on the other options. See "MOREINFO="NONE"where Clause" for more information on search conditions and MOREINFO="NONE"where clause syntax.ID="IN4421386547"Correlated subqueriesCorrelated subqueriesSee also Subqueries!see also Subqueries
ID="IN4442356848"Inner queries. See Nesting; Subqueries
ID="IN4429327149"Outer queries. See Subqueries
ID="IN4434297450"Repeating subquery. See SubqueriesREMAP="BO--Body"Many SQL statements that include subqueries can
be alternatively formulated as joins. See LINKEND="X70715""Joins" for more information on joining.Using Subqueries with Comparison OperatorsREMAP="BO--Body"The following is the syntax for using subqueries with comparison operators in a MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"delete statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"expression comparison_operator [any | all] (subquery)REMAP="BO--Body"An expression is a column name, a constant, a function, any combination of column names, constants, and functions connected by arithmetic or bitwise operators, or a subquery. (This and other formats for subqueries are considered expressions in and of themselves, and can be substituted wherever the word "expression" appears as long as the subquery returns a single value.) ID="IN4420297452"Arithmetic operatorssubqueries andREMAP="BO--Body"The arithmetic operators are:TOCENTRY="1"LBL="Table 3-25: "Arithmetic operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="9*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OperationVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"+COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"additionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"subtraction COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"/COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"divisionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"*COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"multiplicationCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"%COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"moduloREMAP="BO--Body"Addition, subtraction, division, and multiplication can be used on int, smallint, tinyint, float, and money columns. The modulo operator can be used with all integer datatypes, but cannot be used with money or float columns. A modulo is the integer remainder after a division involving two integers. For example, 21 % 9 = 3 because 21 divided by 9 equals 2 with a remainder of 3. ID="IN4417297453"Bitwise operatorssubqueries andREMAP="BO--Body"The bitwise operators are: TOCENTRY="1"LBL="Table 3-26: "Bitwise operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="19*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  &COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bitwise and (two operands) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  |COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bitwise or (two operands) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  ^COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bitwise exclusive or (two operands) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  ~COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bitwise not (one operand)REMAP="BO--Body"The bitwise operators can be used only on int, smallint, and tinyint columns. All the bitwise operators translate the integer arguments into binary representation before evaluating them. (See "LINKEND="X20204"Expressions
" for more information.) REMAP="BO--Body"The comparison_operator is one of the following items: TOCENTRY="1"LBL="Table 3-27: "Comparison operatorsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="13*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SymbolCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  =COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  >COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"greater than COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  <COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"less than COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  >=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"greater than or equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  <=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"less than or equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  !=COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  <>COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not equal to COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  !>COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not greater than COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"  !<COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"not less thanREMAP="BO--Body"In comparing char, nchar, varchar, and nvarchar data, MOREINFO="NONE"< means closer to the beginning of the alphabet and MOREINFO="NONE"> means closer to the end of the alphabet. Case and special character evaluations depend on the collating sequence of the machine on which SQL Server is located. REMAP="BO--Body"For example, lowercase letters may be greater than uppercase letters, and uppercase letters may be greater than numbers. In comparing dates, MOREINFO="NONE"< means earlier and MOREINFO="NONE"> means later. Trailing blanks are ignored for comparison purposes. For example, "Dirk" is the same as "Dirk  ". REMAP="BO--Body"Put quotes around all character and datetime data used with a comparison operator:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"= "Bennet"REMAP="UI--UserInput" FORMAT="LINESPECIFIC"> "94609"REMAP="BO--Body"subquery is a query with the restricted MOREINFO="NONE"select syntax shown at the beginning of this section. It cannot include MOREINFO="NONE"order by or MOREINFO="NONE"compute clauses or the keyword MOREINFO="NONE"into. The subquery select list must consist of only one column name, except in the MOREINFO="NONE"exists subquery, in which case the asterisk (*) is almost always used for the subquery select list.REMAP="BO--Body"A subquery can contain another subquery. A subquery is legal in any Transact-SQL syntax that allows an expression, as long as it returns a single value. REMAP="BO--Body"ID="IN4411257854"all keywordcomparison operators and;all keyword:subqueries using
The MOREINFO="NONE"all keyword is used with MOREINFO="NONE"> , MOREINFO="NONE"< , or MOREINFO="NONE"= and a subquery. MOREINFO="NONE"> MOREINFO="NONE"all means that the value being compared must be greater than all the values in the list (that is, greater than the maximum value). MOREINFO="NONE"< MOREINFO="NONE"all means that the value being compared must be less than all the values in the list (that is, less than the minimum value). MOREINFO="NONE"= MOREINFO="NONE"all means that the value being compared must be equal to all the values in the list.REMAP="BO--Body"The following example finds the books that commanded an advance greater than the largest advance paid by Algodata Infosystems:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select title from titles where advance > all   (select advance from titles, publishers    where titles.pub_id = publishers.pub_id    and pub_name = "Algodata Infosystems") REMAP="BO--Body"The ID="IN4411218255"any keywordsearching with;any keyword:subquery using
MOREINFO="NONE"any keyword is used with MOREINFO="NONE">, <, or MOREINFO="NONE"= and a subquery. MOREINFO="NONE"> MOREINFO="NONE"any is true (and the subquery returns results) if the value in the outer query is greater than any value in the list (that is, greater than the minimum value in the list). MOREINFO="NONE"< MOREINFO="NONE"any is true (and the subquery returns results) if the value in the outer query is less than any value in the list (that is, less than the maximum value in the list). REMAP="BO--Body"The following example finds the authors that live in the same city as some publisher:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_lname, au_fname from authors where city = any    (select city     from publishers) Using Subqueries with in and not inREMAP="BO--Body"The following is the syntax for using subqueries with the MOREINFO="NONE"in and MOREINFO="NONE"not in keywords in a MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"delete statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"expression [not] in (subquery)REMAP="BO--Body"The ID="IN4410198459"in keywordsubqueries
MOREINFO="NONE"in keyword returns results when any value in the subquery matches the value in the MOREINFO="NONE"where clause of the outer statement. (MOREINFO="NONE"in is equivalent to MOREINFO="NONE"= MOREINFO="NONE"any.) You can also use MOREINFO="NONE"in with a list of values enclosed in parentheses. See "LINKEND="X30827"where Clause
" for details. REMAP="BO--Body"The following example uses MOREINFO="NONE"in to find all the publishers that publish business books:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select distinct pub_name from publishers where pub_id in   (select pub_id from titles   where type = "business")REMAP="BO--Body"The next example uses MOREINFO="NONE"in to find the names of authors who have participated in writing at least one popular computing book (note that it nests one subquery within another):REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_lname, au_fname from authors where au_id in   (select au_id from titleauthor   where title_id in     (select title_id from titles     where type = "popular_comp")) ID="IN4414178660"not in keywordsubqueries usingREMAP="BO--Body"Subqueries introduced with MOREINFO="NONE"not MOREINFO="NONE"inID="IN447178661"Indexessubqueries using
 can take a long time to run, since they must examine the data in each row of the inner query. Indexes cannot return information about what is not in a table. REMAP="BO--Body"In contrast, subqueries introduced with MOREINFO="NONE"in can use indexes if they exist on the column, and can return results as soon as they find a single value that matches. For complex queries, frequently run queries, or large tables, you may want to find another way to express the query. Using Subqueries with existsREMAP="BO--Body"The following is the syntax for using subqueries with the MOREINFO="NONE"exists keyword in a MOREINFO="NONE"select, MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"delete statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"[not] exists (MOREINFO="NONE"subqueryMOREINFO="NONE") REMAP="BO--Body"ID="IN4410139064"Subqueriesexists keywordexists keyword in;exists keyword:in subqueriessubqueries
The MOREINFO="NONE"exists keyword is used with a subquery to test for the existence of some result from the subquery. MOREINFO="NONE"exists is not preceded by an expression. The subquery that follows the keyword MOREINFO="NONE"exists is enclosed in parentheses. If the MOREINFO="NONE"not option is used, the MOREINFO="NONE"where clause is satisfied if no rows are returned by the subquery. Since MOREINFO="NONE"exists tests only for the existence of a condition, the asterisk (*) is almost always used as the select list. REMAP="BO--Body"The following example also finds the names of publishers who have published business books using MOREINFO="NONE"exists:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select distinct pub_name from publishers where exists   (select * from titles    where pub_id = publishers.pub_id    and type = "business") REMAP="BO--Body"The syntax for MOREINFO="NONE"exists is somewhat different from the syntax for the other keywords; it does not take an expression between MOREINFO="NONE"where and itself. The following two queries, which are semantically equivalent, illustrate the difference: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select distinct pub_name from publishers where exists (select * from titles where pub_id = publishers.pub_id and type = "business") REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select distinct pub_name from publishers where pub_id in (select pub_id from titles where type = "business")Correlated SubqueriesID="IN4421139066"Correlated subqueriescorrelated or repeatingREMAP="BO--Body"A correlated (or repeating) subquery depends on the outer query for its values. It is executed repeatedly, once for each row that might be selected by the outer query. For example, the subquery in the following statement cannot be evaluated independently of the outer query. The value for authors.au_id changes as the outer query examines each row in authors: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"select distinct au_lname, au_fname from authors where 100 in MOREINFO="NONE"    (select royaltyper from titleauthor     where titleauthor.au_id = authors.au_id)ID="IN4413119267"having clausesubqueries in outer queryREMAP="BO--Body"A correlated subquery can also be used in the MOREINFO="NONE"having clause of an outer query. This example finds the types of books for which the maximum advance is more than twice the average for the group: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"select t1.type from titles t1 group by t1.type having max(t1.advance) >= all     (select 2 * avg(t2.advance) from titles t2     where t1.type = t1.type) ID="IN447119268"Cursorssubqueries andREMAP="BO--Body"You cannot use correlated subqueries in the MOREINFO="NONE"select clause of an updatable cursor defined by MOREINFO="NONE"declare cursor.See AlsoCommands     LINKEND="X45593"delete
, LINKEND="X30305"execute
, LINKEND="X96182"group by and having Clauses
, LINKEND="X91835"insert
, LINKEND="X35229"select
, LINKEND="X54355"update
, LINKEND="X30827"where Clause
ID="IN441069770"Subqueriesnesting;Nesting:subqueries;Queries:nesting subqueries
 Topics     LINKEND="X80039"Cursors
, LINKEND="X20204"Expressions
, LINKEND="X70715"JoinsID="X86056"Temporary TablesTwo Types of Temporary TablesID="IN4516410072"Temporary tablesREMAP="BO--Body"Temporary tables are created in the tempdb database, not the current database. To create a temporary table, you must have MOREINFO="NONE"create table permission in tempdbMOREINFO="NONE". create table permission defaults to public.REMAP="BO--Body"There are two kinds of temporary tables: MARK="BULL" REMAP="BU--Bullet"Tables that are accessible only by the current session and exist only for the duration of the current session. ID="IN45108-510974"Databases, system. See master database; model database; sybsystemprocs database; tempdb database
ID="IN456-1011475"TablesTablesSee also Database objects; System tables; tempdb database; Temporary tables!see also
ID="IN4560-1311776"Tables, temporary. See tempdb database; Temporary tables
ID="IN4516-1812277"Temporary tablesTemporary tablesSee also Tables; tempdb database!see alsoTables that are accessible by any user on any session and exist either until specifically dropped or until SQL Server reboots.Tables Accessible Only by the Current SessionREMAP="BO--Body"A non-sharable temporary table exists until the current session ends, or until its owner drops it using MOREINFO="NONE"drop table. You create a temporary table which cannot be shared by specifying only the table's name in the MOREINFO="NONE"create table statement. The table name must begin with a pound (#) sign. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"create table #my_temptblID="IN456-1812279"Namingtemporary tables;Suffix names:temporary table nameSQL Server Appends a Suffix to the Table NameREMAP="BO--Body"To ensure that the table name is unique for the current session, SQL Server: ID="IN4516-1812280"Temporary tablesnames of;Truncation:temporary table namesMARK="BULL" REMAP="BU--Bullet"Truncates long temporary table names to 13 characters (including the pound sign)ID="IN4513-1812281"Padding, data_ (underscore)underscores in temporary table names;_ (underscore):in temporary table names;Underscore (_):in temporary table names[Underscore (_):temporary table names]temporary table namesPads short names to 13 characters, using underscores (_)Appends a 17-digit numeric suffix that is unique for a SQL Server session REMAP="BO--Body"The following example shows a table created as #temptable and stored as #temptable___00000050010721973:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"use pubs2 go create table #temptable (task char(30)) go use tempdb go select name from sysobjects where name like    `#temptable%' go REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"name  ------------------------------ #temptable___00000050010721973 (1 row affected) Restrictions on Temporary TablesREMAP="BO--Body"Temporary tables with names that begin with # are subject to the following restrictions:MARK="BULL" REMAP="BU--Bullet"You cannot create views on these tables.You cannot associate triggers with these tables. REMAP="BO--Body"These restrictions do not apply to sharable temporary tables created in tempdb.ID="IN4514-1812282"# (pound sign)temporary table identifier prefix;Pound sign (#):temporary table name prefix;Temporary tables:identifier prefix (#)Tables That Can Be Shared Among SessionsREMAP="BO--Body"You create these sharable temporary tables by specifying tempdb as part of the table's name in the MOREINFO="NONE"create table statement, or by creating them directly in tempdb. The following examples both create a sharable temporary table, my_temptbl, in tempdb:NUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create table tempdb..my_temptbluse tempdbcreate table my_temptblREMAP="BO--Body"SQL Server does not change the names of temporary tables created this way. The table exists either until you reboot SQL Server, or until its owner drops it using MOREINFO="NONE"drop table. Temporary tables are not recoverable.Using Rules, Defaults, and IndexesREMAP="BO--Body"You can associate rules, defaults and indexes with temporary tables. Indexes created on a temporary table disappear when the temporary table disappears. ID="IN4517-1812285"Stored procedurestemporary tables andManipulating Temporary Tables in Stored ProceduresREMAP="BO--Body"Stored procedures can reference temporary tables that are created during the current session. Within a stored procedure, you cannot create a temporary table, drop it, and then create a new temporary table with the same name. Temporary Tables with Names Beginning with #REMAP="BO--Body"Temporary tables with names beginning with # that are created within stored procedures disappear when the procedure exits. A single procedure can:MARK="BULL" REMAP="BU--Bullet"Create a temporary tableInsert data into itRun queries on itCall other procedures that reference the temporary tableREMAP="BO--Body"Since the temporary table must exist in order to create procedures that reference it, here are the steps to follow:NUMERATION="ARABIC" REMAP="S1--StepOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"Create the temporary table you need with a MOREINFO="NONE"create table statement.Create the procedures that access the temporary table (but not the one that creates it).Drop the temporary table.Create the procedure that creates the table and calls the procedures created in Step 2.Tables with Names Beginning with tempdb..REMAP="BO--Body"You can also create temporary tables without the # prefix, using MOREINFO="NONE"create table MOREINFO="NONE"tempdb..tablename from inside a stored procedure. These tables do not disappear when the procedure completes, so they can be referenced by independent procedures. Follow the steps listed above to create these tables.Using System Procedures on Temporary TablesID="IN4517-1812288"System proceduresSystem procedureson temporary tablestemporary tablesREMAP="BO--Body"System procedures such as MOREINFO="NONE"sp_help only work on temporary tables if you invoke them from tempdb. Using User-Defined Datatypes in Temporary TablesID="IN459-1812290"Datatypesuser-defined in temporary tables;User-defined datatypes:temporary tables andREMAP="BO--Body"User-defined datatypes cannot be used in temporary tables unless the datatypes exist in tempdb; that is, unless they have been explicitly created in tempdb since the last time SQL Server was rebooted.Selecting into Temporary Result TablesREMAP="BO--Body"You do not have to set theMOREINFO="NONE" select into/bulkcopyID="IN4519-2212692"select into commandtemporary table;Temporary tables:select into and
 option on to MOREINFO="NONE"select MOREINFO="NONE"into a temporary table. Standards and ComplianceREMAP="BO--Body"Temporary tables are a Transact-SQL extension. See AlsoCommands     LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X58548"drop table
ID="IN4516-2412895"Temporary tables
ID="IN4513-2813296"text datatype
ID="IN4514-3213697"image datatypeID="X39672"text and image DatatypesID="IN464-3413999"Sizetext datatype
text columns are variable-length columns that can hold up to 2,147,483,647 ( 231ID="IN4616-39144100"String functionsString functionsSee also text datatype!see also text datatype
 - 1) bytes of printable characters. ID="IN464-41146101"Sizeimage datatype
image columns are variable-length columns that can hold up to 2,147,483,647 ( 231 - 1) bytes of hexadecimal-like data. Defining a text or image ColumnREMAP="BO--Body"You define a text or image column as you would any other column, with a MOREINFO="NONE"create table or MOREINFO="NONE"alter table statementMOREINFO="NONE". text and image datatype definitions do not include lengths. They do permit null values. The column definition takes the form:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"MOREINFO="NONE"column_name {text | image} [null] REMAP="BO--Body"For example, to create the table texttest with a text column, blurb, that permits null values: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table texttest (title_id varchar(6), blurb text null, pub_id char(4)) REMAP="BO--Body"And to create the imagetest table with an image column:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table imagetest (image_id varchar(6), imagecol image null, graphic_id char(4)) Data Is Stored on a Linked List of Pages ID="IN4631-44149106"Linkage, page. See Pages (data)REMAP="BO--Body"SQL Server stores text and image data in a linked list of data pages (2K for most systems; 4K for Stratus) separate from the rest of the table. Each text or image page stores a maximum of 1800 bytes of data. For a table with more than one text or imageID="IN4634-48153107"Chain of pages, text or image datachain of
 column, all the data is stored in the same chain of pages.Initializing text and image ColumnsREMAP="BO--Body"text and image columns are not initialized until you update them or insert a non-null value. Initialization allocates at least one data page for each non-null text or image data value. It also creates a pointer in the table to the location of the text or imageID="IN4630-52157108"Pointers, text or image column
ID="IN4613-54159109"text datatypeinitializing
ID="IN4614-56161110"image datatypeinitializing
 data. ID="IN4611-60165111"Null valuestext and image columns
To save storage space, MOREINFO="NONE"insert null values until you use the text or imageID="IN4611-63168112"Table pagesTable pagesSee also Pages (data)!see also Pages (data)
 column.REMAP="BO--Body"For example, the following statement initializes the blurb column by inserting a non-null value. The column now has a valid text pointer, and the first 2K data page has been allocated. Note that text values require quotation marks in an MOREINFO="NONE"insert statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert texttest values ("BU7832", "Straight Talk About Computers is an annotated analysis of what computers can do for you: a no-hype guide for the critical user.", "1389")REMAP="BO--Body"The following statement initializes an image column. Note that image values must be preceded by 0x in an MOREINFO="NONE"insert statement:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert imagetest values ("94732", 0x0000008300000000000100000000013c, "1389")  How image Data Is StoredREMAP="BO--Body"image values less than 255 bytes that have an odd number of bytes are padded with a leading zero (an insert of "0xaaabb" becomes "0x0aaabb"). It is an error to insert image values greater than 255 bytes that have an odd number of bytes. Saving Space by Allowing NullsID="IN4613-65170116"text datatypenull valuesREMAP="BO--Body"To save storage space for empty textID="IN4614-67172117"image datatypenull values in
 or image columns, define them to permit null values. Inserting a null value does not initialize a text or image column, and therefore does not create a text pointer or allocate 2K bytes of storage. For example, the following statement inserts values into the title_id and pub_id columns, but does not initialize the blurb text column:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert texttest(title_id, pub_id) values ("BU7832", "1389")Getting Information from sysindexesID="IN4618-71176120"Storage managementtext and image dataREMAP="BO--Body"Each table with text or imageID="IN4616-77182121"sysindexes tablename column in;Indexes:sysindexes table
 columns has an additional row in sysindexes that provides information about these columns. The name column in sysindexes uses the form "tMOREINFO="NONE"tablename"; the indid is always 255. These columns provide information about text storage: TOCENTRY="1"LBL="Table 3-28: "Storage of text and image dataCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="2*"COLNAME="C2" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Description VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ioampg COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Pointer to the allocation page for the text page chainCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"first COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Pointer to the first page of text dataCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"root COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Pointer to the last page COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"segment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of the segment where the object resides REMAP="BO--Body"You can query the sysindexes table for information about these columns. For example, the following query reports the number of data pages used by the blurbs table in the pubs2 database:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select name, data_pgs(object_id("blurbs"), ioampg)from sysindexeswhere name = "tblurbs"REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"name ------------------------------ -----------  tblurbs                       7  Using readtext and writetextID="IN4619-81186125"DB-Library programsdbwritetext;dbwritetext DB-Library functionREMAP="BO--Body"The DB-Library functions MOREINFO="NONE"dbwritetextID="IN4619-85190126"DB-Library programsdbmoretext;dbmoretext DB-Library function
 and MOREINFO="NONE"dbmoretext are the most efficient way to enter large text and imageID="IN4612-89194127"Initializingtext or image columns
ID="IN4617-93198128"writetext commandtext data initialization requirement
 values. To use MOREINFO="NONE"writetext to enter textID="IN4616-97202129"readtext commandtext data initialization requirement
 data or MOREINFO="NONE"readtext to read it, the text column must be initialized first. See "LINKEND="X28630"readtext
" and "LINKEND="X97484"writetext
" for more details. REMAP="BO--Body"Using MOREINFO="NONE"update to replace existing text and image data with NULL, reclaims all of the allocated data pages except the first page, which remains available for future use of MOREINFO="NONE"writetextID="IN4614-101206130"delete commandtext row
. To deallocate all of the storage for the row, use MOREINFO="NONE"delete to remove the entire row.Determining How Much Space a Column UsesREMAP="BO--Body"The system procedure MOREINFO="NONE"sp_spaceused provides information about the space used for text data as index_size:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_spaceused blurbsREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"name            rowtotal  reserved  data    index_size unused --------------- --------  --------- ------- ---------- ------ blurbs          6         32 KB     2 KB    14 KB      16 KBRestrictions on text and image ColumnsREMAP="BO--Body"text and image columns cannot be used: MARK="BULL" REMAP="BU--Bullet"As parameters to stored procedures or as values passed to these parametersAs local variablesIn MOREINFO="NONE"order by, MOREINFO="NONE"compute, and MOREINFO="NONE"group by clausesIn an indexIn subqueriesIn a MOREINFO="NONE"where clause, except with the keyword MOREINFO="NONE"likeIn joinsPutting Additional Pages on Another DeviceREMAP="BO--Body"You can place subsequent text and image data pages on a different logical device with MOREINFO="NONE"sp_placeobject. Selecting text and image Data REMAP="BO--Body"MOREINFO="NONE"select statements return text and imageID="IN4626-103208136"@@textsize global variableatattextsize global variable;textsize global variable
 data up to the limit specified in the global variable @@textsizeID="IN4621-109214137"set textsize functionset textsize function;Size:set textsize function
. The MOREINFO="NONE"set MOREINFO="NONE"textsize command is used to change this limit. The initial value of @@textsize is 32K; the maximum value for @@textsize is 231 - 1 (that is, 2,147,483,647). ID="IN4631-112217139"Data padding. See Padding, dataID="IN4634-115220140"Columns padding. See Padding, dataID="IN4614-119224141"image datatypeÒ 0xÓ  prefix for;Padding, data:image datatypeID="IN4616-123228142"convert functiontext valuesConverting the text and image DatatypesID="IN4613-127232146"text datatypeconvert commandREMAP="BO--Body"You can explicitly convert text values to char or varchar and image values to binary or varbinary with the MOREINFO="NONE"convert function, but you are limited to the maximum length of the character and binary datatypes, 255 bytes. If you do not specify the length, the converted value has a default length of 30 bytes. Implicit conversion is not supported. Pattern Matching in text DataID="IN4624-131236149"patindex string functiontext/image functionREMAP="BO--Body"Use the MOREINFO="NONE"patindex function to search for the starting position of the first occurrence of a specified pattern in a text, varchar, or char column. The % wildcard character must precede and follow the pattern (except when searching for first or last characters). ID="IN4614-135240150"Duplicate rowstext or imageREMAP="BO--Body"You can also use the MOREINFO="NONE"like keyword to search for a particular pattern. The following example selects each text data value from the blurb column of the texttest table that contains the pattern, "Straight Talk%". REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select blurb from texttest where blurb like "Straight Talk%" Duplicate Rows Are ProhibitedID="IN4630-139244152"Pointers, text or image columnREMAP="BO--Body"Because the pointer to the text or image data uniquely identifies each row, a table that contains text or image data cannot contain duplicate rows unless the pointer has not been initialized: that is, unless all text and image data is NULL. See AlsoCommands     LINKEND="X91835"insert
MOREINFO="NONE", LINKEND="X28630"readtext
MOREINFO="NONE", LINKEND="X64136"set
MOREINFO="NONE", LINKEND="X54355"update
MOREINFO="NONE", LINKEND="X97484"writetext
ID="IN4614-143248154"image datatype
ID="IN4613-147252155"text datatypeFunctions     LINKEND="X13154"Datatype Conversion Functions
, LINKEND="X29354"text and image FunctionsTopics     LINKEND="X84316"Datatypes
 REMAP="BO--Body"ID="X19352"TransactionsID="IN43890125"GroupingGroupingSee also User-defined transactions!see also User-defined transactions
User-defined transactions provide a mechanism for grouping statements so that they are treated as a unit: either all statements in the group are executed, or no statements in the group are executed. About TransactionsREMAP="BO--Body"To explicitly define the beginning of a transaction: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"begin {transaction | tran | work} [MOREINFO="NONE"transaction_name] REMAP="BO--Body"ID="IN43690127"Namingtransactions
transaction_name is the name assigned to the transaction. It must conform to the rules for identifiers. Use transaction names only on the outermost pair of nested MOREINFO="NONE"begin/MOREINFO="NONE"commit or MOREINFO="NONE"begin/MOREINFO="NONE"rollback statements. REMAP="BO--Body"To commit a transaction: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"commit {transaction | tran | work} [MOREINFO="NONE"transaction_name] ID="IN431685178"rollback commandrollback commandSee also Transactions!see also TransactionsREMAP="BO--Body"To roll a transaction back to a savepoint, or to the beginning of a transaction: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"rollback {transaction | tran | work}      [MOREINFO="NONE"transaction_name |MOREINFO="NONE" savepoint_name] REMAP="BO--Body"savepoint_name is the name assigned to the savepoint. It must conform to the rules for identifiers. ID="IN432480229"save transaction commandsave transaction commandSee also Transactions!see also Transactions
ID="IN4310782410"Savepointssetting using save transactionREMAP="BO--Body"To mark a savepoint within a transaction: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"save {transaction | tran} MOREINFO="NONE"savepoint_name REMAP="BO--Body"MOREINFO="NONE"begin transaction marks the beginning of a transaction block. All subsequent statements, up to a MOREINFO="NONE"rollback or a matching MOREINFO="NONE"commit, are treated as a unit: they are all rolled back (if unsuccessful) or committed (if successful). ID="IN4312782411"TransactionsANSI complianceREMAP="BO--Body"To get full ANSI-compliant transactions, you must set the MOREINFO="NONE"chained and MOREINFO="NONE"transaction isolation level 3 options at the beginning of every application which changes the mode and isolation level for subsequent transactions. If your application uses cursors, you must also set the MOREINFO="NONE"close on endtran option. Each of these options is described later.ID="IN4312762612"TransactionsTransactionsstates;Transactions:@@transtate global variabletranstate global variableREMAP="BO--Body"The global variable @@transtate keeps track of the current state of a transaction. SQL Server determines what state to return by keeping track of any transaction changes after a statement executes. @@transtate may contain the following values:TOCENTRY="1"LBL="Table 3-29: "@@transtate valuesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="4*"COLNAME="C2" COLWIDTH="31*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction in progress: an explicit or implicit transaction is 
in effect; the previous statement executed successfully.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction succeeded: the transaction completed and 
committed its changes.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Statement aborted: the previous statement was aborted; no 
effect on the transaction.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction aborted: the transaction aborted and rolled back 
any changes.REMAP="BO--Body"SQL Server does not clear @@transtate after every statement. You can use @@transtate after a statement (such as an MOREINFO="NONE"insert) to determine whether it was successful or aborted and to determine its effect on the transaction.Example of Using a TransactionREMAP="BO--Body"A user sets out to change the royalty split for the two authors of The Gourmet Microwave. Since the database would be inconsistent between the two updates, they must be grouped into a user-defined transaction. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"begin transaction royalty_change REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update titleauthor set royaltyper = 65 from titleauthor, titles where royaltyper = 75 and titleauthor.title_id = titles.title_id and title = "The Gourmet Microwave" REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update titleauthor set royaltyper = 35 from titleauthor, titles where royaltyper = 25 and titleauthor.title_id = titles.title_id and title = "The Gourmet Microwave" REMAP="UI--UserInput" FORMAT="LINESPECIFIC"save transaction percentchangedREMAP="UI--UserInput" FORMAT="LINESPECIFIC"/* After updating the royaltyper entries for ** the two authors, insert the savepoint ** percentchanged, then determine how a 10% ** increase in the book's price would affect** the authors' royalty earnings. */REMAP="UI--UserInput" FORMAT="LINESPECIFIC"update titles set price = price * 1.1 where title = "The Gourmet Microwave" REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select (price * total_sales) * royaltyper from titles, titleauthor where title = "The Gourmet Microwave" and titles.title_id = titleauthor.title_idREMAP="UI--UserInput" FORMAT="LINESPECIFIC"/* The transaction is rolled back to the savepoint ** with the MOREINFO="NONE"rollback transaction command. */ REMAP="UI--UserInput" FORMAT="LINESPECIFIC"rollback transaction percentchangedREMAP="UI--UserInput" FORMAT="LINESPECIFIC"commit transactionNesting TransactionsID="IN436762614"Levelsnesting;Nesting:transaction statements;Transactions:nesting
ID="IN437742815"Nestingbegin transaction/commit statementsREMAP="BO--Body"You can nest MOREINFO="NONE"begin transaction/MOREINFO="NONE"commit statements. When MOREINFO="NONE"begin/MOREINFO="NONE"commit statements are nested, the outermost pair actually create and commit the transaction; inner pairs just keep track of the nesting level. The transaction is not committed until the MOREINFO="NONE"commit that matches the outermost MOREINFO="NONE"begin transaction (explicit or implicit) is issued. Normally, this transaction "nesting" occurs as stored procedures or triggers which contain MOREINFO="NONE"begin/MOREINFO="NONE"commit pairs call each other. ID="IN436723016"LevelsLevelsnesting;Levels:@@trancount global variabletrancount global variable
ID="IN4327703217"@@trancount global variableatattrancount global variable;trancount global variableREMAP="BO--Body"The global variable @@trancount keeps track of the nesting levels of transactions. A @@trancount of 0 indicates no current transaction. An initial explicit or implicit MOREINFO="NONE"begin transaction sets @@trancount to 1. Each subsequent explicit MOREINFO="NONE"begin transaction increments @@trancount.MOREINFO="NONE" commit decrements @@trancount; nested transactions are not committed until @@trancount reaches 0. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"begin tran      statements          Group A, @@trancount = 1    begin tran         statements      Group B, @@trancount = 2        begin tran           statements    Group C, @@trancount = 3        commit tran     commit tran commit tran             All statement groups committed hereConsiderations When Using TransactionsREMAP="BO--Body"You should consider the following issues when dealing with transactions in your applications:ID="IN4312703219"TransactionscancelingMARK="BULL" REMAP="BU--Bullet"A MOREINFO="NONE"rollback statement, without a transaction or savepoint name, always rolls back statements to the outermost MOREINFO="NONE"begin transaction (explicit or implicit) statement, and cancels the transaction. If there is no current transaction when you issue MOREINFO="NONE"rollback, the statement has no effect.ID="INA438663620"Triggersrollback in;rollback command:triggers and
ID="IN4317643821"Stored proceduresrollback in
ID="IN4316624022"rollback commandrollback commandin stored proceduresstored proceduresREMAP="UN--Under"In triggers or stored procedures, MOREINFO="NONE"rollback statements, without transaction or savepoint names, roll back all statements to the outermost MOREINFO="NONE"begin transaction (explicit or implicit).ID="IN438624023"Messagestransactions and;Error messages:user-defined transactions and
MOREINFO="NONE"rollbackdoes not produce any messages to the user. If warnings are needed, use MOREINFO="NONE"raiserror or MOREINFO="NONE"print statements. ID="IN438624024"RecoverySpeed (Server)time and transaction size;Speed (Server):of recoveryrecoveryGrouping a large number of Transact-SQL commands into one long-running transaction may affect recovery time. If SQL Server fails during a long transaction, recovery time increases, since SQL Server must first undo the entire transaction. ID="IN4320624025"Number (quantity of)databases within transactions;Transactions:number of databases allowedYou can refer to as many as 8 databases within a transaction. However, SQL Server may refer to internal databases to process a transaction, so the number of databases you can actually refer to may be lower. SQL Server displays an error message if you exceed the open databases limit.ID="IN4322624026"Remote procedure callsuser-defined transactionsA remote procedure call (RPC) is executed independently from any transaction in which it is included. In a standard transaction (that is, not using Open Client DB-Library/C two-phase commit), commands executed via an RPC by a remote server are not rolled back with MOREINFO="NONE"rollback, and do not depend on MOREINFO="NONE"commit to be executed.ID="IN4311624027"Connectionstransactions andTransactions cannot span more than one connection between a client application and a server. For example, an Open Client DB-Library/C application cannot group SQL statements in a transaction across multiple open DBPROCESSes.ID="IN4315624028"Data definitiontransactions andTransactions and Data Definition CommandsID="IN4328604230"sp_dboption system proceduretransactions andREMAP="BO--Body"You can use certain data definition language commands in transactions if MOREINFO="NONE"sp_dboption's MOREINFO="NONE"ddl in tran option is set to true. If MOREINFO="NONE"ddl in tran is true in a particular database, commands such as MOREINFO="NONE"create table, MOREINFO="NONE"grant, and MOREINFO="NONE"alter table are allowed inside transactions in that database. If MOREINFO="NONE"ddl in tran is true in the model database, the commands are allowed inside transactions in all databases created after MOREINFO="NONE"ddl in tran was set in model. The only scenario in which using data definition language commands inside transactions is justified is in MOREINFO="NONE"create schema. Data definition language commands hold locks on system tables such as sysobjects. If you use data definition language commands inside transactions, keep the transactions short.   In particular, avoid using any data definition language commands on tempdb within transactions, lest your system grind to a halt. Always leave MOREINFO="NONE"ddl in tran set to false in tempdb.REMAP="BO--Body"To set MOREINFO="NONE"ddl in tran to true for a database (such as mydb), move to the master database and type:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_dboption mydb, "ddl in tran", trueREMAP="BO--Body"You must then execute the MOREINFO="NONE"checkpoint command in that database.REMAP="BO--Body"The following commands can be used inside a user-defined transaction only if theMOREINFO="NONE" ddl in tran option to MOREINFO="NONE"sp_dboption is set to true:TOCENTRY="1"LBL="Table 3-30: "DDL Commands allowed in transactions COLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"COLNAME="C4" COLWIDTH="1*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"alter tableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create defaultcreate indexcreate procedurecreate rulecreate schemacreate tablecreate triggercreate view COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop defaultdrop indexdrop proceduredrop ruledrop tabledrop triggerdrop view COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"grantrevokeID="IN438604231"Commandsnot allowed in user-defined transactionsREMAP="BO--Body"The following commands cannot be used inside a user-defined transaction under any circumstances: TOCENTRY="1"LBL="Table 3-31: "DDL commands not allowed in transactionsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"alter databasecreate databasedisk initdump database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dump
transactiondrop databaseload transactionload databaseCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"reconfigureselect intoupdate statisticstruncate tableID="IN4317604232"System proceduresnot allowed in user-defined transactionsREMAP="BO--Body"In addition, the MOREINFO="NONE"sp_helpdb, MOREINFO="NONE"sp_helpdevice, MOREINFO="NONE"sp_helpindex, MOREINFO="NONE"sp_helpjoins, MOREINFO="NONE"sp_helpserver, MOREINFO="NONE"sp_lookup, MOREINFO="NONE"sp_spaceused, and MOREINFO="NONE"sp_syntax system procedures cannot be used inside user-defined transactions because they create temporary tables .REMAP="BO--Body"System procedures that change the master database cannot be used inside user-defined transactions. REMAP="BO--Body"You can check the current setting of MOREINFO="NONE"ddl in tran with MOREINFO="NONE"sp_helpdb.ID="IN4310604234"SavepointstransactionsUsing Savepoints in TransactionsREMAP="BO--Body"MOREINFO="NONE"save MOREINFO="NONE"transaction transaction_name provides a mechanism for selectively rolling back portions of a batch. You can commit only certain portions of a batch by rolling back the undesired portion to a savepoint before committing the entire batch. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"begin tran  statements                 Group A  save tran mytran             statements      Group B  rollback tran mytran       Rolls back group B  statements                 Group Ccommit tran                  Commits groups A and CREMAP="BO--Body"You can also use MOREINFO="NONE"save MOREINFO="NONE"transaction to create transactions within stored procedures or triggers in such a way that they can be rolled back without affecting batches or other procedures. For example: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create proc myproc as begin tran save tran mytran statements if ...     begin        rollback tran mytran      /*     ** Rolls back to savepoint.     */       commit tran     /*     ** This commit needed; rollback to a savepoint     ** does not cancel a transaction.     */    endREMAP="UI--UserInput" FORMAT="LINESPECIFIC"else     commit tran     /*    ** Matches begin tran; either commits     ** transaction (if not nested) or     ** decrements nesting level.      */ID="IN435604236"NamesNamesof transactionstransactionsREMAP="BO--Body"Unless you are rolling back to a savepoint, use transaction names only on the outermost pair of MOREINFO="NONE"begin/MOREINFO="NONE"commit or MOREINFO="NONE"begin/MOREINFO="NONE"rollback statements. ID="IN437604237"Nestingwarning on transactions;Transactions:names not used in nestedTransaction names are ignored, or can cause errors, when used in nested transaction statements. If you are using transactions in stored procedures or triggers that could be called from within other transactions, do not use transaction names. ID="IN4312604239"TransactionsmodesChoosing a Transaction ModeID="IN4312604241"TransactionsmodesREMAP="BO--Body"SQL Server supports two transaction modes:ID="IN4312584442"Transactionsunchained;Unchained transaction modeMARK="BULL" REMAP="BU--Bullet"The default mode, called unchained or Transact-SQL mode, requires explicit MOREINFO="NONE"begin transaction statements paired with MOREINFO="NONE"commit or MOREINFO="NONE"rollback statements to complete the transaction.ID="IN4312584443"Transactionschained;Chained transaction modeThe ANSI-compatible mode, called chained mode, implicitly begins a transaction before any data retrieval or modification statement. These statements include: MOREINFO="NONE"delete, MOREINFO="NONE"insert,MOREINFO="NONE" open,MOREINFO="NONE" fetch,MOREINFO="NONE" select, and MOREINFO="NONE"update. You must still explicitly end the transaction with MOREINFO="NONE"commit or MOREINFO="NONE"rollback.REMAP="BO--Body"You can set either mode using the MOREINFO="NONE"chained option of the MOREINFO="NONE"set command. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set chained onID="IN4317584444"Stored procedurestransactions and
ID="IN438584445"Triggerstransaction mode andREMAP="BO--Body"However, do not mix these transaction modes in your applications. The behavior of batches, stored procedures, and triggers can vary depending on the mode.REMAP="BO--Body"For example, the following group of statements produce different results depending on which mode you use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"insert into publishers      values ('9999', null, null, null)begin transactiondelete from publishers where pub_id = `9999'rollback transactionREMAP="BO--Body"In unchained mode, the MOREINFO="NONE"rollback affects only the MOREINFO="NONE"delete statement, so publishers still contains the inserted row. In chained mode, the MOREINFO="NONE"insert statement implicitly begins a transaction, and the rollback affects all statements up to the beginning of that transaction, including the MOREINFO="NONE"insert.REMAP="BO--Body"All application programs and ad-hoc user queries should know their current transaction mode. Which transaction mode you use depends on whether or not a particular query or application requires ANSI compliance. Applications that will use chained transactions (for example, the Embedded-SQL precompiler) should set chained mode at the beginning of each session.REMAP="BO--Body"In chained mode, a data retrieval or modification statement begins a transaction whether or not it executes successfully. Even a MOREINFO="NONE"select which does not access a table begins a transaction. However, a MOREINFO="NONE"fetch begins a transaction only when an application has not set MOREINFO="NONE"close on endtran, which allows cursors to remain open across transactions.ID="IN4329564646"@@tranchained global variableatattranchained global variable;tranchained global variableREMAP="BO--Body"The global variable @@tranchained contains the current transaction mode of the Transact-SQL program. @@tranchained returns 0 for unchained and 1 for chained.ID="IN4311544847"set commandchained transaction modeREMAP="BO--Body"You cannot execute the MOREINFO="NONE"set MOREINFO="NONE"chained ID="IN4312525048"Transactionsunchained;Unchained transaction mode
command within a transaction. If you do, SQL Server issues a level 16 (informational) error message, and the current transaction continues unchanged. ID="IN4316505249"Isolation levelstransactions;Levels:transaction isolationChoosing a Transaction Isolation LevelREMAP="BO--Body"The SQL92 standard defines three levels of isolation for transactions. Each isolation level specifies the kinds of actions which are not permitted while concurrent transactions execute. Higher levels include the restrictions imposed by the lower levels:ID="IN4311505251"Dirty readsdirtyMARK="BULL" REMAP="BU--Bullet"Level 1 prevents dirty reads. "Dirty reads" occur when one transaction modifies a row, and then a second transaction reads that row before the first transaction commits the change. If the first transaction rolls back the change, the information read by the second transaction becomes invalid. Transact-SQL never allows this to happen.ID="IN4320505252"Non-repeatable readsnon-repeatableLevel 2 prevents non-repeatable reads. "Non-repeatable reads" occur when one transaction reads a row and then a second transaction modifies that row. If the second transaction commits its change, subsequent reads by the first transaction yield different results than the original read. Transact-SQL supports this level of isolation through the MOREINFO="NONE"holdlock option of the MOREINFO="NONE"select statement. MOREINFO="NONE"holdlock applies a read-lock on the data until the transaction ends.ID="IN4324505253"Phantoms in transactionsLevel 3 prevents phantoms. "Phantoms" occur when one transaction reads a set of rows that satisfy a search condition, and then a second transaction modifies the data (through an MOREINFO="NONE"insert, MOREINFO="NONE"delete, MOREINFO="NONE"update, and so on). If the first transaction repeats the read with the same search conditions, it obtains a different set of rows. Transact-SQL also supports this level through MOREINFO="NONE"holdlock.REMAP="BO--Body"The SQL92 standard requires that level 3 be the default isolation between transactions. This prevents "dirty reads," "non-repeatable reads," and "phantoms." To enforce this default level of isolation, Transact-SQL provides the MOREINFO="NONE"transaction isolation level 3 option of the MOREINFO="NONE"set statement. This instructs SQL Server to automatically apply a MOREINFO="NONE"holdlock to all MOREINFO="NONE"select operations in a transaction.REMAP="BO--Body"By default, SQL Server's transaction isolation level is 1. You cannot change an isolation level within a transaction. Such attempts cause SQL Server to return a warning message; the current transaction continues unchanged. Applications that should use MOREINFO="NONE"transaction isolation level 3 (for example, the Embedded-SQL precompiler) should set that isolation level at the beginning of each session.REMAP="BO--Body"Setting MOREINFO="NONE"transaction isolation level 3 causes SQL Server to hold any read-locks for the duration of the transaction. If you also use the chained mode, that isolation level remains in effect for any data retrieval or modification statement that implicitly begins a transaction. This can lead to performance penalties for some applications since more locks may be held for longer periods of time.ID="IN4327485454"@@isolation global variableisolation global variable;atatisolation global variableREMAP="BO--Body"The global variable @@isolation determines the current isolation level of the Transact-SQL program. @@isolation returns the value of the active level (1 or 3).ID="IN4316465655"Isolation levelstransactions;Levels:transaction isolation
 For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select @@isolationREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"----------        1 (1 row affected)ID="IN4317445856"Stored procedurestransactions and;Triggers:transactions andUsing Transactions in Stored Procedures and TriggersREMAP="BO--Body"A MOREINFO="NONE"rollback statement in a stored procedure or trigger that rolls back past more than one explicit or implicit MOREINFO="NONE"begin transaction statement produces an informational message indicating the number of nesting levels affected. This message does not affect subsequent processing. REMAP="BO--Body"The illustration that follows demonstrates a sequence of events that might occur due to nested transaction statements in triggers and procedures.FLOAT="0"FORMAT="UNKNOWN" FILEREF="figtr_u.xwd"LBL="Figure 3-1: "Nesting transaction statementsREMAP="BO--Body"MOREINFO="NONE"rollback statements in stored procedures do not affect subsequent statements in the procedure or batch that called the procedure. Subsequent statements in the stored procedure and/or batch are executed. MOREINFO="NONE"rollback statements in trigger: 1) roll back the transaction, 2) complete subsequent statements in the trigger, and 3) abort the batch so that subsequent statements in the batch are not executed. REMAP="BO--Body"In the following example, the procedure myproc includes a MOREINFO="NONE"rollback statement. The MOREINFO="NONE"update and MOREINFO="NONE"insert statements are rolled back and the transaction is aborted. The MOREINFO="NONE"delete statement is executed, and cannot be rolled back. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"begin tran update mytab ... insert abc values ... execute myproc delete mytab ... REMAP="BO--Body"However, in the following example, if there is an MOREINFO="NONE"insert trigger on xyz that includes a MOREINFO="NONE"rollback, the entire transaction is rolled back, and the MOREINFO="NONE"delete is not performed: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"begin tran update mytab ... insert xyz values ... delete mytab ... REMAP="BO--Body"The following table summarizes how MOREINFO="NONE"rollback affects SQL Server processing in several different contexts (such as within a transaction, stored procedure, or trigger):TOCENTRY="1"LBL="Table 3-32: "How rollbacks affect processingCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ContextCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Rollback EffectVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"All data modifications since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches.
Any commands after the rollback are executed.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure 
onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"None.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure in 
a transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"All data modification since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches.
Any commands after the rollback are executed.
Stored procedure produces error message 266: 
"Transaction count after EXECUTE indicates that a 
COMMIT or ROLLBACK TRAN is missing."COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger completes, but trigger effects are rolled back.

Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger in a 
transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger completes, but trigger effects are rolled back.

All data modification since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches. 
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Nested triggerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Inner trigger completes, but all trigger effects are 
rolled back.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Nested trigger in a 
transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Inner trigger completes, but all trigger effects are 
rolled back.
All data modification since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.REMAP="BO--Body"In stored procedures and triggers, the number of MOREINFO="NONE"begin transaction statements must match the number of MOREINFO="NONE"commit statements. A procedure or trigger that contains unpaired MOREINFO="NONE"begin/MOREINFO="NONE"commit statements produces a warning message when it is executed. This also applies to stored procedures that use chained mode: the first statement that implicitly begins a transaction must have a matching MOREINFO="NONE"commit.Stored Procedures and Transaction ModesREMAP="BO--Body"Stored procedures written to use unchained transactions may be incompatible with other chained transactions, and vice-versa. As a rule, an application using one mode (chained or unchained) should call stored procedures written to use that same mode. This rule also applies for stored procedures using transaction isolation levels 1 or 3. The exceptions are SYBASE system stored procedures, which can be invoked by sessions using either chained or unchained transaction modes. ID="IN4317445858"Stored proceduresisolation levels;System procedures:isolation levelsREMAP="BO--Body"SQL Server allows transactions using either isolation level to invoke system stored procedures. However, you should avoid executing system procedures with isolation level 3 since they lock the system tables for longer periods. If no transaction is active when you execute system stored procedures,SQL Server turns off chained mode and sets MOREINFO="NONE"transaction isolation level 1 for the duration of the procedure. Before returning, these stored procedures reset the session's chained mode and isolation level to their original settings.REMAP="BO--Body"To avoid problems associated with transactions that use one mode invoking stored procedures that use the other mode, SQL Server tags all procedures with the transaction mode of the session in which they are created. A stored procedure tagged as "chained" is executable only in sessions using chained transactions, and one tagged as "unchained" is executable only in sessions not using chained transactions. REMAP="BO--Body"If you attempt otherwise, SQL Server displays a level 16 (informational) message and the current transaction, if any, continues unchanged. A third tag, "anymode", is available to indicate stored procedures that can run under either transaction mode. You can change the tag value associated with stored procedures using the MOREINFO="NONE"sp_procxmode system stored procedure.REMAP="BO--Body"Triggers are executable under any transaction mode. Since they are always called as part of a data modification statement, they are part of a chained transaction if a session uses the chained mode, or they maintain their current transaction mode.ID="IN437435959"Cursorstransactions andCursors and TransactionsID="IN4312435961"Transactionscursors andREMAP="BO--Body"A cursor's state (open or closed) does not change when a transaction ends through a commit or abort, unless the MOREINFO="NONE"close on endtran option or the chained mode is set. The MOREINFO="NONE"set close on endtran statement enforces ANSI-standard behavior: it associates an open cursor with its active transaction. Committing or rolling back that transaction automatically closes any open cursors associated with it. Opening a cursor when the chained mode is set starts a transaction. SQL Server closes that cursor when the chained transaction is closed or rolled back.REMAP="BO--Body"For example, the following statements:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"open cursor testREMAP="UI--UserInput" FORMAT="LINESPECIFIC"commit tranREMAP="UI--UserInput" FORMAT="LINESPECIFIC"open cursor testREMAP="BO--Body"result in a Transact-SQL error because the cursor's open state does not change when its transaction ends. However, if you set MOREINFO="NONE"close on endtran or use the chained mode, the cursor's state changes from open to closed after the MOREINFO="NONE"commit tran. This allows the cursor to be reopened.Since client applications buffer rows returned through cursors and allow users to scroll within those buffers, those client applications should not scroll backwards after a transaction aborts. The rows in a client cache may become invalid because of a transaction rollback (unknown to the client) enforced by the MOREINFO="NONE"close on endtran option or the chained mode.REMAP="BO--Body"Any exclusive locks acquired by a cursor in a transaction are held until the end of that transaction. This also applies to shared locks when using the MOREINFO="NONE"holdlock keyword or the MOREINFO="NONE"set isolation level 3 option. However, if you do not set the MOREINFO="NONE"close on endtran option, the cursor remains open past the end of the transaction, and its current page lock remains in effect. It could also continue to acquire locks as it fetches additional rows.REMAP="BO--Body"The following rules define the behavior of updates through a cursor with regard to transactions:MARK="BULL" REMAP="BU--Bullet"If an update occurs within an explicit transaction (that is, client specified), the update is considered part of the transaction. If the transaction commits, any updates included with the transaction also commit. If the transaction aborts, any updates included with the transaction are rolled back. Updates through the same cursor that occurred outside the aborted transaction are not affected.If updates through a cursor occur within an explicit transaction, SQL Server does not commit them when the cursor is closed. It commits or rolls back pending updates only when the transaction associated with that cursor ends.A transaction commit or abort has no effect on SQL cursor statements that do not manipulate result rows, such as MOREINFO="NONE"declare cursor, MOREINFO="NONE"open cursor,MOREINFO="NONE" close cursor, MOREINFO="NONE"set cursor rows, and MOREINFO="NONE"deallocate cursor. For example, if the client opens a cursor within a transaction and the transaction aborts, the cursor remains open after the abort (unless the MOREINFO="NONE"close on endtranID="IN437426062"Cursorstransactions and
 is set or the chained mode is used).ID="IN4312426063"TransactionsTransactionsand errorserrorsErrors and Transaction RollbacksID="IN4317426065"Integrity of datatransactions andREMAP="BO--Body"Transactions maintain the integrity of your data, and certain errors that would affect data integrity affect the state of implicit or explicit transactions:MARK="BULL" REMAP="BU--Bullet"Errors with severity levels of 19 or greater REMAP="UN--Under"Since these errors terminate the user connection to the server, any errors of level 19 or greater that occur while a user transaction is in progress abort the transaction and roll back all statements to the outermost MOREINFO="NONE"begin transaction. SQL Server always rolls back any uncommitted transactions at the end of a session.ID="IN438406266"Triggerstransactions and;Stored procedures:transactions andData modification commands that affect data integrity:MARK="DASH" REMAP="BS--BulletSub"Arithmetic overflow/divide by zero errors (effects on transactions can be changed with the MOREINFO="NONE"set arithabort arith_overflow command.)Permissions violationsRules violationsDuplicate key violationsREMAP="BO--Body"The following table summarizes how a rollback caused by a ID="IN4311406267"Permissionserrors
permission or MOREINFO="NONE"arithoverflow error affects SQL Server processing in several different contexts (such as within a transaction, stored procedure, or trigger):TOCENTRY="1"LBL="Table 3-33: "How rollbacks from errors affect processingCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ContextCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Effect of Permission or Arithoverflow Error RollbackVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"All data modifications since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure 
onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Current command is aborted. Any previous 
commands are not rolled back.
With permission errors, any following commands are 
executed. With MOREINFO="NONE"arithabort MOREINFO="NONE"arith_overflow MOREINFO="NONE"on, any 
remaining commands in the batch are not executed; 
processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure in 
a transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure is aborted.
All data modifications since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger is aborted, and trigger effects are rolled back.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger in a 
transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger is aborted, and trigger effects are rolled back.
All data modifications since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Nested triggerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Inner trigger is aborted, and all trigger effects are 
rolled back.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Nested trigger in a 
transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Inner trigger is aborted, and all trigger effects are 
rolled back.
All data modifications since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger with rollback 
followed by an error 
in the transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger effects are rolled back. All data modifications 
since the start of the transaction are rolled back. If a 
transaction spans multiple batches, rollback affects all 
those batches.
Trigger continues and gets permission or arithabort 
error. Normally, that error halts trigger execution, but 
trigger continues in this case.
After trigger completes, any remaining commands in 
the batch are not executed. Processing resumes at the 
next batch.ID="IN4338406268"Duplicate key errors, user transaction
ID="IN436406269"Errorsduplicate key
ID="IN435406270"Rulesviolations in user transactionREMAP="BO--Body"Duplicate key errors and rules violations are special cases. The trigger completes (unless there is also a MOREINFO="NONE"return statement) and statements such as MOREINFO="NONE"print, MOREINFO="NONE"raiserrorID="IN4322406271"Remote procedure callsuser-defined transactions
ID="IN4319406272"DB-Library programstransactions and
, or remote procedure calls are performed. Then, the trigger and the rest of the transaction are rolled back and the rest of the batch is aborted. Note that remote procedure calls executed from inside a normal SQL transaction (not using DB-Library two-phase commit) are not rolled back by a MOREINFO="NONE"rollback statement.ID="IN436406273"ErrorsErrorsin user-defined transactionsuser-defined transactionsREMAP="BO--Body"The following table summarizes how a rollback caused by a duplicate key or rules error affects SQL Server processing in several different contexts:TOCENTRY="1"LBL="Table 3-34: "How rollbacks from duplicate key or rules errors affect processingCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="7*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ContextCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Effect of Duplicate Key or Rules Error RollbackVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Current command is aborted. Any previous 
commands are not rolled back, and any following 
commands are executed. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure 
onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Same as above.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure in 
a transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Same as above.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger completes, but trigger effects are rolled back.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger in a 
transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger completes, but trigger effects are rolled back.
All data modifications since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Nested triggerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Inner trigger completes, but all trigger effects are 
rolled back.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Nested trigger in a 
transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Inner trigger completes, but all trigger effects are 
rolled back.
All data modifications since the start of the transaction 
are rolled back. If a transaction spans multiple batches, 
rollback affects all those batches.
Any remaining commands in the batch are not 
executed. Processing resumes at the next batch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger with rollback 
followed by an error 
in the transactionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger effects are rolled back. All data modifications 
since the start of the transaction are rolled back. If a 
transaction spans multiple batches, rollback affects all 
those batches.
Trigger continues and gets duplicate key or rules error. 
Normally, the trigger rolls back effects and continues, 
but trigger effects are not rolled back in this case.
After trigger completes, any remaining commands in 
the batch are not executed. Processing resumes at the 
next batch.ID="IN4312366674"Transactions
ID="IN438356775"Groupingprocedures
ID="IN4312336976"Transactionsuser-definedSee AlsoCommands     LINKEND="X53982"begin transaction
MOREINFO="NONE", LINKEND="X89531"commit
MOREINFO="NONE", LINKEND="X91510"rollback
MOREINFO="NONE", LINKEND="X64136"setREMAP="BO--Body"ID="X44102"Variables (Local and Global)The Two Kinds of VariablesREMAP="BO--Body"Variables are defined entities that are assigned values. SQL Server has two kinds of variables:MARK="BULL" REMAP="BU--Bullet"A local variable is defined with a MOREINFO="NONE"declare statement and assigned an initial value within the statement batch where it is declared with a MOREINFO="NONE"select statement. Global variablesID="IN431688143"Global variablesGlobal variablesSee also individual variable names!see also individual variable names
 are SQL Server-supplied variables that have system-supplied values.Where to Use Local VariablesID="IN43586165"Loopswhile, local variables andREMAP="BO--Body"Variables can be used nearly any place where the SQL syntax indicates that an expression can be used, such as char_expr, integer_expression, numeric_expr or float_exprID="IN432183196"Parameters, procedureParameters, procedureSee also Local variables!see also Local variables
. They can be passed as parameters to system procedures. Variables are often used in a batch or procedure as counters for MOREINFO="NONE"while loops or MOREINFO="NONE"if-MOREINFO="NONE"else blocks. Declaring a Local VariableREMAP="BO--Body"Use the following syntax to declare a local variable's name and datatype: ID="IN431581218"declare commandlocal variables andREMAP="SY--Syntax" FORMAT="LINESPECIFIC"declare MOREINFO="NONE"@variable_name MOREINFO="NONE"datatype [, MOREINFO="NONE"@variable_name datatype]...REMAP="BO--Body"The variable name must be preceded by the "@" sign and conform to the rules for identifiers. The datatype can be any datatype except text, image, or sysname. ID="IN43981219"Variablespassed as parametersAssigning a Value to a Local VariableREMAP="BO--Body"When a variable is declared, it has NULL value. Use a MOREINFO="NONE"select statement to assign a specific value to the variable: ID="IN4316792312"select statementlocal variables andREMAP="SY--Syntax" FORMAT="LINESPECIFIC"selectMOREINFO="NONE" @MOREINFO="NONE"variable_nameMOREINFO="NONE" = MOREINFO="NONE"expressionMOREINFO="NONE"      [ , @MOREINFO="NONE"variable_nameMOREINFO="NONE" = MOREINFO="NONE"expression ]... MOREINFO="NONE"[from clause] [where clause] [group by clause] [having clause] [order by clause] [compute clause] REMAP="BO--Body"The MOREINFO="NONE"select statement that assigns values to local variables should return a single value. If it returns more than one value, the variable is assigned the last value returned. If it does not return a value (for example, if no rows are matched in a MOREINFO="NONE"where clause) the value of the variable is left unchanged.REMAP="BO--Body"You cannot use the same MOREINFO="NONE"select statement to assign a value to a variable and to retrieve data. For example, the following is not legal: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"/* ILLEGAL STATEMENT */ declare @veryhigh money select @veryhigh = max(price), title_id from titlesID="IN4316772513"select statementvariables andREMAP="BO--Body"Do not use a single MOREINFO="NONE"select statement to assign a value to one variable and then to another whose value is based on the first. Doing so can yield unpredictable results. For example, the following queries both try to find the value of @c2. The first query yields NULL, while the second query yields the correct answer, 0.033333:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"/* this is wrong*/declare @c1 float, @c2 floatselect @c1 = 1000/1000, @c2 = @c1/30select @c1, @c2 /* do it this way */ declare @c1 float, @c2 floatselect @c1 = 1000/1000select @c2 = @c1/30select @c1 , @c2Examples of Local Variable UsageNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"declare @veryhigh money select @veryhigh = max(price) from titles if @veryhigh > $20     print "Ouch!" declare @one varchar(18), @two varchar(18) select @one = "this is one", @two = "this is two" if @one = "this is one"     print "you got one" if @two = "this is two"     print "you got two" else print "nope"  /* Determine if a given au_id has a row in au_pix*//* Turn off result counting */set nocount on/* declare the variables */declare @c int,        @min_id varchar(30)/*First, count the rows*/select @c = count(*) from authors /* Initialize @min_id to "" */select @min_id = "" /* while loop executes once for each authors row */while @c > 0while @c > 0begin    /*Find the smallest au_id*/    select @min_id = min(au_id)        from authors             where au_id > @min_id    /*Is there a match in au_pix?*/    maxreadif exists (select au_id        from au_pix        where au_id = @min_id)    begin        print "A Match! %1!", @min_id    end    select @c = @c -1  /*decrement the counter */endREMAP="UN--Under"This example uses local variables in a counter in a MOREINFO="NONE"while loop, for doing matching in a MOREINFO="NONE"where clause, in an MOREINFO="NONE"if statement, and also sets or resets values in MOREINFO="NONE"select statements.Using Global Variables  ID="IN4337772515"@@ (at symbols), global variable nameREMAP="BO--Body"Predefined global variables are distinguished from local variables by having two @ signs preceding their names, for example, @@error, @@rowcount. Users cannot create global variables, and cannot update the value of global variables directly in a MOREINFO="NONE"select statement.ID="IN4322752716"Monitor SQL statisticsglobal variables and sp_monitorREMAP="BO--Body"Many global variables report on system activity occurring from the last time SQL Server was started. The system procedure MOREINFO="NONE"sp_monitor displays the current values of some of the global variables. ID="IN434742817"Listglobal variablesList of Global VariablesREMAP="BO--Body"The global variables are: REMAP="RI--RefIndent"ID="IN4330723019"@@char_convert global variablechar_convert global variable;atatchar_convert global variable
MOREINFO="NONE"@@char_convert - contains 0 if character set conversion is not in effect. Contains 1 if character set conversion is in effect. ID="IN4331703220"@@client_csname global variableclient_csname global variable;atatclient_csname global variable
MOREINFO="NONE"@@client_csname - client's character set name. Set to NULL if client character set has never been initialized; otherwise, it contains the name of the most recently used character set. ID="IN4329683421"@@client_csid global variableclient_csid global variable;atatclient_csid global variable
MOREINFO="NONE"@@client_csid - client's character set ID. Set to -1 if client character set has never been initialized; otherwise, it contains the most recently used client character set ID from syscharsets. ID="IN4329663622"@@connections global variableconnections global variable;atatconnections global variable
MOREINFO="NONE"@@connections - number of logins or attempted logins since SQL Server was last started. ID="IN4326643823"@@cpu_busy global variablecpu_busy global variable;atatcpu_busy global variable
MOREINFO="NONE"@@cpu_busy - amount of time, in ticks, that the CPU has spent doing  SQL Server work since the last time SQL Server was started. ID="IN4323624024"@@error global variableerror global variable;ataterror global variable
MOREINFO="NONE"@@error - commonly used to check the error status (succeeded or failed) of the most recently executed statement. It contains 0 if the previous transaction succeeded; otherwise, it contains the last error number generated by the system. A statement such as:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"if @@error != 0 returnREMAP="UN--Under"causes an exit if an error occurs.REMAP="UN--Under"Every Transact-SQL statement resets @@error, including MOREINFO="NONE"print statements or MOREINFO="NONE"ifID="IN436604225"TimingTiming@@error status checkerror status check
 tests, so the status check must immediately follow the statement whose success is in question.ID="IN4326584426"@@identity global variableidentity global variable;atatidentity global variable
MOREINFO="NONE"@@identity - last value inserted into an IDENTITY column by anMOREINFO="NONE" insert or MOREINFO="NONE"select into statement. @@identity is reset each time a row is inserted into a table. If a statement inserts multiple rows, @@identity reflects the IDENTITY value for the last row inserted. If the affected table does not contain an IDENTITY column, @@identity is set to 0. REMAP="UN--Under"The value of @@identity is not affected by the failure of anMOREINFO="NONE" insert or MOREINFO="NONE"select into statement, or the rollback of the transaction that contained it. @@identity retains the last value inserted into an IDENTITY column, even if the statement that inserted it fails to commit.ID="IN4322564627"@@idle global variableidle global variable;atatidle global variable
MOREINFO="NONE"@@idle - amount of time, in ticks, that SQL Server has been idle since it was last started. ID="IN4325544828"@@io_busy global variableio_busy global variable;atatio_busy global variable
MOREINFO="NONE"@@io_busy - amount of time, in ticks, that SQL Server has spent doing input and output operations since it was last started. ID="IN4327525029"@@isolation global variableisolation global variable;atatisolation global variable
MOREINFO="NONE"@@isolation - current isolation level of the Transact-SQL program. @@isolation takes the value of the active level (1 or 3).ID="IN4324505230"@@langid global variablelangid global variable;atatlangid global variable
MOREINFO="NONE"@@langid - defines the local language id of the language currently in use (specified in syslanguages.langid). ID="IN4326485431"@@language global variablelanguage global variable;atatlanguage global variable
MOREINFO="NONE"@@language - defines the name of the language currently in use (specified in syslanguages.name). ID="IN4328465632"@@maxcharlen global variablemaxcharlen global variable;atatmaxcharlen global variable
MOREINFO="NONE"@@maxcharlen - maximum length, in bytes, of a character in SQL Server's default character set. ID="IN4333445833"@@max_connections global variablemax_connections global variable;atatmax_connections global variable
MOREINFO="NONE"@@max_connections - maximum number of simultaneous connections that can be made with SQL Server in this computer environment. The user can configure SQL Server for any number of connections less than or equal to the value of @@max_connections with MOREINFO="NONE"sp_configure MOREINFO="NONE""user connections". ID="IN4327426034"@@ncharsize global variablencharsize global variable;atatncharsize global variable
MOREINFO="NONE"@@ncharsize - average length, in bytes, of a national character. ID="IN4327406235"@@nestlevel global variablenestlevel global variable;atatnestlevel global variable
MOREINFO="NONE"@@nestlevelID="IN436386436"LevelsLevels@@nestlevelnestlevel
 - nesting level of current execution (initially 0). Each time a stored procedure or trigger calls another stored procedure or trigger, the nesting level is incremented. If the maximum of 16 is exceeded, the transaction aborts. ID="IN4331366637"@@pack_received global variablepack_received global variable;atatpack_received global variable
MOREINFO="NONE"@@pack_receivedID="IN4324366638"Input packets, number of
 - number of input packets read by SQL Server since it was last started. ID="IN4327346839"@@pack_sent global variablepack_sent global variable;atatpack_sent global variable@@pack_sentID="IN4325346840"Output packets, number of
 - number of output packets written by SQL Server since it was last started. ID="IN4331327041"@@packet_errors global variablepacket_errors global variable;atatpacket_errors global variable@@packet_errorsID="IN436327042"Errorsnumber of packet
 - number of errors that have occurred while SQL Server was sending and receiving packets. ID="IN4324307243"@@procid global variableprocid global variable;atatprocid global variable@@procid - stored procedure ID of the currently executing procedure. ID="IN4326287444"@@rowcount global variablerowcount global variable;atatrowcount global variable
MOREINFO="NONE"@@rowcount - number of rows affected by the last command. MOREINFO="NONE"@@rowcount is set to zero by any command which does not return rows, such as an MOREINFO="NONE"if statement. With cursors, MOREINFO="NONE"@@rowcount represents the cumulative number of rows returned from the cursor result set to the client, up to the last MOREINFO="NONE"fetch request.ID="IN4328267645"@@servername global variableservername global variable;atatservername global variable
MOREINFO="NONE"@@servername - name of the local SQL Server. You must define a server name with MOREINFO="NONE"sp_addserver, and then restart SQL Server. ID="IN4322247846"@@spid global variablespid global variable;atatspid global variable
MOREINFO="NONE"@@spid - server process ID number of the current process. ID="IN4327228047"@@sqlstatus global variablesqlstatus global variable;atatsqlstatus global variable
MOREINFO="NONE"@@sqlstatus - contains status information resulting from the last MOREINFO="NONE"fetch statement. @@sqlstatus may contain the following values:TOCENTRY="1"LBL="Table 3-35: " ID="X93352"@@sqlstatus ValuesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="8*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The MOREINFO="NONE"fetch statement completed successfully.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The MOREINFO="NONE"fetch statement resulted in an error.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"There is no more data in the result set. This warning occurs if 
the current cursor position is on the last row in the result set 
and the client submits a MOREINFO="NONE"fetch command for that cursor.ID="IN4320208248"Number (quantity of)set textsize function
ID="IN434188449"SizeSize@@textsize global variabletextsize global variable;Size:atattextsize global variable
ID="IN4326168650"@@textsize global variabletextsize global variable;atattextsize global variable
MOREINFO="NONE"@@textsize - current value of the MOREINFO="NONE"set MOREINFO="NONE"textsize option, which specifies the maximum length, in bytes, of text or image data to be returned with a MOREINFO="NONE"select statement. Defaults to 32K. ID="IN4335148851"@@thresh_hysteresis global variablethresh_hysteresis global variable;atatthresh_hysteresis global variable
@@thresh_hysteresis - change in free space required to activate a threshold. This amount, also known as the hysteresis value, is measured in 2K database pages. It determines how closely thresholds can be placed on a database segment.ID="IN4327129052"@@timeticks global variabletimeticks global variable;atattimeticks global variable
MOREINFO="NONE"@@timeticks - number of microseconds per tick. The amount of time per tick is machine dependent. ID="IN4330109253"@@total_errors global variabletotal_errors global variable;atattotal_errors global variable
MOREINFO="NONE"@@total_errors - number of errors that have occurred while SQL Server was reading or writing. ID="IN432889454"@@total_read global variabletotal_read global variable;atattotal_read global variable
MOREINFO="NONE"@@total_read - number of disk reads by SQL Server since it was last started. ID="IN432969655"@@total_write global variabletotal_write global variable;atattotal_write global variable
MOREINFO="NONE"@@total_write - number of disk writes by SQL Server since it was last started. ID="IN432949856"@@tranchained global variabletranchained global variable;atattranchained global variable
MOREINFO="NONE"@@tranchained - current transaction mode of the Transact-SQL program. @@tranchained returns a 0 for unchained or a 1 for chained.ID="IN4327210057"@@trancount global variabletrancount global variable;atattrancount global variable
MOREINFO="NONE"@@trancountID="IN436010258"LevelsLevels@@trancount global variabletrancount global variable
 - nesting level of transactions. Each MOREINFO="NONE"begin transaction in a batch increments the transaction count. When you query @@trancount in chained transaction mode, its value is never zero since the query automatically initiates a transaction.ID="IN4327-210459"@@transtate global variabletranstate global variable;atattranstate global variable
MOREINFO="NONE"@@transtate - current state of a transaction after a statement executes. However, @@transtate does not get cleared for each statement, unlike @@error. @@transtate may contain the following values:TOCENTRY="1"LBL="Table 3-36: "@@transtate ValuesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="8*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction in progress: an explicit or implicit transaction is 
in effect; the previous statement executed successfully.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction succeeded: the transaction completed and 
committed its changes.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Statement aborted: the previous statement was aborted; no 
effect on the transaction.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction aborted: the transaction aborted and rolled back 
any changes.ID="IN4325-410660"@@version global variableversion global variable;atatversion global variable
MOREINFO="NONE"@@versionID="IN434-510761"Listglobal variables
 - date of the current version of SQL Server. See AlsoCommands     LINKEND="X40303"declare
MOREINFO="NONE", LINKEND="X69372"print
MOREINFO="NONE", LINKEND="X60573"raiserrorTopics     LINKEND="X84316"DatatypesSystem procedures     LINKEND="X58701"sp_monitor
ID="IN439-1311563"Variablesglobal;Variables:local;Global variables;Local variablesID="X18218"Wildcard CharactersID="IN4419-1611964"Wildcard characterswildcard
Represent one or more characters, or a range of characters, in a match string. Using WildcardsREMAP="BO--Body"Use wildcards in MOREINFO="NONE"where and MOREINFO="NONE"having clauses to find character or date/time information that is MOREINFO="NONE"like-or MOREINFO="NONE"not likeID="IN447-2112467"SymbolsSymbolsSee also Wildcard characters; Symbols section of this index!see also
-the match string:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"{where | having} [not]MOREINFO="NONE"expression [not] like MOREINFO="NONE"match_string    [escape "escape_character"]REMAP="BO--Body"expression can be any combination of column names, constants, or functions with a character value. REMAP="BO--Body"match_string is the pattern to be found in the expression. It can be a any combination of constants, variables, and column names or a concatenated expression, such as:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"like @variable + "%". REMAP="BO--Body"If the match string is a constant, it must always be enclosed in single or double quotes.The Percent (%) WildcardREMAP="BO--Body"Use the % wildcard to represent any string of zero or more characters. For example, to find all the phone numbers in the authors table that begin with the 415 area code:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select phonefrom authorswhere phone like "415%"REMAP="BO--Body"To find names that have the characters "en" in them (Bennet, Green, McBadden): REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_lname from authors where au_lname like "%en%" REMAP="BO--Body"Trailing blanks following "%" in a MOREINFO="NONE"like clause are truncated to a single trailing blank. For example, "%" followed by 2 spaces matches "X "(one space); "X  " (two spaces); "X   " (three spaces) or any number of trailing spaces.ID="IN4414-2112469"_ (underscore)character string wildcard;Underscore (_):character string wildcardThe Underscore (_) WildcardREMAP="BO--Body"Use the _ wildcard to represent any single character. For example, to find all six-letter names that end with "heryl" (Cheryl):REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_fname from authors where au_fname like "_heryl" ID="IN4427-2112471"[ ] (square brackets)character set wildcardBracketed ([ ]) CharactersID="IN445-2112473"Rangewildcard characters specifyingREMAP="BO--Body"Use brackets to enclose a range of characters, such as [a-f], or a set of characters such as [a2Br]. When ranges are used, all values in the sort order between (and including) MOREINFO="NONE"rangespec1 and MOREINFO="NONE"rangespec2 are returned. For example, [0-z] matches 0-9, A-Z and a-z (and several punctuation characters) in 7-bit ASCII.REMAP="BO--Body"To find names ending with "inger" and beginning with any single character between M and Z: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_lname from authors where au_lname like "[M-Z]inger" REMAP="BO--Body"To find both DeFrance and deFrance:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_lname from authors where au_lname like "[dD]eFrance" ID="IN4425-2112474"Square brackets [ ]caret wildcard symbol [^] and
ID="IN449-2112475"^ (caret)wildcard characterThe Caret (^) WildcardREMAP="BO--Body"The caret is the negative wildcard. Use it to find strings that do not match a particular pattern. For example, [^a-f] finds strings that are not in the range a-f and [^a2bR] finds strings that are not a, 2, b, or R.REMAP="BO--Body"To find names beginning with M where the second letter is not c:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select au_lname from authors where au_lname like "M[^c]%" ID="IN445-2112477"Rangewildcard characters specifyingREMAP="BO--Body"When ranges are used, all values in the sort order between (and including) MOREINFO="NONE"rangespec1 and MOREINFO="NONE"rangespec2 are returned. For example, [0-z] matches 0-9, A-Z , a-z, and several punctuation characters in 7-bit ASCII. ID="IN4416-2312678"not like keywordUsing not likeREMAP="BO--Body"Use MOREINFO="NONE"not like to find strings that do not match a particular pattern. These two queries are equivalent: they find all the phone numbers in the authors table that do not begin with the 415 area code. REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select phone from authors where phone not like "415%"  select phone from authors where not phone like "415%" Different Results from not like and ^REMAP="BO--Body"You cannot always duplicate MOREINFO="NONE"not like patterns with MOREINFO="NONE"like and the negative wildcard [^]. This is because MOREINFO="NONE"not like finds the items that do not match the entire MOREINFO="NONE"like pattern, while MOREINFO="NONE"like with negative wildcards is evaluated one character at a time. REMAP="BO--Body"For example, this query finds the system tables in a database whose names begin with "sys": REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select name from sysobjects where name like "sys%" REMAP="BO--Body"To see all the objects that are not system tables, useREMAP="UI--UserInput" FORMAT="LINESPECIFIC" not like "sys%"REMAP="BO--Body"If you have a total of 32 objects and the MOREINFO="NONE"like finds 13 names that match the pattern, the MOREINFO="NONE"not like will find exactly the 19 objects that do not match the MOREINFO="NONE"like pattern. REMAP="BO--Body"You won't always find the same names with a pattern such as MOREINFO="NONE"like "[^s][^y][^s]%"-instead of 19, you might get only 14, with all the names that begin with "s" or have "y" as the second letter or have "s" as the third letter eliminated from the results, as well as the system table names. This is because match strings with negative wildcards are evaluated in steps, one wildcard at a time. If the match fails at any point in the evaluation, it is eliminated. ID="IN4416-2412781"Case sensitivityCase sensitivityin comparison expressionscomparison expressionsCase and Accent InsensitivityREMAP="BO--Body"If your SQL Server uses a case-insensitive sort order, case is ignored when comparing expression and match_string. For example, this clause:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"where col_name like "Sm%" REMAP="BO--Body"would return "Smith", "smith" and "SMITH" on a case-insensitive SQL Server. ID="IN4418-2412783"Accent sensitivitywildcard characters andREMAP="BO--Body"If your SQL Server is also accent-insensitive, it will treat all accented characters as equal to each other and to their unaccented counterparts, both uppercase and lowercase. The MOREINFO="NONE"sp_helpsortID="IN4416-2512884"Case sensitivityCase sensitivityin comparison expressionscomparison expressions
 system procedure displays the characters that are treated as equivalent, displaying an "=" between them.ID="IN4424-2512885"Multibyte character setswildcard characters andUsing Multibyte Wildcard CharactersID="IN4422-2512887"Double-byte charactersREMAP="BO--Body"If the multibyte character set configured on your SQL Server defines equivalent double-byte characters for the wildcards _, %, - [, ], and ^, you can substitute the equivalent character in the match string. The underscore equivalent represents either a single- or double-byte character in the match string. ID="IN4419-2512888"Wildcard charactersliteral characters and;Wildcard characters:used as literal charactersID="X87433"Using Wildcards as Literal CharactersID="IN4431-2713090"Literal character specificationlike match stringREMAP="BO--Body"There are two ways to use %, _, [ ], or [^] as literal characters in a MOREINFO="NONE"like match string rather than as wildcards:MARK="BULL" REMAP="BU--Bullet"Square brackets (Transact-SQL extension)TheMOREINFO="NONE" escape clause (ANSI compliant)ID="IN4417-2713091"Escape charactersID="X26437"Using Square Brackets as Escape CharactersREMAP="BO--Body"Use square brackets as escape characters for the percent sign, the underscore, and the open bracket. The close bracket does not need an escape character; use it by itself. To use the dash as a literal character, it must be the first character inside a set of square brackets.TOCENTRY="1"LBL="Table 3-37: "Using Square Brackets to Search for WildcardsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="12*"COLNAME="C2" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like PredicateCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Meaning VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "5%"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5 followed by any string of 0 or more characters COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "5[%]"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5% COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "_n"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"an, in, on, etc. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "[_]n"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"_n COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "[a-cdf]"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"a, b, c, d, or f COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "[-acdf]"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-, a, c, d, or f COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "[[]"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"[ COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "]"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"] COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "[[]ab]"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"[]abID="IN4414-3013392"escape keywordUsing the escape ClauseREMAP="BO--Body"Use the MOREINFO="NONE"escape clause to specify an escape character. Any single character in the server's default character set can be used as an escape character. If you try to use more than one character as an escape character, SQL Server generates an exception.REMAP="BO--Body"Do not use existing wildcard characters as escape characters because:MARK="BULL" REMAP="BU--Bullet"If you specify the underscore ( _ ) or percent sign (%) as escape characters, they lose their special meaning within that MOREINFO="NONE"like predicate, and act only as escape characters.If you specify the open or close bracket ( [ or ] ) as an escape character, the Transact-SQL meaning of the bracket is disabled within that MOREINFO="NONE"like predicate.If you specify the dash or caret (- or ^) as escape characters, they lose the special meaning that they normally have within square brackets, and act only as escape characters.REMAP="BO--Body"An escape character retains its special meaning within square brackets, unlike the wildcard characters such as the underscore, the percent sign, and the open bracket.REMAP="BO--Body"The escape character is valid only within its MOREINFO="NONE"like predicate and has no effect on other MOREINFO="NONE"like predicates contained in the same statement. The only characters that are valid following an escape character are the wildcard characters ( _, %, [, ], or [^] ), and the escape character itself. The escape character affects only the character following it, and subsequent characters are not affected by it. REMAP="BO--Body"If the pattern contains two literal occurrences of the character that happens to be the escape character, the string must contain four consecutive escape characters. If the escape character does not divide the pattern into pieces of one or two characters, SQL Server returns an error message.REMAP="BO--Body"Following are examples of MOREINFO="NONE"like predicates with MOREINFO="NONE"escape clauses:.TOCENTRY="1"LBL="Table 3-38: "Using the escape Clause COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="21*"COLNAME="C2" COLWIDTH="16*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like PredicateCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "5@%" escape "@"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5%COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "*_n" escape "*"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"_nCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "%80@%%" escape "@"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"string containing 80%COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "*_sql**%" escape "*"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"string containing _sql*COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"like "%#####_#%%" escape "#"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"string containing ##_%ID="IN4417-3013393"Escape characterswildcard characters andREMAP="BO--Body"To enforce ANSI behavior and disable the special meaning of the square brackets, use MOREINFO="NONE"set fipsflagger onID="IN4414-3313694"escape keyword
.Wildcards Have No Special Meaning Without likeREMAP="BO--Body"Wildcards used without MOREINFO="NONE"like have no special meaning. For example, this query finds any phone numbers that start with the four characters 415%: REMAP="UI--UserInput" FORMAT="LINESPECIFIC"MOREINFO="NONE"select phone from authors where phone = "415%"Using Wildcards with datetime DataREMAP="BO--Body"When you use MOREINFO="NONE"like with datetime values, SQL Server converts the dates to the standard datetime format, and then to varchar. Since the standard storage format doesn't include seconds or milliseconds, you cannot search for seconds or milliseconds with MOREINFO="NONE"like and a pattern. REMAP="BO--Body"It is a good idea to use MOREINFO="NONE"like when you search for datetime values, since datetime entries may contain a variety of date parts. For example, if you insert the value "9:20" and the current date into a column named arrival_time, the clause:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where arrival_time = '9:20'REMAP="BO--Body"would not find it because SQL Server converts the entry into "Jan 1 1900 9:20AM." However, the clause below would find it:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"where arrival_time like '%9:20%' See AlsoCommands     LINKEND="X30827"where Clause
ID="IN4419-3613999"Wildcard characterswildcard
 REMAP="BO--Body"NUMBER="4" ID="X43361"System ProceduresID="IN4219921"Reference informationsystem procedures
ID="IN4569652"Procedures. See Stored procedures; System procedures
ID="IN4179383"Stored proceduresStored proceduresSee also Database objects; System procedures!see also Database objects; System procedures
ID="IN4139384"System tablesupdatingREMAP="BO--Body"This chapter describes the system procedures, which are Sybase-supplied stored procedures used for getting reports from and updating system tables. The following table lists the system procedures discussed in this chapter.TOCENTRY="1"LBL="Table 4-1:"System ProceduresCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="12*"COLNAME="C2" COLWIDTH="33*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ProcedureCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addalias COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allows a SQL Server user to be known in a database as 
another user.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addauditrecord COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allows users to enter user-defined audit records (comments) 
into the audit trail. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addgroup COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Adds a group to a database. Groups are used as collective names 
in granting and revoking privileges. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addlanguage COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Defines the names of the months and days for an alternate 
language and its date format. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addlogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Adds a new user account to SQL Server.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addmessage COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Adds user-defined messages to sysusermessages for use by 
stored procedure MOREINFO="NONE"print and MOREINFO="NONE"raiserror calls and byMOREINFO="NONE" 
sp_bindmsg. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addremotelogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Authorizes a new remote server user by adding an entry to 
master.dbo.sysremotelogins. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addsegment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Defines a segment on a database device in the current database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addserver COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Defines a remote server, or defines the name of the local server. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addthreshold COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates a threshold to monitor space on a database segment. 
When free space on the segment falls below the specified level, 
SQL Server executes the associated stored procedure. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addtype COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creates a user-defined datatype.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_addumpdevice COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Adds a dump device to SQL Server. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_adduser COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Adds a new user to the current database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditdatabase COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Establishes auditing of different types of events within a 
database, or of references to objects within that database from 
another database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditlogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits a SQL Server user's attempts to access tables and views; 
audits the text of a user's command batches; lists users on which 
auditing is enabled; gives the auditing status of a user; or 
displays the status of table, view, or command text auditing. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditobject COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits accesses to tables and views. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditoption COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enables or disables system-wide auditing and global audit 
options, or reports on the status of audit options. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_auditsproc  COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits the execution of stored procedures and triggers. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_bindefault COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Binds a default to a column or user-defined datatype.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_bindmsg COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Binds a user message to a referential integrity constraint or check 
constraint.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_bindrule COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Binds a rule to a column or user-defined datatype. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_changedbowner COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Changes the owner of a database. Do not change the owner of 
the sybsystemprocs database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_changegroup COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Changes a user's group. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_checknames COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Checks the current database for names that contain characters 
not in the 7-bit ASCII set. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_checkreswords COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Detects and displays identifiers that are Transact-SQL reserved 
words. Checks server names, device names, database names, 
segment names, user-defined datatypes, object names, column 
names, user names, login names, and remote login names. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_clearstats COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Initiates a new accounting period for all server users or for 
a specified user. Prints statistics for the 
previous period by executing MOREINFO="NONE"sp_reportstats.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_commonkey COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Defines a common key-columns that are frequently joined-
between two tables or views.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_configure COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays or changes configuration variables. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_cursorinfo COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a specific cursor or all cursors that are 
active. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dboption COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays or changes database options.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dbremap COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Forces SQL Server to recognize changes made by MOREINFO="NONE"alter database. 
Run this procedure only if instructed to do so by SQL Server 
messages. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_depends COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays information about database object dependencies-the 
view(s), trigger(s), and procedure(s) that depend on a specified 
table or view, and the table(s) and view(s) that are depended on 
by the specified view, trigger, or procedure.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_diskdefault COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sets a database device's status to MOREINFO="NONE"defaulton or MOREINFO="NONE"defaultoff. This 
indicates whether or not a database device can be used for 
database storage if the user does not specify a database device or 
specifies MOREINFO="NONE"default with the MOREINFO="NONE"create database or MOREINFO="NONE"alter database 
commands. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_displaylogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays information about a login account.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropalias COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes the alias user name identity established with 
MOREINFO="NONE"sp_addalias. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropdevice COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a SQL Server database device or dump device. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropgroup COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a group from a database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropkey COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes from the syskeys table a key that had been 
defined using MOREINFO="NONE"sp_primarykey, MOREINFO="NONE"sp_foreignkey, or 
MOREINFO="NONE"sp_commonkey. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_droplanguage COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops an alternate language from the server and removes its 
row from master.dbo.syslanguages. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_droplogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a SQL Server user login by deleting the user's entry in 
master.dbo.syslogins. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropmessage COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops user-defined messages from sysusermessages. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropremotelogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a remote user login. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropsegment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a segment from a database or unmaps a segment from a 
particular database device. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropserver COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a server from the list of known servers. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropthreshold COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Removes a free-space threshold from a segment. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_droptype COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a user-defined datatype. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_dropuser COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drops a user from the current database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_estspace COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Estimates the amount of space required for a table and its 
indexes, and the time needed to create the index. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_extendsegment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Extends the range of a segment to another database device, or 
extends an existing segment on the current database device. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_foreignkey COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Defines a foreign key on a table or view in the current database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_getmessage COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Retrieves stored message strings from sysmessages and 
sysusermessages for MOREINFO="NONE"print and MOREINFO="NONE"raiserror statements.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_help COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a database object (any object listed in 
sysobjects), and about SQL Server-supplied or user-
defined datatypes.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpconstraint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about any integrity constraints specified for 
a table. This information includes the constraint name and the 
definition of the default, unique/primary key constraint, 
referential constraint, or check constraint. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpdb COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a particular database or about all 
databases.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpdevice COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a particular device or about all SQL 
Server database devices and dump devices. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpgroup COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a particular group or about all groups 
in the current database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpindex COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about the indexes created on a table. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpjoins COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Lists the columns in two tables or views that are likely join 
candidates.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpkey COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a primary, foreign, or common key of 
a particular table or view, or about all keys in the current 
database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helplanguage COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a particular alternate language or 
about all languages. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helplog COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports the name of the device that contains the first page of the 
log. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpremotelogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a particular remote server's logins or 
about all remote servers' logins.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helprotect COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports on permissions for database objects, users, or groups. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpsegment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information on a particular segment or on all of the 
segments in the current database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpserver COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a particular remote server or about all 
remote servers.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpsort COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays SQL Server's default sort order and character set.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helptext COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Prints the text of a system procedure, trigger, view, default, rule, 
or integrity check constraint. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpthreshold COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports the segment, free-space value, status, and stored 
procedure associated with all thresholds in the current database 
or all thresholds for a particular segment. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_helpuser COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about a particular user or about all users in 
the current database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_indsuspect COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Checks user tables for indexes that have been marked as suspect 
during recovery following a sort order change. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_lock COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information about processes that currently hold locks. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_locklogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Locks a SQL Server account so that the user cannot log in, or 
displays a list of all locked accounts. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_logdevice COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Puts the system table syslogs, which contains the transaction log, 
on a separate database device. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_modifylogin COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Modifies the default database, default language, or full name for 
a SQL Server login account. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_modifythreshold COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Modifies a threshold by associating it with a different threshold 
procedure, level of free space, or segment. You cannot use 
MOREINFO="NONE"sp_modifythreshold to change the amount of free space or the 
segment name for the last-chance threshold. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_monitor COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays statistics about SQL Server. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_password COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Adds or changes a password for a SQL Server login account. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_placeobject COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Puts future space allocations for a table or index on a particular 
segment.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_primarykey COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Defines a primary key on a table or view. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_procxmode COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays or changes the transaction modes associated with 
stored procedures. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_recompile COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Causes each stored procedure and trigger that uses the named 
table to be recompiled the next time it runs. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_remap COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Remaps a Release 4.8 or later stored procedure, trigger, rule, 
default, or view to be compatible with Release 10.0. UseMOREINFO="NONE" 
sp_remap on objects that the Release 10.0 upgrade procedure 
failed to remap. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_remoteoption COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays or changes remote login options. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_rename COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Changes the name of a user-created object in the current 
database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_renamedb COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Changes the name of a database. You MOREINFO="NONE"cannot rename system 
databases or databases with external referential integrity 
constraints. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_reportstats COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports statistics on system usage. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_role COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Grants or revokes roles to a SQL Server login account.  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_serveroption COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays or changes remote server options. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_setlangalias COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Assigns or changes the alias for an alternate language. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_spaceused COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays the number of rows, the number of data pages, and the 
space used by one table or by all tables in the current database. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_syntax COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Displays the syntax of Transact-SQL statements, system 
procedures, utilities, and other routines (depending on which 
products and corresponding MOREINFO="NONE"sp_syntax scripts exist on your 
server).  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_thresholdaction COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Executes automatically when the number of free pages on the 
log segment falls below the last-chance threshold (unless the 
threshold has been associated with a different procedure). 
Sybase does not provide this procedure. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_unbindefault COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Unbinds a created default value from a column or from a user-
defined datatype. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_unbindmsg COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Unbinds a user-defined message from a constraint. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_unbindrule COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Unbinds a rule from a column or from a user-defined datatype. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Notifies the Backup Server that the operator performed the 
requested volume handling during a dump or load. (OpenVMS 
users can use REPLY instead.) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_who COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reports information  about all current SQL Server users and 
processes, or about  a particular user or process.   ID="IN4491105"Listsystem procedures;System procedures:list ofRENDERAS="SECT1"Introduction to System ProceduresREMAP="BO--Body"The system procedures, created by installmaster at installation, are located in the MOREINFO="NONE"sybsystemprocs database and are owned by the System Administrator, but many of them can be run from any database. REMAP="BO--Body"If a system procedure is executed in a database other than MOREINFO="NONE"sybsystemprocs, it operates on the system tables in the database from which it was executed. For example, if the Database Owner of pubs2 runs MOREINFO="NONE"sp_adduser from pubs2, the new user is added to pubs2..sysusers. RENDERAS="SECT2"ID="IN41791106"System procedurespermissions;Permissions:system procedures
ID="IN43488137"Access. See Permissions; Users
ID="IN42685168"Authority. See Permissions
Permissions on System ProceduresREMAP="BO--Body"Since system procedures are located in the MOREINFO="NONE"sybsystemprocs database, their permissions are also set there. REMAP="BO--Body"Some system procedures can be run only by Database Owners. These procedures make sure that the user executing the procedure is the owner of the database from which they are being executed. REMAP="BO--Body"Other system procedures (for example, all the MOREINFO="NONE"sp_help procedures) can be executed by any user who has been granted permission-but this permission must be granted in MOREINFO="NONE"sybsystemprocs. In other words, a user must have permission to execute a system procedure in all databases, or in none of them. ID="IN42383189"sybsystemprocs databasepermissions andREMAP="BO--Body"Users not listed in MOREINFO="NONE"sybsystemprocs..sysusersID="IN45812010"UsersGuest userssystem procedure permissions and;Guest users:in sybsystemprocs databasesybsystemprocs database
 are treated as "guest" in MOREINFO="NONE"sybsystemprocs, and thus are automatically granted permission on many of the system procedures. To deny a user permission on a system procedure, the System Administrator must add the user to MOREINFO="NONE"sybsystemprocs..sysusers and write a MOREINFO="NONE"revoke statement that applies to that procedure. The owner of a user database cannot directly control permissions on the system procedures within his or her own database. RENDERAS="SECT2"ID="IN417802111"System proceduresusing
Using System Procedures   ID="IN411802112"Punctuationenclosing in quotation marks
ID="IN46802113"BlanksBlanksin system procedure parameter valuessystem procedure parameter values
ID="IN414802114"Reserved wordssystem procedures and
ID="IN434772415"Single quotes. See Quotation marks
ID="IN421772416"Quotation marks (" ")enclosing values in;" " (quotation marks):enclosing values inREMAP="BO--Body"If a parameter value for a system procedure contains punctuation or embedded blanks, or is a reserved word, you must enclose it in single or double quotes. If the parameter is an object name qualified by a database name or owner name, enclose the entire name in single or double quotes. Do not use delimited identifiers as system procedure parameters; they may produce unexpected results.ID="IN413772417"Return statussystem proceduresREMAP="BO--Body"All system procedures report a return status. For example:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"MOREINFO="NONE"return status = 0 REMAP="BO--Body"means that the procedure executed successfully. The examples in this book do not include the return status.REMAP="BO--Body"You can create your own system procedures that can be executed from any database. (See BOOK="sag" LINKEND="X52556"Chapter 1,  "Overview of System Administration" 
in the System Administration GuideID="IN417762518"System proceduresusing
 for more information.) RENDERAS="SECT2"Values for Optional ParametersREMAP="BO--Body"If a procedure has multiple optional parameters you can supply parameters in the form:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"@parametername = valueREMAP="BO--Body"than to supply all of the parameters. The parameter names in the syntax statements match the parameter names defined by the procedures.REMAP="BO--Body"For example, the syntax for MOREINFO="NONE"sp_addlogin is:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"sp_addlogin MOREINFO="NONE"login_name, MOREINFO="NONE"password [, MOREINFO="NONE"defdb [,MOREINFO="NONE" deflanguage [, fullname]]]REMAP="BO--Body"To use MOREINFO="NONE"sp_addlogin to create a login for "susan" with a password of "wonderful", a full name of Susan B. Anthony, and the server's default database and language, you can use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_addlogin susan, wonderful,      @fullname="Susan B. Anthony"REMAP="BO--Body"This provides the same information as the command with all of the parameters specified:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_addlogin susan, wonderful, public_db,     us_english, "Susan B. Anthony"REMAP="BO--Body"You can also use "null" as a placeholder:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_addlogin susan, wonderful, null, null,      "Susan B. Anthony"REMAP="BO--Body"Do not enclose "null" in quotes.ID="IN413762519"System tablessystem procedures andRENDERAS="SECT2"System Procedure Tables   ID="IN415742720"master databasesystem procedure tablesREMAP="BO--Body"Several system procedure tables in the masterID="IN416722921"spt_values table
 database are used by system procedures to convert internal system values (for example, status bits) into human-readable format. One of them, spt_values, is used by MOREINFO="NONE"sp_addsegment, MOREINFO="NONE"sp_addtype, MOREINFO="NONE"sp_addumpdevice, MOREINFO="NONE"sp_checkreswords , MOREINFO="NONE"sp_commonkey, MOREINFO="NONE"sp_configure, MOREINFO="NONE"sp_dboption, MOREINFO="NONE"sp_depends, MOREINFO="NONE"sp_dropsegment, MOREINFO="NONE"sp_dropuser, MOREINFO="NONE"sp_estspace, MOREINFO="NONE"sp_extendsegment, MOREINFO="NONE"sp_foreignkey , MOREINFO="NONE"sp_help, MOREINFO="NONE"sp_helpdb, MOREINFO="NONE"sp_helpdevice, MOREINFO="NONE"sp_helpindex, MOREINFO="NONE"sp_helpjoins, MOREINFO="NONE"sp_helpkey, MOREINFO="NONE"sp_helplog, MOREINFO="NONE"sp_helpremotelogin, MOREINFO="NONE"sp_helprotect, MOREINFO="NONE"sp_helpsegment, MOREINFO="NONE"sp_helpserver, MOREINFO="NONE"sp_helpsort, MOREINFO="NONE"sp_remoteoption, MOREINFO="NONE"sp_renamedb, MOREINFO="NONE"sp_serveroption, MOREINFO="NONE"sp_setreplicate, and MOREINFO="NONE"sp_spaceused. REMAP="BO--Body"spt_values is never updated. To see how it is used, execute MOREINFO="NONE"sp_helptext to look at the text for one of the system procedures that references it. ID="IN416722922"Temporary tablessystem procedures andREMAP="BO--Body"The other system procedure tables areID="IN419703123"spt_committab table
 spt_committab and ID="IN417683324"spt_monitor table
spt_monitor. In addition, some system procedures create and then drop temporary tables: MOREINFO="NONE"sp_helpdbID="IN425663525"#spdbdesc temporary tablespdbdesc temporary table
 creates #spdbdesc; MOREINFO="NONE"sp_helpdevice creates ID="IN425643726"#spdevtab temporary tablespdevtab temporary table
#spdevtab; MOREINFO="NONE"sp_helpindexID="IN425623927"#spindtab temporary tablespindtab temporary table
 creates #spindtab; and MOREINFO="NONE"sp_helpserver creates ID="IN427604128"#spt_server temporary tablespt_server temporary table
#spt_serverID="IN421594229"Reference informationsystem procedures
. REMAP="BO--Body"ID="X12007"sp_addaliasID="IN4369663"Loginsalias;Names:alias
ID="IN4379484"Aliasessp_addalias and
ID="IN4369395"Addingaliases
ID="IN43792106"Aliasesassigning
ID="IN43789137"AliasesAliasesSee also Logins; Users!see also Logins; Users
ID="IN433186168"Alternate identity. See Aliases
ID="IN432883199"Temporary names. See Aliases
Allows a SQL Server user to be known in a database as another user. FORMAT="LINESPECIFIC"sp_addalias MOREINFO="NONE"login_name, MOREINFO="NONE"name_in_dbParametersREMAP="RI--RefIndent"MOREINFO="NONE"login_name - is the MOREINFO="NONE"master.dbo.syslogins name of the user who wants an alternate identity in the current database.MOREINFO="NONE"name_in_db - is the database user name to alias MOREINFO="NONE"login_name to. The name must exist in both MOREINFO="NONE"master.dbo.syslogins and in the sysusers table of the current database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addalias victoria, albertREMAP="UN--Under"There is a user named "albert" in the database's sysusers table and a login for a user named "victoria" in MOREINFO="NONE"master.dbo.syslogins. This command allows "victoria" to use the current database by assuming the name "albert". CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_addaliasID="IN437802214"MappingMappingSee also Aliases!see also Aliases
ID="IN4319782415"sysalternates tablealiases
 maps one user to another in the current database. The mapping is shown in MOREINFO="NONE"sysalternates, where the two users' MOREINFO="NONE"suidsID="IN4326752716"Linking users. See Aliases
 are connected. A user may be aliased to only one database user at a time.A report on any users mapped to a specified user can be generated with MOREINFO="NONE"sp_helpuser, giving the specified user's name as an argument.When a user tries to use a database, SQL Server checks MOREINFO="NONE"sysusers to see if the user is listed there. If the user is not there, it then checks MOREINFO="NONE"sysalternates. If the user's MOREINFO="NONE"suid is in MOREINFO="NONE"sysalternates, mapped to a database user's MOREINFO="NONE"suid, the first user is treated as the second user while using the database. ID="IN435732917"Userssysusers tableREMAP="UN--Under"If the user named in MOREINFO="NONE"login_name is in the database's sysusersID="IN4319693318"sysalternates tablesysusers table and
ID="IN4314653719"sysusers tablesysalternates table and
 table, SQL Server won't find the user's alias identity, since it checks sysusersID="IN437633920"Aliasessysalternates table
 before checking MOREINFO="NONE"sysalternates, where the alias is listed.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Alias user added.REMAP="UN--Under"The procedure was successful. Now MOREINFO="NONE"login_name can use the current database. While doing so, the user is known as MOREINFO="NONE"name_in_db. MOREINFO="NONE"'login_name
MOREINFO="NONE"' is already a user in the current database.REMAP="UN--Under"A user with a login in the current database cannot be aliased to another login in that database.MOREINFO="NONE"No login with the specified name exists.REMAP="UN--Under"There is no entry in MOREINFO="NONE"master.dbo.syslogins for MOREINFO="NONE"login_name. Everyone using SQL Server, whether aliased or not, must have a login. MOREINFO="NONE"No user with the specified name exists in the current database.REMAP="UN--Under"Since MOREINFO="NONE"name_in_db is not a user in the database, MOREINFO="NONE"login_name can't be aliased to it. MOREINFO="NONE"The specified user name is already aliased.REMAP="UN--Under"The MOREINFO="NONE"login_name is already aliased to a user in the current database. A MOREINFO="NONE"login_name may be aliased to only one database user at a time. To change an alias, first drop the current alias using MOREINFO="NONE"sp_dropalias. Then add the new alias. PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_addalias. Tables UsedREMAP="BO--Body"master.dbo.syslogins, sysalternates, sysobjects, sysusers See Also Commands     LINKEND="X39034"useSystem ProceduresLINKEND="X25636"sp_addlogin
, LINKEND="X68639"sp_adduser
,  LINKEND="X47662"sp_dropalias
, LINKEND="X28192"sp_helpuser
ID="IN437624025"Aliasesassigning
ID="IN436614126"Addingaliases
ID="IN4328574527"sp_addalias system procedure
ID="IN4334534928"sp_addauditrecord system procedure
ID="IN4311534929"Audit trailcomments, adding
ID="IN438534930"Commentsadding to audit trail
ID="IN4311534931"Audit trailadding comments toID="X86229"sp_addauditrecordID="IN448535033"Auditingrecords (comments) and
ID="IN4414535034"Records, audit
Allows users to enter user-defined audit records (comments) into the audit trail.FORMAT="LINESPECIFIC"sp_addauditrecord [@text="message text"] [, @db_name="db_name"] [, @obj_name="object_name"][, @owner_name="object_owner"] [, @dbid=database_ID] [, @objid=object_ID]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"@text - is the text of the message to add to sysaudits. The text is inserted into the extrainfo field of sysaudits.MOREINFO="NONE"@db_name - is the name of the database referred to in the record. This is inserted into the dbname field of sysaudits.MOREINFO="NONE"@obj_name - is the name of the object referred to in the record. This is inserted into the objname field of sysaudits.MOREINFO="NONE"@owner_name - is the owner of the object referred to in the record. This is inserted into the objowner field of sysaudits.MOREINFO="NONE"@dbid - is the database ID number of db_name. Do not enclose this integer value in quotes. MOREINFO="NONE"@dbid is inserted into the dbid field of sysaudits.MOREINFO="NONE"@objid - is the object ID number of obj_name. Do not enclose this integer value in quotes. MOREINFO="NONE"@objid is inserted into the objid field of sysaudits.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addauditrecord @text="I gave A. Smith permission to view the payroll table in the corporate database. This permission was in effect from 3:10 to 3:30 pm on 9/22/92.", @db_name="corporate", @obj_name="payroll", @owner_name="dbo", @dbid=10, @objid=1004738270REMAP="UN--Under"Adds this record to sysaudits. The message portion is entered into the extrainfo field of sysaudits, "corporate" into the dbname field, "payroll" into the objname field, "dbo" into the objowner field, "10" into the dbid field, and "1004738270" into the objid field.sp_addauditrecord @text="I am disabling auditing briefly while we reconfigure the system", @db_name="corporate"REMAP="UN--Under"Adds this record to sysaudits. This example uses parameter names, with the @ prefix. This format allows you to leave some fields empty.CommentsMARK="BULL" REMAP="BU--Bullet"You can use MOREINFO="NONE"sp_addauditrecord if:MARK="DASH" REMAP="BS--BulletSub"You have been granted execute permission on MOREINFO="NONE"sp_addauditrecord. (No special role is required.)Auditing is enabled (MOREINFO="NONE"sp_auditoption "enable auditing" is set to MOREINFO="NONE"on).The MOREINFO="NONE"adhoc records option of MOREINFO="NONE"sp_auditoption is set to MOREINFO="NONE"on.MOREINFO="NONE"sp_addauditrecord does not check the correctness of the information you enter. For example, it does not check to see if the database ID you have entered is correct for the database referred to in the audit record.MessagesREMAP="BO--Body"None.PermissionsREMAP="BO--Body"Permission to execute MOREINFO="NONE"sp_addauditrecord defaults to the System Security Officer and the Database Owner of the sybsecurity database. The Database Owner can grant execute permission to other users.Tables UsedREMAP="BO--Body"MOREINFO="NONE"sybsecurity.dbo.sysauditsSee Also Topics     LINKEND="X26589"AuditingSystem procedures     LINKEND="X42468"sp_auditoption
ID="IN4434495445"sp_addauditrecord system procedure
ID="IN4428455846"sp_addgroup system procedureID="X65925"sp_addgroupID="IN456426248"Groupssp_addgroup
ID="IN456406449"Addinggroup to a database;Adding:users to a group
Adds a group to a database. Groups are used as collective names in granting and revoking privileges. FORMAT="LINESPECIFIC"sp_addgroup MOREINFO="NONE"grpname ParametersREMAP="RI--RefIndent"MOREINFO="NONE"grpname - is the name of the group. Group names must conform to the rules for identifiers. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addgroup accounting REMAP="UN--Under"Creates a group named MOREINFO="NONE"accounting. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_addgroup adds the new group to a database's MOREINFO="NONE"sysusers table. Each group's user ID (MOREINFO="NONE"uid) is 16384 or larger (except "public," which is always 0). Once a group has been created, add new users with MOREINFO="NONE"sp_adduser. To add an already existing user to a group, use MOREINFO="NONE"sp_changegroup. ID="IN4514386654""public" grouppublic groupsp_addgroup andsp_addgroup andEvery database is created with a group named "public." Every user is automatically a member of "public." Each user can be a member of one additional group.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"A group with the specified name already exists.REMAP="UN--Under"The group name you supplied is being used as a group name. Choose another name. MOREINFO="NONE"A user with the specified group name already exists.REMAP="UN--Under"The group name you supplied is being used as a user name. Choose another name. MOREINFO="NONE"grpname is not a valid name.REMAP="UN--Under"Group names must conform to the rules for identifiers. MOREINFO="NONE"New group added.REMAP="UN--Under"The group has been added to the current database's MOREINFO="NONE"sysusers table. PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_addgroup. Tables UsedREMAP="BO--Body"sysobjects, sysusers See AlsoCommands     LINKEND="X69087"grant
, LINKEND="X29921"revokeSystem procedures     LINKEND="X68639"sp_adduser
, LINKEND="X18596"sp_changegroup
, LINKEND="X17416"sp_dropgroup
, LINKEND="X25329"sp_helpgroup
ID="IN4528347059"sp_addgroup system procedure
ID="IN456327260"Addinggroup to a database;Adding:users to a group
ID="IN456297561"Groupssp_addgroup
ID="IN4531257962"sp_addlanguage system procedureID="X44244"sp_addlanguageID="IN4617248164"Language defaultsadding
ID="IN4620248165"Languages, alternatemonth and day names in
ID="IN4620248166"Languages, alternatedate formats in
ID="IN4645218467"Alternate languages. See Languages, alternate
Defines the names of the months and days for an alternate language, and its date format.FORMAT="LINESPECIFIC"sp_addlanguage MOREINFO="NONE"language, MOREINFO="NONE"alias, MOREINFO="NONE"months, MOREINFO="NONE"shortmons, MOREINFO="NONE"days, MOREINFO="NONE"datefmt, MOREINFO="NONE"datefirst ParametersREMAP="RI--RefIndent"MOREINFO="NONE"language - is the official language name for the language, entered in 7-bit ASCII characters only. ID="IN467218470"Aliaseslanguage name
MOREINFO="NONE"alias - substitutes for the alternate language's official name. Enter either "null" to make the alias the same as the official language name, or a name you prefer. You can use 8-bit ASCII characters in an alias-française, for example-if your terminal supports them. ID="IN4612218471"Month valuesalternate language
MOREINFO="NONE"months - is a list of the full names of the 12 months, ordered from January through December, separated only by commas (no spaces allowed). Month names can be up to 20 characters long and can contain 8-bit ASCII characters. MOREINFO="NONE"shortmons - is a list of the abbreviated names of the 12 months, ordered from January through December, separated only by commas (no spaces allowed). Month abbreviations can be up to nine characters long and can contain 8-bit ASCII characters. ID="IN4610218472"Day valuesalternate language
MOREINFO="NONE"days - is a list of the full names of the seven days, ordered from Monday through Sunday, separated only by commas (no spaces allowed). Day names can be up to 30 characters long and can contain 8-bit ASCII characters. ID="IN465218473"OrderOrderof date partsdate parts
MOREINFO="NONE"datefmt - is the date order of the date parts MOREINFO="NONE"month/day/yearID="IN4610218474"Date partsorder of
 for entering datetime or smalldatetime data. Valid arguments are mdy, dmy, ymd, ydm, myd, or dym. "dmy" indicates that dates are in day/month/year order. ID="IN4618218475"Weekday date valuefirst
MOREINFO="NONE"datefirst ID="IN467218476"Numbersweekday names and
ID="IN4618218477"Weekday date valuenames and numbers
- sets the number of the first weekday for date calculations. For example, Monday is 1, Tuesday is 2, and so on. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addlanguage french, null,   "janvier,fevrier,mars,avril,mai,juin,juillet,    aout,septembre,octobre,novembre,decembre",     "jan,fev,mars,avr,mai,juin,jui,aout,sept,oct,    nov,dec",    "lundi,mardi,mercredi,jeudi,vendredi,samedi,    dimanche",     dmy, 1REMAP="UN--Under"This stored procedure adds French to the languages available on the server. "null" makes the alias the same as the official name, "french". Date order is "dmy"-"day/month/year". "1" specifies that lundi, the first item in the days list, is the first weekday. Because the French do not capitalize the names of the days and months except when they appear at the beginning of a sentence, this example shows them being added in lowercase. CommentsMARK="BULL" REMAP="BU--Bullet"Normally, add alternate languages from one of SQL Server's Language Modules using the MOREINFO="NONE"sybinit installation program. A Language Module supplies the names of the dates and translated error messages for that language. However, if a Language Module is not provided with your server, use MOREINFO="NONE"sp_addlanguage to define the date names and format.MOREINFO="NONE"sp_addlanguage creates an entry in MOREINFO="NONE"master.dbo.syslanguages, inserting a unique numeric value in the MOREINFO="NONE"langid column for each alternate language. MOREINFO="NONE"langidID="IN4619218480"us_english language
 0 is reserved for us_english. Users can display a list of the alternate languages on the server with MOREINFO="NONE"sp_helplanguage. They can change their own default language to any on the list with MOREINFO="NONE"sp_modifylogin. ID="IN4622218481"Official language nameThe official language name in the name column ofMOREINFO="NONE" master.dbo.syslanguagesID="IN4622188782"Official language nameOfficial language nameSee also Aliases; Languages, alternate!see also
 must be unique. The alias column in MOREINFO="NONE"master.dbo.syslanguages is set to the official language name if NULL is entered for alias, but System Administrators can change the value of syslanguage.alias with MOREINFO="NONE"sp_setlangalias. The upgrade column in MOREINFO="NONE"master.dbo.syslanguages is set to 0. SQL Server sends date values to clients as datatime datatype, and the clients use localization files to display the dates in the user's current language. For date strings added with MOREINFO="NONE"sp_addlanguage, use the MOREINFO="NONE"convert function to convert the dates to character data in the server:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select convert(char, pubdate) from tableREMAP="UN--Under"where pubdate is datetime data and table is any table.When users perform data entry on date values and need to use date names created with MOREINFO="NONE"sp_addlanguage, the client must have these values input as character data, and sent to the server as character data. If users set default languages to a language added with MOREINFO="NONE"sp_addlanguage, and there are no localization files for the language, they receive an informational message when they log in, indicating that their client software could not open the localization files.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"'language
MOREINFO="NONE"' already exists in syslanguages.REMAP="UN--Under"This language already exists on the server. To change only the language alias, use MOREINFO="NONE"sp_setlangalias. To change months, MOREINFO="NONE"shortmons, MOREINFO="NONE"days, MOREINFO="NONE"datefmt, or MOREINFO="NONE"datefirst, drop the language with MOREINFO="NONE"sp_droplanguage, then add it again with your new specifications. MOREINFO="NONE"List of full month names contains spaces, which are not allowed.REMAP="UN--Under"Separate month names only by commas; no spaces are allowed.MOREINFO="NONE"List of full month names contains name(s) which have iso_1 non-alphabetic characters.REMAP="UN--Under"Month names cannot contain non-alphabetic characters, such as punctuation. MOREINFO="NONE"List of full month names has too few names.REMAP="UN--Under"The months list must have exactly 12 names separated by exactly 11 commas. MOREINFO="NONE"List of full month names has too many names.REMAP="UN--Under"The months list must have exactly 12 names separated by exactly 11 commas. MOREINFO="NONE"List of full month names has name(s) which are too long.REMAP="UN--Under"One or more names in the list of full month names is more than 20 characters long. MOREINFO="NONE"List of short month names contains spaces, which are not allowed.REMAP="UN--Under"Short month names cannot contain non-alphabetic characters, such as spaces. MOREINFO="NONE"List of short month names contains name(s) which have iso_1 non-alphabetic characters.REMAP="UN--Under"Short month names cannot contain non-alphabetic characters, such as punctuation. MOREINFO="NONE"List of short month names has too few names.REMAP="UN--Under"The months list must have exactly 12 names separated by exactly 11 commas. MOREINFO="NONE"List of short month names has too many names.REMAP="UN--Under"The months list must have exactly 12 names separated by exactly 11 commas. MOREINFO="NONE"List of short month names has name(s) which are too long.REMAP="UN--Under"One or more names in the list of short month names is more than nine characters long. MOREINFO="NONE"List of day names contains spaces, which are not allowed.REMAP="UN--Under"Day names cannot contain non-alphabetic characters, such as spaces. MOREINFO="NONE"List of day names contains name(s) which have iso_1 non-alphabetic characters.REMAP="UN--Under"Day names cannot contain non-alphabetic characters, such as punctuation. MOREINFO="NONE"List of day names has too few names.REMAP="UN--Under"The days list must have exactly seven names separated by exactly six commas. MOREINFO="NONE"List of day names has too many names.REMAP="UN--Under"The days list must have exactly seven names separated by exactly six commas. MOREINFO="NONE"List of day names has name(s) which are too long.REMAP="UN--Under"One or more names in the list of day names is more than 30 characters long. MOREINFO="NONE"'datefmt
MOREINFO="NONE"' is not a valid date order.REMAP="UN--Under"datefmt must be in one of the following six orders: "mdy", "myd", "dmy," "dym", "ydm", "ymd". MOREINFO="NONE"'datefirst
MOREINFO="NONE"' is not a valid first day.REMAP="UN--Under"The first day of a week must be 1 for Monday through 7 for Sunday. MOREINFO="NONE"'alias
MOREINFO="NONE"' alias already exists in syslanguages.REMAP="UN--Under"The name given as an alias is already in use as an alias in the tableMOREINFO="NONE" master.dbo.syslanguages. If alias was specified as NULL, then the official language name for this new language is already in use as the alias for another language. MOREINFO="NONE"Language not inserted.REMAP="UN--Under"An error occurred while adding this language to MOREINFO="NONE"master.dbo.syslanguages, so the language was not added. The SQL Server error message that appeared before this message gives more specific information about the error. MOREINFO="NONE"New language inserted.REMAP="UN--Under"A new alternate language was added to SQL Server and MOREINFO="NONE"master.dbo.syslanguages. PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_addlanguage.Tables UsedREMAP="BO--Body"master.dbo.syslanguages, sysobjectsSee AlsoCommands     LINKEND="X64136"set
ID="IN4617178887"Language defaultsadding
    System procedures     LINKEND="X82772"sp_droplanguage
MOREINFO="NONE", LINKEND="X13013"sp_helplanguage
MOREINFO="NONE", LINKEND="X76169"sp_setlangalias
MOREINFO="NONE", LINKEND="X24535"sp_modifylogin
ID="IN4631139288"sp_addlanguage system procedure
 ID="IN462899689"sp_addlogin system procedureID="X25636"sp_addloginID="IN47689891"Loginsadding to servers
ID="IN47579992"Usersadding
ID="IN476610093"Addingusers to a database
ID="IN476510194"Addinglogins
Adds a new user account to SQL Server. FORMAT="LINESPECIFIC"sp_addlogin MOREINFO="NONE"login_name, MOREINFO="NONE"password [, MOREINFO="NONE"defdb [,MOREINFO="NONE" deflanguage [, fullname]]]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"login_name - is the user's login name. Login names must conform to the rules for identifiers. It is highly recommended that users' SQL Server login names be the same as their operating system login names. This makes login to SQL Server easier, simplifies management of server and operating system login accounts, and makes it easier to correlate audit data generated by SQL Server and by the operating system.ID="IN479510198"Passwords
MOREINFO="NONE"password - is the user's password. Passwords must be at least six bytes long. If you specify a shorter password, MOREINFO="NONE"sp_addlogin returns an error message and exits.MOREINFO="NONE"defdb - is the name of the default database assigned when a user logs in to SQL Server. If you do not specify defdb, the default is master. ID="IN478510199"Defaultslanguage;Language defaults
MOREINFO="NONE"deflanguage - is the official name of the default language assigned when a user logs in to SQL Server. The server's default language, defined by the configuration variable MOREINFO="NONE"default language, is used if you do not specify deflanguageID="IN47393103100"default language configuration variable
. MOREINFO="NONE"fullname - is the full name of the user who owns the login account. This can be used for documentation and identification purposes.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addlogin albert, longer1, corporate REMAP="UN--Under"Creates a SQL Server login for "albert". His password is "longer1" and his default database is corporate. sp_addlogin claire, bleurouge, public_db, french REMAP="UN--Under"Creates a SQL Server login for "claire". Her password is "bleurouge", her default database is public_db, and her default language is French. sp_addlogin robertw, terrible2, public_db, null,    "Robert Willis"REMAP="UN--Under"Creates a SQL Server login for "robertw". His password is "terrible2", his default database is public_db, and his full name is "Robert Willis". MOREINFO="NONE"null must not be placed in quotes.sp_addlogin susan, wonderful, null, null,     "Susan B. Anthony"REMAP="UN--Under"Creates a login for "susan" with a password of "wonderful", a full name of Susan B. Anthony, and the server's default database and language. MOREINFO="NONE"null must not be placed in quotes.sp_addlogin susan, wonderful, @fullname="Susan B. Anthony"REMAP="UN--Under"An alternative way of creating Example 4, using the parameter name "@fullname".ID="X85415"CommentsMARK="BULL" REMAP="BU--Bullet"For ease of management, it is highly recommended that all users' SQL Server login names be the same as their operating system login names.After assigning a default database to a user with MOREINFO="NONE"sp_addlogin, the Database Owner or System Administrator must provide access to the database by executing MOREINFO="NONE"sp_adduser or MOREINFO="NONE"sp_addalias. Although a user can use MOREINFO="NONE"sp_modifylogin to change his or her own default database at any time, a database cannot be used without permission from the Database Owner. A user can use MOREINFO="NONE"sp_password at any time to change his or her own password. A System Security Officer can use MOREINFO="NONE"sp_password to change any user's password. ID="IN4783103104"Defaultslanguage;Language defaultsA user can use  MOREINFO="NONE"sp_modifylogin to change his or her own default language. A System Administrator can use MOREINFO="NONE"sp_modifylogin to change any user's default language.A user can use MOREINFO="NONE"sp_modifylogin to change his or her own fullname. A System Administrator can use MOREINFO="NONE"sp_modifylogin to change any user's fullname.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"'login_name' is not a valid name.REMAP="UN--Under"MOREINFO="NONE"login_name must conform to the rules for identifiers. See LINKEND="X62459""Identifiers"
 in Volume 1 of the SQL Server Reference Manual. MOREINFO="NONE"'deflanguage' is not an official language name from syslanguages.REMAP="UN--Under"Use MOREINFO="NONE"sp_helplanguage to determine the alternate languages available. Add an alternate language with MOREINFO="NONE"langinstall, or specify us_english. MOREINFO="NONE"Can't run sp_addlogin from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_addlogin modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"A user with the specified login name already exists.REMAP="UN--Under"Choose another login_name. If you only want to change the user's password, default database, or default language, use MOREINFO="NONE"sp_password or MOREINFO="NONE"sp_modifylogin.MOREINFO="NONE"Database name not valid -- login not added.REMAP="UN--Under"The specified default database does not exist. Create the database first or choose a database that already exists. MOREINFO="NONE"New login created.PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_addlogin. Tables UsedREMAP="BO--Body"master.dbo.sysdatabases, master.dbo.syslogins, sysobjectsSee AlsoTopics     LINKEND="X16582"Login Management
, LINKEND="X96191"RolesSystem procedures     LINKEND="X12007"sp_addalias
, LINKEND="X68639"sp_adduser
, LINKEND="X26489"sp_auditsproc
, LINKEND="X49053"sp_droplogin
, LINKEND="X98458"sp_locklogin
, LINKEND="X24535"sp_modifylogin
, LINKEND="X96621"sp_password
, LINKEND="X39296"sp_role
ID="IN4730-1107110"sp_addmessage system procedureID="X36529"sp_addmessageID="IN488-3110112"Messagesadding user-defined;User-defined messages
ID="IN486-6113113"Addingmessages to sysusermessages
ID="IN488-9116114"Messagessysusermessages table
Adds user-defined messages to sysusermessages for use by stored procedure MOREINFO="NONE"print and MOREINFO="NONE"raiserror calls and byMOREINFO="NONE" sp_bindmsg. FORMAT="LINESPECIFIC"sp_addmessage message_num, message_text [, language] ParametersREMAP="RI--RefIndent"ID="IN4814-9116117"Message numbermessage
MOREINFO="NONE"message_num - is the message number of the message to add. The message number for a user-defined message must be 20000 or greater. ID="IN484-9116118"Textuser-defined message
MOREINFO="NONE"message_text -is the text of the message to add.The maximum length is 255 bytes. MOREINFO="NONE"print, MOREINFO="NONE"raiserror, and MOREINFO="NONE"sp_bindmsg recognize place holders in the message text to print out. A single message can contain up to 20 unique place holders in any order. These place holders are replaced with the formatted contents of any arguments that follow the message when the text of the message is sent to the client. ID="IN4811-9116119"TranslationTranslationof user-defined messagesuser-defined messagesREMAP="UN--Under"The place holders are numbered to allow reordering of the arguments when translating a message to a language with a different grammatical structure. A place holder for an argument appears as "%nn!", a percent sign (%), followed by an integer from 1 to 20, followed by an exclamation point (!). The integer represents the argument number in the string in the argument list. "%1!" is the first argument in the original version, "%2!" is the second argument, and so on.MOREINFO="NONE"language - is the language of the message to add. This must be a valid language name in syslanguages table. If this parameter is missing, SQL Server assumes that messages are in the default session language indicated by @@langid. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addmessage 20001, "The table '%1!' is not owned by the user '%2!'." REMAP="UN--Under"Adds a message with the number 20001 to sysusermessages. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_addmessage does not overwrite an existing message of the same number and MOREINFO="NONE"langid. Drop the message using MOREINFO="NONE"sp_dropmessage first. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"'language
MOREINFO="NONE"' is not an official language name from syslanguages.REMAP="UN--Under"Use MOREINFO="NONE"sp_helplanguage to see the list of official language names available on this SQL Server.Message
MOREINFO="NONE" number must be at least 20000.REMAP="UN--Under"User-defined messages must have a message number of 20000 or greater. MOREINFO="NONE"Cannot add message until sysusermessages system table is created properly by Upgrade.REMAP="UN--Under"sysusermessages was added to SQL Server in Release 4.9. This SQL Server has not been properly upgraded to 4.9. See your installation guide for information on upgradeMOREINFO="NONE".MOREINFO="NONE"A message with number message_number
MOREINFO="NONE" in the specified language already exists. Drop the old message first if you still wish to add this one.REMAP="UN--Under"You attempted to insert a message with a number that already exists in sysusermessages. MOREINFO="NONE"The message has not been inserted.REMAP="UN--Under"MOREINFO="NONE"sp_addmessage failed. sysusermessages is unchanged.MOREINFO="NONE"The message has been inserted.REMAP="UN--Under"You successfully added a message to sysusermessages.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_addmessage.Tables UsedREMAP="BO--Body"master.dbo.syslanguages, sysobjects, sysusermessages See AlsoCommands     LINKEND="X69372"print
,  LINKEND="X60573"raiserrorSystem procedures     LINKEND="X40499"sp_dropmessage
, LINKEND="X61947"sp_getmessage
ID="IN4830-13120126"sp_addmessage system procedure
ID="IN488-16123127"Messagessysusermessages table
ID="IN488-18125128"Messagesadding user-defined;User-defined messages
ID="IN486-21128129"Addingmessages to sysusermessages
 ID="IN4834-25132130"sp_addremotelogin system procedureID="X52745"sp_addremoteloginID="IN496-31139132"Loginssysremotelogins table;Remote logins:sysremotelogins table
ID="IN496-32140133"Addingremote logins
ID="IN497-32140134"Mappingremote server users
Authorizes a new remote server user by adding an entry to ID="IN4921-35143135"sysremotelogins table
master.dbo.sysremotelogins. FORMAT="LINESPECIFIC"sp_addremotelogin MOREINFO="NONE"remoteserver [,MOREINFO="NONE" login_name [, MOREINFO="NONE"remote_name] ]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"remoteserver - is the name of the remote server to which the remote login applies. This server must be known to the local server by an entry in the MOREINFO="NONE"master.dbo.sysservers table, created with MOREINFO="NONE"sp_addserver.MOREINFO="NONE"login_name - is the login name of the user on the local server. login_name must already exist in the MOREINFO="NONE"master.dbo.syslogins table.MOREINFO="NONE"remote_name - is the name that the remote server uses when logging into the local server. All MOREINFO="NONE"remote_names that aren't explicitly matched to a local MOREINFO="NONE"login_name are automatically matched to a local name. In example 1, the local name is the remote name used to log in. In example 2, the local name is "albert". ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addremotelogin GATEWAY REMAP="UN--Under"This creates an entry in the sysremotelogins table for the remote server GATEWAY, for purposes of login validation. This is a simple way to map remote names into local names when the local and remote servers have the same users. sp_addremotelogin GATEWAY, albert REMAP="UN--Under"This creates an entry that maps the remote server GATEWAY to a local user name "albert". sp_addremotelogin GATEWAY, churchy, pogo REMAP="UN--Under"This causes a remote login from the remote user "pogo" on the remote server GATEWAY to be mapped into the local user "churchy". CommentsMARK="BULL" REMAP="BU--Bullet"When a remote login is received, the local server tries to map the remote user into a local user in three different ways:MARK="DASH" REMAP="BS--BulletSub"First, the local server looks for an entry in sysremotelogins that matches the remote server name and the remote user name. If one is found, then the local server user ID for that row is used to log the remote user in. If no entry is found, the local server searches for an entry that has a remote name of NULL and a local server user ID that is not -1. In this case, the remote user is mapped to the local server user ID.Finally, if the previous attempts failed, the sysremotelogins table is checked for an entry that has a remote name of NULL and a local server user ID that is -1. In this case, whatever remote name was supplied by the remote server is used to look for a local server user ID in the syslogins table. The name of the local user may be different on the remote server. Every remote login entry has a status. The default status for the MOREINFO="NONE"trusted option is "false" (that is, not trusted). This means that when a remote login comes in using that entry, the password is checked.   If you don't want the password to be checked, change the status of the ID="IN4914-35143140"Trusted status
MOREINFO="NONE"trusted option to "true" with MOREINFO="NONE"sp_remoteoption. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"'login_name
MOREINFO="NONE"' isn't a local user -- remote login denied.REMAP="UN--Under"The MOREINFO="NONE"login_name isn't in the MOREINFO="NONE"master..syslogins table. If you supply a local name, it must currently exist as a user on the local server. MOREINFO="NONE"New remote login created.REMAP="UN--Under"A remote login was created. MOREINFO="NONE"'remoteserver
MOREINFO="NONE"' is the local server - remote login not applicable.REMAP="UN--Under"You have tried to define a remote login to the local server. Logins to the local server are listed in MOREINFO="NONE"master.dbo.syslogins. MOREINFO="NONE"There is already a default-name mapping of a remote login from remote server 'remoteserver
MOREINFO="NONE"'. REMAP="UN--Under"You have tried to add a duplicate remote login entry. See Examples 1 and 2. Use MOREINFO="NONE"sp_helpremotelogins to see the remote logins for the MOREINFO="NONE"remoteserver. MOREINFO="NONE"There is already a remote user named 'remotename' for remote server 'remoteserver
MOREINFO="NONE"'.REMAP="UN--Under"A user with that remote login name for that remote server already exists. Drop that remote user before choosing another MOREINFO="NONE"remotename. MOREINFO="NONE"There is not a server named 'server
MOREINFO="NONE"'.REMAP="UN--Under"The specified remote server does not exist. Use MOREINFO="NONE"sp_helpserver to get a list of the existing remote servers. MOREINFO="NONE"Usage:sp_addremotelogin remoteserver [, loginame [, remotename]]REMAP="UN--Under"Syntax summary. You have incorrectly specified a parameter to MOREINFO="NONE"sp_addremotelogin.MOREINFO="NONE"Can't run sp_addremotelogin from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_addremotelogin modifies system tables, so it cannot be run within a transaction.PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_addremotelogin. Tables UsedREMAP="BO--Body"master.dbo.syslogins, master.dbo.sysremotelogins, master.dbo.sysservers, sysobjects See AlsoSystem procedures     LINKEND="X25636"sp_addlogin
, LINKEND="X18765"sp_addserver
,LINKEND="X85991"sp_dropremotelogin
, LINKEND="X68669"sp_helpremotelogin
,LINKEND="X45409"sp_helpserver
,LINKEND="X26974"sp_remoteoption
ID="IN4934-39147145"sp_addremotelogin system procedure
ID="IN496-45153146"Loginssysremotelogins table;Remote logins:sysremotelogins table
ID="IN496-46154147"Addingremote logins
ID="IN4921-49157148"sysremotelogins table
 REMAP="BO--Body"ID="X62957"sp_addsegmentID="IN4369483"Addingsegments;Segments:adding
Defines a segment on a database device in the current database. FORMAT="LINESPECIFIC"sp_addsegment MOREINFO="NONE"segname, MOREINFO="NONE"dbname, devname ParametersREMAP="RI--RefIndent"MOREINFO="NONE"segname - is the name of the new segment to add to the syssegments table of the database. Segment names are unique in each database. MOREINFO="NONE"dbname - specifies the name of the database on which to define the segment. dbname must be the name of the current database.MOREINFO="NONE"devname - is the name of the database device on which to locate segname. A database device can have more than one segment associated with it. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addsegment indexes, pubs2, dev1 REMAP="UN--Under"This command creates a segment named MOREINFO="NONE"indexes for the database pubs2 on the database device named MOREINFO="NONE"dev1. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_addsegment defines segment names for database devices assigned to a specific database with an MOREINFO="NONE"alter database or MOREINFO="NONE"create database command.After defining a segment, use it in MOREINFO="NONE"create table and MOREINFO="NONE"create index commands and in the MOREINFO="NONE"sp_placeobject procedure to place a table or index on the segment. REMAP="UN--Under"When a table or index is created on a particular segment, all the subsequent data for the table or index is located on the segment. Use the system procedure MOREINFO="NONE"sp_extendsegment to extend the range of a segment to another database device used by the same database. ID="IN4389488"SegmentsextendingIf a database is extended with MOREINFO="NONE"alter database on a device used by that database, the segments mapped to that device are also extended. ID="IN431492109"system segmentmappingThe systemID="IN4315901210"default segmentmapping
 and defaultID="IN438901211"Segmentsmapping
 segments are mapped to each database device included in a MOREINFO="NONE"create database or MOREINFO="NONE"alter database command. The logsegment is also mapped to each device, unless it is placed on a separate device with the MOREINFO="NONE"log MOREINFO="NONE"on extension to MOREINFO="NONE"create database or later use of MOREINFO="NONE"sp_logdevice. Use MOREINFO="NONE"sp_dropsegment to unmap these segments, if desired. See the System Administration Guide for more information. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_addsegment from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_addsegment modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"'devname
MOREINFO="NONE"' is reserved exclusively as a log device.REMAP="UN--Under"You can't create a segment on a disk device that is dedicated to the database log. MOREINFO="NONE"No such device exists -- run sp_helpdb to list the devices for the current database.REMAP="UN--Under"The named device doesn't exist in sysdevices. MOREINFO="NONE"Segment created.REMAP="UN--Under"The procedure was successful; segname is now in the current database. MOREINFO="NONE"'segname
MOREINFO="NONE"' is not a valid identifier.ID="IN435901213"Namessegment;Segments:names ofREMAP="UN--Under"Segment names must conform to the rules for identifiers. They must begin with a letter, an underscore ( _ ), or pound sign (#). After the first character, identifiers can include letters, underscores, pound signs, or dollar signs ($). MOREINFO="NONE"The maximum number of segments for the current database are already defined.ID="IN4320901214"Number (quantity of)named segments;Segments:number of namedREMAP="UN--Under"A database can have no more than 31 segments. You can drop a segment with MOREINFO="NONE"sp_dropsegment and replace it with a new one.   MOREINFO="NONE"The specified device is not used by the database.REMAP="UN--Under"Although the device named as the devname parameter exists in master.dbo.sysdevices, it is not used by the specified database, and therefore, a segment cannot be added to it. Segments may only be defined on database devices used by the database. The MOREINFO="NONE"alter database command can extend a database on a device listed in master.dbo.sysdevices. MOREINFO="NONE"The specified device is not a database device.REMAP="UN--Under"Although the device named as the devname parameter exists in MOREINFO="NONE"master.dbo.sysdevices, it is not a database device. It may be a dump device.MOREINFO="NONE"There is already a segment named 'segname
'MOREINFO="NONE".REMAP="UN--Under"Segment names must be unique in each database. MOREINFO="NONE"You must execute this procedure from the database in which you wish to add a segment. Please execute `use database_name
MOREINFO="NONE"' and try again.REMAP="UN--Under"MOREINFO="NONE"sp_addsegment can add segments only in the database you are currently using. Issue the MOREINFO="NONE"use command to open the database in which you want to add a segment. Then run MOREINFO="NONE"sp_addsegment again.PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_addsegment. Tables UsedREMAP="BO--Body"master.dbo.sysdevices, master.dbo.sysusages, sysobjects, syssegments See AlsoCommands     LINKEND="X61977"alter database
MOREINFO="NONE", LINKEND="X58868"create index
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X64061"disk initSystem procedures     LINKEND="X10014"sp_dropsegment
MOREINFO="NONE", LINKEND="X53708"sp_extendsegment
MOREINFO="NONE", LINKEND="X90458"sp_helpdb
MOREINFO="NONE", LINKEND="X11789"sp_helpdevice
MOREINFO="NONE", LINKEND="X20401"sp_placeobject
ID="IN4330861618"sp_addsegment system procedure
ID="IN436841819"Addingsegments;Segments:adding
 ID="IN4329802220"sp_addserver system procedureID="X18765"sp_addserverID="IN446782522"Addingservers;Servers:adding
Defines a remote server, or defines the name of the local server. FORMAT="LINESPECIFIC"sp_addserver MOREINFO="NONE"srvname [, {local | null} [, network_name]]ParametersREMAP="RI--RefIndent"ID="IN447782526"Serversnames of;Names:server
MOREINFO="NONE"srvname - is the name by which to address the server on your system. MOREINFO="NONE"sp_addserverID="IN4416742927"sysservers tablesp_addserver and
 adds a row to the sysservers table if there is no entry already present for srvname. Server names must be unique, and must conform to the rules for identifiers. ID="IN4426713228"local option, sp_addserver
MOREINFO="NONE"local | MOREINFO="NONE"nullID="IN4413713229"Local serverslocal
 - identifies the server being added as a local server. The MOREINFO="NONE"local value is used only once after start-up, or after a reboot, to identify the local server name so that it can appear in messages printed by SQL Server. MOREINFO="NONE"null specifies that this server is a remote server.MOREINFO="NONE"network_nameID="IN4415693430"Interfaces filesp_addserver and
 - is the name in the interfaces file for the server named srvnameID="IN447693431"Aliasesserver;Server aliases
. This enables you to establish local aliases for other SQL Servers or Backup Servers that you may need to communicate with. If you do not specify a network_name, it defaults to srvname.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addserver GATEWAYREMAP="UN--Under"Adds an entry for a remote server named GATEWAY in MOREINFO="NONE"master.dbo.sysservers. The MOREINFO="NONE"network_name is also GATEWAY.sp_addserver GATEWAY, null, VIOLETREMAP="UN--Under"Adds an entry for a remote server named GATEWAY in MOREINFO="NONE"master.dbo.sysservers. The MOREINFO="NONE"network_name is VIOLET. If there is already a sysservers entry for GATEWAY with a different MOREINFO="NONE"network_name, this changes the MOREINFO="NONE"network_name of server GATEWAY to VIOLET.sp_addserver PRODUCTION, localREMAP="UN--Under"Adds an entry for the local server named PRODUCTION.CommentsMARK="BULL" REMAP="BU--Bullet"The sysservers table identifies the name of the local server and its options, and any remote servers that the local server can communicate with. REMAP="UN--Under"To execute a remote procedure call on a remote server, it must exist in the sysservers table. If srvname already exists as a server name in the sysservers table, MOREINFO="NONE"sp_addserver changes its srvnetname to be the name you specify with network_name. When it does this, it advises you which server it changed, what the old network name was, and what the new network name is.The installation or upgrade process for your server adds an entry in sysservers for a Backup Server. If you remove this entry, you cannot back up your databases. SQL Server requires that the Backup Server have a srvnameID="IN4413693436"Backup Servermultiple
 of SYB_BACKUP. If you do not want to use that as the name of your Backup Server, or if you have more than one Backup Server running on your system, modify the network_name for server SYB_BACKUP with MOREINFO="NONE"sp_addserver so SQL Server can communicate with the desired Backup Server for database dumps and loads.If you specify a srvname and a network_name that already exist in sysservers, MOREINFO="NONE"sp_addserver prints an error message and does not update sysservers.Use MOREINFO="NONE"sp_serveroption to set or clear server options.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_addserver from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_addserver modifies the system table MOREINFO="NONE"master.dbo.sysservers, so it cannot be run within a transaction.MOREINFO="NONE"Adding server 'srvname
'MOREINFO="NONE", physical name 'network_name
'REMAP="UN--Under"The procedure was successful; MOREINFO="NONE"srvname is now known to the local SQL Server and can access the physical device MOREINFO="NONE"network_name. MOREINFO="NONE"Changing physical name of server 'srvname
'MOREINFO="NONE" from 'old_netname
'MOREINFO="NONE" to 'network_name
'REMAP="UN--Under"The server known to your SQL Server as MOREINFO="NONE"srvname now accesses physical device MOREINFO="NONE"network_name, instead of MOREINFO="NONE"old_netname.'srvname
'MOREINFO="NONE" is not a valid name.REMAP="UN--Under"MOREINFO="NONE"srvname does not conform to the rules for identifiers. MOREINFO="NONE"There is already a local server.REMAP="UN--Under"Although there may be many remote servers, there can be only one local server. MOREINFO="NONE"sp_addserver with the MOREINFO="NONE"local option defines the name of the local server. If it already exists, the request is rejected. MOREINFO="NONE"There is already a server named 'srvname
',MOREINFO="NONE" physical name 'network_name
'MOREINFO="NONE".REMAP="UN--Under"You have specified a MOREINFO="NONE"srvname and MOREINFO="NONE"network_name that already exist in sysservers. Nothing changed.MOREINFO="NONE"sp_addserver servername [, local | null] [, physical_name]REMAP="UN--Under"If you specify a MOREINFO="NONE"network_name, you must also specify MOREINFO="NONE"local or MOREINFO="NONE"null. MOREINFO="NONE"Server added.REMAP="UN--Under"You have successfully added a new server.PermissionsREMAP="BO--Body"Only a System Security Officer can execute MOREINFO="NONE"sp_addserver. Tables UsedREMAP="BO--Body"master.dbo.sysservers, sysobjects See AlsoSystem procedures     LINKEND="X52745"sp_addremotelogin
MOREINFO="NONE",  LINKEND="X85991"sp_dropremotelogin
MOREINFO="NONE", LINKEND="X78977"sp_dropserver
MOREINFO="NONE", LINKEND="X68669"sp_helpremotelogin
MOREINFO="NONE", LINKEND="X45409"sp_helpserver
MOREINFO="NONE", LINKEND="X71283"sp_serveroption
ID="IN4432653841"sp_addthreshold system procedureID="X96491"sp_addthresholdID="IN455624243"Spacemonitoring remaining with sp_addthreshold
ID="IN4510614344"Thresholdsadding
ID="IN458604445"Segmentsmonitoring remaining space
ID="IN4510604446"Monitoringspace remaining
Creates a threshold to monitor space on a database segment. When free space on the segment falls below the specified level, SQL Server executes the associated stored procedure. FORMAT="LINESPECIFIC"sp_addthreshold database, segment, free_pages, procedure ParametersREMAP="RI--RefIndent"MOREINFO="NONE"database - is the database for which to add the threshold. This must be the name of the current database.MOREINFO="NONE"segment - is the segment for which to monitor free space. Use quotes when specifying the "default" segment.MOREINFO="NONE"free_pages - is the number of free pages at which the threshold is crossed. When free space in the segment falls below this level, SQL Server executes the associated stored procedure.MOREINFO="NONE"procedure - is the stored procedure to execute when the amount of free space on segment drops below free_pages. The procedure can be located in any database on the current SQL Server or on an Open Server. Thresholds cannot execute procedures on remote SQL Servers.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addthreshold mydb, segment1, 200, pr_warningREMAP="UN--Under"Creates a threshold for segment1. When free space on segment1 drops below 200 pages, SQL Server executes the procedure MOREINFO="NONE"pr_warning. sp_addthreshold userdb, user_data, 100,    o_server...mail_meREMAP="UN--Under"Creates a threshold for the user_data segment. When free space on user_data falls below 100 pages, SQL Server executes a remote procedure call to the OpenServerMOREINFO="NONE" mail_me procedure. CommentsMARK="BULL" REMAP="BU--Bullet"See the System Administration Guide for more information about using thresholds.Crossing a ThresholdMARK="BULL" REMAP="BU--Bullet"When a threshold is crossed, SQL Server executes the associated stored procedure. SQL Server uses the following search path for the threshold procedure:MARK="DASH" REMAP="BS--BulletSub"If the procedure name does not specify a database, SQL Server looks in the database in which the threshold was crossed.If the procedure is not found in this database and the procedure name begins with sp_, SQL Server looks in the sybsystemprocs database.REMAP="UN--Under"If the procedure is not found in either database, SQL Server sends an error message to the error log. SQL Server uses a hysteresis value, the global variable @@thresh_hysteresis, to determine how sensitive thresholds are to variations in free space. Once a threshold executes its procedure, it is deactivated. The threshold remains inactive until the amount of free space in the segment rises to @@thresh_hysteresis pages above the threshold. This prevents thresholds from executing their procedures repeatedly in response to minor fluctuations in free space.The Last-Chance ThresholdMARK="BULL" REMAP="BU--Bullet"By default, SQL Server monitors the free space on the segment where the log resides and executes MOREINFO="NONE"sp_thresholdactionID="IN4510604451"Thresholdslast-chance;Last-chance thresholds;Monitoring:space remaining
ID="IN4535584652"sp_thresholdaction system procedurethreshold procedure
ID="IN4510584653"Thresholdsprocedures executed by
 when the amount of free space is less than that required to permit a successful dump of the transaction log. This amount of free space, which is called the "last-chance threshold," is calculated by SQL Server and cannot be changed by users.If the last-chance threshold is crossed before a transaction is logged, SQL Server suspends the transaction until log space is freed. Use MOREINFO="NONE"sp_dboption to change this behavior for a particular database. Setting the MOREINFO="NONE"abort tran on log full option to MOREINFO="NONE"true causes SQL Server to roll back all transactions that have not yet been logged when the last-chance threshold is crossed.Creating Additional ThresholdsID="IN4510584654"Thresholdsmaximum numberMARK="BULL" REMAP="BU--Bullet"Each database can have up to 256 thresholds, including the last-chance threshold.ID="IN4510584655"Thresholdsspace betweenWhen you add a threshold, it must be at least 2 times @@thresh_hysteresis pages from the closest threshold.Creating Threshold ProceduresID="IN4515564856"master databasethresholds andMARK="BULL" REMAP="BU--Bullet"Any user with MOREINFO="NONE"create procedure permission can create a threshold procedure in a database. Usually, a System Administrator creates MOREINFO="NONE"sp_thresholdaction in the master database, and Database Owners create threshold procedures in user databases.MOREINFO="NONE"sp_addthreshold does not verify that the specified procedure exists. It is possible to add a threshold before creating the procedure it executes.ID="IN4520564857"Threshold proceduresparameters passed toSQL Server passes four parameters to a threshold procedure:MARK="DASH" REMAP="BS--BulletSub"@dbname, varchar(30), which identifies the database@segmentname, varchar(30), which identifies the segment@space_left, int, which indicates the number of free pages associated with the threshold@status, int, which has a value of 1 for last-chance thresholds and 0 for other thresholdsREMAP="UN--Under"These parameters are passed by position rather than by name; your threshold procedure can use other names for them, but must declare them in the order shown and with the correct datatypes.It is not necessary to create a different procedure for each threshold. To minimize maintenance, you can create a single threshold procedure in the sybsystemprocs database that all thresholds on the SQL Server execute.Include MOREINFO="NONE"print and MOREINFO="NONE"raiserror statements in the threshold procedure to send output to the error log. ID="IN4520554958"Threshold proceduresexecutingExecuting Threshold ProceduresMARK="BULL" REMAP="BU--Bullet"Tasks initiated when a threshold is crossed execute as background tasks. These tasks do not have an associated terminal or user session. If you execute MOREINFO="NONE"sp_who while these tasks are running, the status column shows "background".SQL Server executes the threshold procedure with the permissions of the user who added the threshold, at the time the user executed MOREINFO="NONE"sp_addthreshold, minus any permissions that have since been revoked.ID="IN4520545059"Threshold proceduresexecutingEach threshold procedure uses one user connection, for as long as it takes to execute the procedure.Changing or Deleting ThresholdsMARK="BULL" REMAP="BU--Bullet"UseMOREINFO="NONE" sp_helpthreshold for information about existing thresholds.Use MOREINFO="NONE"sp_modifythreshold to associate a threshold with a new threshold procedure, free-space value, or segment. (You cannot change the free-space value or segment name associated with the last-chance threshold.)REMAP="UN--Under"Each time a user modifies a threshold, that user becomes the threshold owner. When the threshold is crossed, SQL Server executes the threshold with the permissions of the owner at the time he or she modified the threshold, minus any permissions that have since been revoked.Use MOREINFO="NONE"sp_dropthreshold to drop a threshold from a segment.ID="IN4510545060"ThresholdsdisablingDisabling Free-Space AccountingMARK="BULL" REMAP="BU--Bullet"Use the MOREINFO="NONE"no free space acctg option of MOREINFO="NONE"sp_dboption to disable free-space accounting on non-log segments. You cannot disable free-space accounting on log segments.System procedures cannot provide accurate information about space allocation when free-space accounting is disabled.ID="IN4510545061"Thresholdslast-chanceCreating Last-Chance Thresholds for Pre-System 10.0 DatabasesMARK="BULL" REMAP="BU--Bullet"Databases do not automatically acquire a last-chance threshold when upgraded to Release 10.0. Use the MOREINFO="NONE"lct_admin system function to create a last-chance threshold in an existing database.Only databases that store their logs on a separate segment can have a last-chance threshold. Use MOREINFO="NONE"sp_logdevice to move the transaction log to a separate device.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Adding threshold for segment `segment
' MOREINFO="NONE"at `pageno
'MOREINFO="NONE" pages.REMAP="UN--Under"The MOREINFO="NONE"sp_addthreshold command succeeded.MOREINFO="NONE"Table `systhresholds
'MOREINFO="NONE" does not exist in database `database
'MOREINFO="NONE"--cannot add thresholds.REMAP="UN--Under"The systhresholds table is missing. This table is created when the database is created (or an upgrade to Release 10.0 is performed), and must not be removed.MOREINFO="NONE"There is no segment named `segment
'MOREINFO="NONE".REMAP="UN--Under"Run MOREINFO="NONE"sp_helpsegment to see a list of segment names.MOREINFO="NONE"This threshold is too close to one or more existing thresholds. Thresholds must be no closer than 128 pages to each other.REMAP="UN--Under"ExecuteMOREINFO="NONE" sp_helpthreshold to see a list of existing thresholds and sizes.MOREINFO="NONE"A threshold at pageno pages is logically impossible for segment 'segment
'MOREINFO="NONE". Choose a value between value1 and value2 pages.REMAP="UN--Under"A threshold must be at least 2 times @@thresh_hysteresis pages from the closest threshold.MOREINFO="NONE"This procedure can only affect thresholds in the current database. Say `use database_name
'MOREINFO="NONE" then run this procedure again.REMAP="UN--Under"MOREINFO="NONE"sp_addthreshold can create thresholds only in the database you are currently using. Issue the MOREINFO="NONE"use command to open the database in which you want to add a threshold. Then run MOREINFO="NONE"sp_addthreshold again.PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_addthreshold.Tables UsedREMAP="BO--Body"master.dbo.sysusages, sysobjects, syssegments, systhresholds See AlsoCommands     LINKEND="X52197"create procedure
MOREINFO="NONE", LINKEND="X47924"dump transactionSystem procedures     LINKEND="X29657"sp_dboption
MOREINFO="NONE", LINKEND="X39966"sp_dropthreshold
MOREINFO="NONE", LINKEND="X52248"sp_helpthreshold
MOREINFO="NONE", LINKEND="X90993"sp_modifythreshold
MOREINFO="NONE", LINKEND="X67172"sp_thresholdaction
ID="IN4527505466"sp_addtype system procedureID="X32817"sp_addtypeID="IN469485768"Datatypesnew;Datatypes:user-defined
ID="IN466446169"Addinguser-defined datatypes;User-defined datatypes:adding with sp_addtype
ID="IN4622446170"User-defined datatypesadding
ID="IN4644416471"Custom datatypes. See User-defined datatypes
ID="IN4645386772"Datatypes, custom. See User-defined datatypes
Creates a user-defined datatype. FORMAT="LINESPECIFIC"sp_addtype MOREINFO="NONE"typename, phystype [(length) | (precision [, scale])][, "identity" | nulltype]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"typename - is the name of the user-defined datatype. Type names must conform to the rules for identifiers and must be unique for each owner in each database. ID="IN4618386775"Physical datatypesphysical
MOREINFO="NONE"phystype - is the physical or SQL Server-supplied datatype on which to base the user-defined datatype. You can specify any SQL Server datatype except timestamp. ID="IN4616386776"() (parentheses)() (parentheses)in user-defined datatypes;Parentheses ():in user-defined datatypes[Parentheses ():user-defined datatypes]user-defined datatypesREMAP="UN--Under"The char, varchar, nchar, nvarchar, binary, and varbinary datatypes expect a length in parentheses. If you do not supply one, SQL Server uses the default length of one character.REMAP="UN--Under"The float datatype expects a binary precision in parentheses. If you do not supply one, SQL Server uses the default precision for your platform. REMAP="UN--Under"The numeric and decimal datatypes expect a decimal precision and scaleID="IN469386777", (comma), (comma)in user-defined datatypes;Comma (,):in user-defined datatypes[Comma (,):user-defined datatypes]user-defined datatypes
, in parentheses and separated by a comma. If you do not supply them, SQL Server uses a default precision of 18 and scale of 0. ID="IN4611386778"PunctuationPunctuationin user-defined datatypesuser-defined datatypesREMAP="UN--Under"Enclose physical types that include punctuation, such as parentheses or commas, within single or double quotes.ID="IN4616347179"IDENTITY columnssp_addtype and
MOREINFO="NONE"identity - indicates that the user-defined datatype has the IDENTITY property. Enclose the MOREINFO="NONE"identity keyword within single or double quotes. You can specify the IDENTITY property only for numeric datatypes with a scale of 0. ID="IN4611327380"Null valuesNull valuessp_addtype and;Null values:for user-defined datatypesuser-defined datatypesREMAP="UN--Under"IDENTITY columns store sequential numbers, such as invoice numbers or employee numbers, that are generated automatically by SQL Server. The value of the IDENTITY column uniquely identifies each row in a table. IDENTITY columns are not updatable and do not allow nulls.ID="IN4615307581"Not null valuessp_addtype and
ID="IN4615307582"Not null valuesNot null valuesfor user-defined datauser-defined data
MOREINFO="NONE"nulltype - indicates how the user-defined datatype handles null value entries. Acceptable values for this parameter are "null", "NULL", "nonull", "NONULL", "not null", and "NOT NULL". Enclose nulltypes that include a blank space within single or double quotes.REMAP="UN--Under"If you omit both the IDENTITY property and the nulltype, SQL Server creates the datatype using the null mode defined for the database. By default, datatypes for which no nulltypeID="IN4618307583"ANSI compatibilityuser-defined datatypes and
 is specified are created NOT NULL (that is, null values are not allowed and explicit entries are required). For ANSI compatibility, use the MOREINFO="NONE"sp_dboption system procedure to set the MOREINFO="NONE"allow nulls by default option to MOREINFO="NONE"true. This changes the database's null mode to NULL.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addtype ssn, "varchar(11)"REMAP="UN--Under"Creates a user-defined datatype called ssn to be used for columns that hold social security numbers. Since the nulltype parameter is not specified, SQL Server creates the datatype using the database's default null mode. Notice that varchar(11) is enclosed in quotation marks, because it contains punctuation (parentheses). sp_addtype birthday, "datetime", null REMAP="UN--Under"Creates a user-defined datatype called birthday that allows null values. sp_addtype temp52 "numeric(5,2)"REMAP="UN--Under"Creates a user-defined datatype calledMOREINFO="NONE" temp52 used to store temperatures of up to five significant digits with two places to the right of the decimal point.sp_addtype "row_id"", "numeric(10,0)", "identity"REMAP="UN--Under"Creates a user-defined datatype called MOREINFO="NONE"row_id with the IDENTITY property, to be used as a unique row identifier. Columns created with this datatype store system-generated values up to 10 digits in length.sp_addtype systype, sysnameREMAP="UN--Under"Creates a user-defined datatype with an underlying type of sysname. Although you cannot use the sysname datatype in a MOREINFO="NONE"create table, MOREINFO="NONE"alter table, or MOREINFO="NONE"create procedure statement, you can use a user-defined datatype that is based on sysname. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_addtype creates a user-defined datatype and adds it to the systypes system table. Once a user-defined datatype is created, you can use it in MOREINFO="NONE"create table and MOREINFO="NONE"alter table statements and bind defaults and rules to it. Build each user-defined datatype in terms of one of the SQL Server-supplied datatypes, specifying the length, or precision and scale, as appropriate. You cannot override the length, precision, or scale in a MOREINFO="NONE"create table or MOREINFO="NONE"alter table statement.ID="IN466307586"Naminguser-defined datatypes;User-defined datatypes:namingA user-defined datatype name must be unique in the database, but user-defined datatypes with different names can have the same definitions. If nchar or nvarchar is specified as the phystype, then the maximum length of columns created with the new type is the length specified in MOREINFO="NONE"sp_addtype multiplied by the value of ID="IN4627267987"@@ncharsize global variableatatncharsize global variablesp_addtype andsp_addtype and;ncharsize global variable:sp_addtype and
@@ncharsize at the time the type was added. ID="IN469267988"Hierarchyuser-defined datatypes;Datatypes:hierarchy of user-definedEach system type has a hierarchy, stored in the systypes system table. User-defined datatypes have the same datatype hierarchy as the physical types on which they are based. In a mixed mode expression, all types are converted to a common type, the type with the lowest hierarchy.REMAP="UN--Under"Use the following query to list the hierarchy for each system-supplied and user-defined type in your database:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select name, hierarchyfrom systypesorder by hierarchyTypes with the IDENTITY PropertyMARK="BULL" REMAP="BU--Bullet"If a user-defined datatype is defined with the IDENTITY property, all columns created from it are IDENTITY columns. You can specify either MOREINFO="NONE"identity or MOREINFO="NONE"not null-or neither one-in the MOREINFO="NONE"create or MOREINFO="NONE"alter table statement. Following are three different ways to create an IDENTITY column from a user-defined datatype with the IDENTITY property:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table new_table (id_col IdentType)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table new_table (id_col IdentType identity)REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table new_table (id_col IdentType not null)When you create a column with the MOREINFO="NONE"create table or MOREINFO="NONE"alter table statement, you can override the nulltype specified with the MOREINFO="NONE"sp_addtype system procedure:MARK="DASH" REMAP="BS--BulletSub"Types specified as NOT NULL can be used to create NULL or IDENTITY columns.Types specified as NULL can be used to create NOT NULL columns, but not to create IDENTITY columns.If you try to create a null column from an IDENTITY type, the MOREINFO="NONE"create or MOREINFO="NONE"alter table statement fails.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"A type with the specified name already exists.REMAP="UN--Under"Choose a different MOREINFO="NONE"typename. MOREINFO="NONE"Illegal length specified-must be between 1 and 255.REMAP="UN--Under"The length of a datatype must be between 1 and 255. MOREINFO="NONE"Illegal precision specified -- must be between 1 and 38.REMAP="UN--Under"The precision of a numeric or decimal datatype must be between 1 and 38.MOREINFO="NONE"Illegal precision specified -- must be between 1 and 48.REMAP="UN--Under"The precision of a float or double precision datatype must be between 1 and 48.MOREINFO="NONE"Illegal scale specified -- must be less than precision.REMAP="UN--Under"The scale of a numeric or decimal datatype must be between 0 and the datatype's precision.MOREINFO="NONE"Physical datatype does not allow nulls.REMAP="UN--Under"You specified that you wanted to allow null values with the bit datatype, which doesn't allow null values. MOREINFO="NONE"Physical datatype does not exist.REMAP="UN--Under"The phystype you gave is not a SQL Server datatype. MOREINFO="NONE"Physical type is fixed length. You cannot specify the length.REMAP="UN--Under"The physical datatypes that take length specifications are char, nchar, varchar, nvarchar, binary, and varbinary. You cannot change the fixed lengths of other physical datatypes. MOREINFO="NONE"Type added.REMAP="UN--Under"The MOREINFO="NONE"sp_addtype command succeeded. You created a user-defined datatype that can now be used in MOREINFO="NONE"create table statements, or to bind rules and defaults. MOREINFO="NONE"'typename' is not a valid type name.REMAP="UN--Under"MOREINFO="NONE"typename must conform to the rules for identifiers and be unique for each owner in each database. MOREINFO="NONE"User-defined datatypes based on the `timestamp' datatype are not allowed.REMAP="UN--Under"The timestamp datatype is based on varbinary(8), which you can use instead.MOREINFO="NONE"Usage: sp_addtype name, `datatype
' MOREINFO="NONE"[, null | nonull | identity]REMAP="UN--Under"Syntax summary. The third parameter can specify either a null type ("null", "NULL", "nonull", "NONULL", "not null", or "NOT NULL") or the IDENTITY property. MOREINFO="NONE"User types with the identity property must be numeric with a scale of 0.MOREINFO="NONE"You must specify a length with this physical type.REMAP="UN--Under"You used a phystype-char, nchar, varchar, nvarchar, binary, or varbinary-that requires a length. For example, "char(10)" is acceptable, but "char" is not. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_addtype. Tables UsedREMAP="BO--Body"master.dbo.spt_values, master.dbo.sysdatabases, sysobjects, systypes See AlsoCommands     LINKEND="X81463"create default
MOREINFO="NONE", LINKEND="X43186"create rule
MOREINFO="NONE", LINKEND="X80969"create tableSystem procedures     LINKEND="X84736"sp_bindefault
MOREINFO="NONE", LINKEND="X38718"sp_bindrule
MOREINFO="NONE", LINKEND="X29657"sp_dboption
MOREINFO="NONE", LINKEND="X68983"sp_droptype
MOREINFO="NONE", LINKEND="X37949"sp_rename
MOREINFO="NONE", LINKEND="X87638"sp_unbindefault
MOREINFO="NONE", LINKEND="X37191"sp_unbindrule
ID="IN4627228393"sp_addtype system procedure
ID="IN466188794"Addinguser-defined datatypes;User-defined datatypes:adding with sp_addtype
ID="IN469168995"Datatypesnew;Datatypes:user-defined
 Topics     LINKEND="X36521"IDENTITY Columns
ID="IN4632129396"sp_addumpdevice system procedureID="X85886"sp_addumpdeviceID="IN471299798"Dump devicesadding;Disk devices:adding;Tape dump devices:adding
ID="IN47689899"Addingdump devices
Adds a dump device to SQL Server.FORMAT="LINESPECIFIC"sp_addumpdevice {"tape" | "disk"}, device_name,physicalname [, size] ParametersREMAP="RI--RefIndent"ID="IN47284102102"tape option, sp_addumpdevice
"MOREINFO="NONE"tape" - for tape drives. Enclose MOREINFO="NONE"tape in quotes. ID="IN47280106103"disk option, sp_addumpdevice
"MOREINFO="NONE"disk" - is for a disk or a file device. Enclose MOREINFO="NONE"disk in quotes. ID="IN47190106104"Logical device name
MOREINFO="NONE"device_name - is the "logical" dump device name.  It must be a valid identifier. Once you add a dump device to sysdevices, you can specify its logical name name in the MOREINFO="NONE"load and MOREINFO="NONE"dump commands.ID="IN47200106105"Physical device name
MOREINFO="NONE"physicalname - is the physical name of the device. You can specify either an absolute pathname or a relative pathname. During dumps and loads, the Backup Server resolves relative pathnames by looking in SQL Server's current working directory. Enclose names containing non-alphanumeric characters in quotation marks. For UNIX platforms, specify a non-rewinding tape device name. MOREINFO="NONE"size - is the capacity of the device, specified in megabytes. OpenVMS systems ignore the size parameter if specified. Other platforms require this parameter for tape devices but ignore it for disk devices. The size should be at least five database pages (each page requires 2048 bytes for most platforms, 4096 for Stratus). We recommend that you specify a capacity that is slightly below the rated capacity for your device.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_addumpdevice "tape", mytapedump, "/dev/nrmt8", 40REMAP="UN--Under"Adds a 40 megabyte tape device. Dump and load commands can reference the device by its physical name, /dev/nrmt8, or its logical name, mytapedump.sp_addumpdevice "disk", mydiskdump, "/dev/rxy1d/dump.dat"REMAP="UN--Under"Adds a disk device named mydiskdump. Specify an absolute or relative path name and a file name.CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_addumpdevice adds a dump device to the master.dbo.sysdevices table. Tape devices are assigned a cntrltype of 3; disk devices a cntrltype of 2. To use an operating system file as a dump device, specify a device of type MOREINFO="NONE"disk and an absolute or relative path name for the physicalname. Omit the size parameter. If you specify a relative path name, dumps are made to-or loaded from-the current SQL Server working directory at the time the dump or load command is executed.ID="IN4790106109"Ownershipdump devices and
ID="IN47110106110"Permissionsdump devices and
ID="IN47120106111"Dump devicespermission and ownership problemsOwnership and permission problems can interfere with the use of disk or file dump devices.MOREINFO="NONE" sp_addumpdevice adds the device to the sysdevices table, but does not guarantee that you can create a file as a dump device or that users can dump to a particular device.The MOREINFO="NONE"with capacity = megabytes clause of theMOREINFO="NONE" dump database and MOREINFO="NONE"dump transaction commands can override the size specified with MOREINFO="NONE"sp_addumpdevice. On platforms that do not reliably detect the end-of-tape marker, the Backup Server issues a volume change request after the specified number of megabytes have been dumped.When a dump device fails, use MOREINFO="NONE"sp_dropdevice to drop it from sysdevices. After replacing the device, useMOREINFO="NONE" sp_addumpdevice to associate the logical device name with the new physical device. This avoids updating backup scripts and threshold procedures each time a dump device fails.To add database devices to sysdevices, use the MOREINFO="NONE"disk init command.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_addumpdevice from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_addumpdevice modifies the system table MOREINFO="NONE"master.dbo.sysdevices, so it cannot be run within a transaction.'device_name
'MOREINFO="NONE" is not a valid name.REMAP="UN--Under"The value for MOREINFO="NONE"device_name must conform to the rules for identifiers. MOREINFO="NONE"device_name may not be NULL.REMAP="UN--Under"You must specify a device name.MOREINFO="NONE"Device with same logical name already exists.REMAP="UN--Under"All dump devices must have unique logical names. There is already a device with the name supplied for the MOREINFO="NONE"device_name parameter. MOREINFO="NONE"`Disk' device added.REMAP="UN--Under"The disk dump device was added successfully. MOREINFO="NONE"physicalname may not be NULL.REMAP="UN--Under"You must specify a physical dump device name.MOREINFO="NONE"Please specify media capacity in megabytes (1 MB minimum).REMAP="UN--Under"You must specify a tape capacity in megabytes for tape devices. The minimum capacity is 1 MB. There is no default. MOREINFO="NONE"`Tape' device added.REMAP="UN--Under"The tape dump device was added successfully. MOREINFO="NONE"WARNING: physical device name `physicalname
'MOREINFO="NONE" is not unique.REMAP="UN--Under"You attempted to create a new dump device that has the same physical name as an existing dump device. MOREINFO="NONE"WARNING: specified size parameter is not used for the disk device type.MOREINFO="NONE"Unknown device type. Use `disk' or `tape'.REMAP="UN--Under"The value supplied for the first parameter isn't a known device type. PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_addumpdevice. Tables UsedREMAP="BO--Body"master.dbo.sysdevices, sysobjects See AlsoCommands     LINKEND="X64061"disk init
MOREINFO="NONE", LINKEND="X68345"dump database
MOREINFO="NONE", LINKEND="X47924"dump transaction
MOREINFO="NONE", LINKEND="X28090"load database
MOREINFO="NONE", LINKEND="X75212"load transaction
ID="IN4732-4110118"sp_addumpdevice system procedure
ID="IN476-5111119"Addingdump devices
ID="IN4712-8114120"Disk devicesadding;Tape dump devices:adding;Dump devices:adding
 System procedures     LINKEND="X57787"sp_dropdevice
MOREINFO="NONE", LINKEND="X11789"sp_helpdeviceID="X68639"sp_adduserID="IN4827-12119122"sp_adduser system procedure
ID="IN485-15122124"Usersadding to a database with sp_adduser
ID="IN486-19126125"Addingusers to a database;Adding:users using sp_adduser procedure
Adds a new user to the current database. FORMAT="LINESPECIFIC"sp_adduser MOREINFO="NONE"login_name [, MOREINFO="NONE"name_in_db [, MOREINFO="NONE"grpname]]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"login_name - is the user's name as found in MOREINFO="NONE"master.dbo.syslogins. MOREINFO="NONE"name_in_db - is a new name for the user in the current database. ID="IN486-21128128"Groupssp_adduser procedure
MOREINFO="NONE"grpname - adds the user to an existing group in the database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_adduser margaretREMAP="UN--Under"Adds "margaret" to the database. Her database user name is the same as her SQL Server login name, and she belongs to the default group, "public". sp_adduser haroldq, harold, fort_mudge REMAP="UN--Under"Adds "haroldq" to the database. When "haroldq" uses the current database, his name is "harold." He belongs to the fort_mudge group, as well as the default group "public".CommentsID="IN4815-21128131"Database Ownersadding usersMARK="BULL" REMAP="BU--Bullet"The Database Owner executes MOREINFO="NONE"sp_adduser to add a user name to the sysusers table of the current database, enabling the user to access the current database under his or her own name. ID="IN487-21128132"Aliasesassigning different names compared to;Names:assigning different, compared to aliasesSpecifying a name_in_db parameter gives the new user a name in the database different from his or her login name on SQL Server. The ability to assign a user a different name is provided as a convenience. It is not an alias as provided by MOREINFO="NONE"sp_addalias as it is not mapped to the identity and privileges of another user. ID="IN4814-23130133""public" grouppublic groupsp_adduser andsp_adduser and
ID="IN486-26133134"GroupsGroupsSee also "public" group!see also public groupA user can be a member of only one group other than the default group, "public". Every user is a member of the default group, "public". Use MOREINFO="NONE"sp_changegroup to change a user's group.In order to access a database, a user must either be listed in sysusers (with MOREINFO="NONE"sp_adduser) or mapped to another user in sysalternates (with MOREINFO="NONE"sp_addalias), or there must be a "guest" entry in sysusers. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"A user with the same name already exists in the database.REMAP="UN--Under"The name_in_db is already a user in the database. Choose another name. MOREINFO="NONE"All user ids have been assigned.REMAP="UN--Under"The database has reached the maximum number of user IDs. 'name_in_db' MOREINFO="NONE"is not a valid name.REMAP="UN--Under"The name_in_db specified does not follow the rules for identifiers. MOREINFO="NONE"New user added.REMAP="UN--Under"The MOREINFO="NONE"sp_adduser command succeeded. The user is now known in the current database. MOREINFO="NONE"No group with the specified name exists.REMAP="UN--Under"The group name you supplied does not exist in this database. Either omit the grpname parameter or create the group with MOREINFO="NONE"sp_addgroup. MOREINFO="NONE"No login with the specified name exists.REMAP="UN--Under"The login_name you gave is unknown to SQL Server. Each user must have a login on SQL Server before being added to a database. MOREINFO="NONE"User already has a login under a different name.REMAP="UN--Under"The user with the login_name you supplied is listed in the current database's sysusers table with a name different from the one supplied as the name_in_db parameter. MOREINFO="NONE"User already has alias access to the database.REMAP="UN--Under"The login_name is already known to the database by an alias. To add the user, drop the alias with MOREINFO="NONE"sp_dropalias and then re-execute MOREINFO="NONE"sp_adduser.PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_adduser. Tables UsedREMAP="BO--Body"master.dbo.syslogins, master.dbo.syssrvroles, sysalternates, sysobjects, sysusers See Also Commands     LINKEND="X69087"grant
MOREINFO="NONE", LINKEND="X29921"revoke
MOREINFO="NONE", LINKEND="X39034"useSystem procedures     LINKEND="X12007"sp_addalias
MOREINFO="NONE", LINKEND="X65925"sp_addgroup
MOREINFO="NONE", LINKEND="X18596"sp_changegroup
MOREINFO="NONE", LINKEND="X47662"sp_dropalias
MOREINFO="NONE", LINKEND="X17416"sp_dropgroup
MOREINFO="NONE", LINKEND="X28192"sp_helpuser
ID="IN4827-30137139"sp_adduser system procedure
ID="IN486-34141140"Addingusers to a database;Adding:users using sp_adduser procedure
ID="IN485-37144141"Usersadding to a database with sp_adduser
 Topics     LINKEND="X62459"IdentifiersREMAP="BO--Body"ID="X27092"sp_auditdatabaseID="IN4389931"Auditingdatabases
ID="IN43339572"sp_auditdatabase system procedure
ID="IN4399484"Databasesauditing
Establishes auditing of different types of events within a database, or of references to objects within that database from another database.FORMAT="LINESPECIFIC"sp_auditdatabase [dbname [, "ok | fail | both | off"[, {"d u g r t o"}]]]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"dbname - is the name of the database for which to establish auditing.MOREINFO="NONE"ok | MOREINFO="NONE"fail |MOREINFO="NONE" both |MOREINFO="NONE" off - establishes auditing of only successful attempts (MOREINFO="NONE"ok), only failed attempts (MOREINFO="NONE"fail), or of all attempts (MOREINFO="NONE"both) to execute the events named in the third parameter. The MOREINFO="NONE"fail option audits access attempts that fail because the user lacks permission to access the database. MOREINFO="NONE"off turns off the specified type of auditing on the named database.MOREINFO="NONE"d u g r t o - are the types of database events to audit. Choose one or more, in any order. If you do not specify an event, the MOREINFO="NONE"ok|MOREINFO="NONE"fail |MOREINFO="NONE"both|MOREINFO="NONE"off argument applies to all event types (MOREINFO="NONE"d, u, g, r, t, andMOREINFO="NONE" o). The event types are as follows:TOCENTRY="1"LBL="Table 4-2:" ID="X28914"Database Auditing Options COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="33*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Event 
TypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"d COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits execution of the MOREINFO="NONE"drop table, drop view, drop procedure, or 
MOREINFO="NONE"drop trigger commands within MOREINFO="NONE"dbname, and execution of the 
MOREINFO="NONE"drop database command when MOREINFO="NONE"dbname is being dropped.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"u COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits execution of the MOREINFO="NONE"use command on MOREINFO="NONE"dbname.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"g COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits execution of the MOREINFO="NONE"grant command within MOREINFO="NONE"dbname.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"r COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits execution of the MOREINFO="NONE"revoke command within MOREINFO="NONE"dbname.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"t COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits execution of the MOREINFO="NONE"truncate table command within MOREINFO="NONE"dbname.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"o COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0""Outside access"; audits execution of SQL commands from 
within another database that refer to objects in MOREINFO="NONE"dbname. ID="IN4349488"Listdatabase auditing optionsExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_auditdatabaseREMAP="UN--Under"Displays the current auditing status for all databases on the server.sp_auditdatabase pubs2REMAP="UN--Under"Displays the current auditing status for the pubs2 database.sp_auditdatabase pubs2, "both", "ugr"REMAP="UN--Under"Audits both successful and failed executions of the MOREINFO="NONE"use command on the pubs2 database, and of the MOREINFO="NONE"grant and MOREINFO="NONE"revoke commands within pubs2.sp_auditdatabase pubs2, "ok", "d"gosp_auditdatabase pubs2, "fail", "u"gosp_auditdatabase pubs2, "both", "gr"goREMAP="UN--Under"Audits successful execution of the MOREINFO="NONE"drop command within the pubs2 database and successful attempts to drop pubs2, attempts to use pubs2 which failed due to a lack of permission, and both successful and failed executions of the MOREINFO="NONE"grant and MOREINFO="NONE"revoke commands from within pubs2.sp_auditdatabase pubs2, "off", "gru"REMAP="UN--Under"Disables auditing of the MOREINFO="NONE"grant and MOREINFO="NONE"revoke commands within pubs2, and execution of the MOREINFO="NONE"use command on pubs2.sp_auditdatabase pubs2, "fail"REMAP="UN--Under"Audits failed attempts of all six event types. ID="X75639"CommentsMARK="BULL" REMAP="BU--Bullet"If you execute MOREINFO="NONE"sp_auditdatabase more than once on a database, the options that you set accumulate with each execution. Therefore, you can enable some options for success only, some for failure only, and some for both. This requires multiple invocations of MOREINFO="NONE"sp_auditdatabase, as shown in Example 4
.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_auditdatabase from within a transaction.REMAP="UN--Under"Since MOREINFO="NONE"sp_auditdatabase modifies system tables, it cannot be run from within a transaction.MOREINFO="NONE"No databases currently have auditing enabled.REMAP="UN--Under"When you execute MOREINFO="NONE"sp_auditdatabase with no parameters, it returns this message or the following message and the current audit settings for all databases:REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"'dbname' has the following auditing options enabled:'dbname
'MOREINFO="NONE" does not exist.REMAP="UN--Under"You specified an invalid database name.MOREINFO="NONE"Audit option has been changed and has taken effect immediately.REMAP="UN--Under"The MOREINFO="NONE"sp_auditdatabase command succeeded. You successfully changed the audit options.MOREINFO="NONE"Invalid second argument. Valid choices are 'ok', 'fail', 'both', or 'off'.REMAP="UN--Under"You specified an incorrect second parameter.MOREINFO="NONE"Invalid third argument. Valid choices are 'd', 'u', 'o', 'g', 'r', or 't'.REMAP="UN--Under"You specified an invcorrect third parameter.MOREINFO="NONE"Error updating the audit flags in memory. This is a system error. Contact a System Administrator.REMAP="UN--Under"Contact a System Administrator for help.MOREINFO="NONE"Error updating the audit flags in the system catalogs. This is a system error.  Contact a user with System Administrator (SA) role.REMAP="UN--Under"Contact a System Administrator for help.PermissionsREMAP="BO--Body"Only a System Security Officer can execute MOREINFO="NONE"sp_auditdatabase.Tables UsedREMAP="BO--Body" sybsecurity.dbo.sysauditsSee AlsoSystem procedures     LINKEND="X42468"sp_auditoption
 Topics     LINKEND="X26589"Auditing
ID="IN4330901216"sp_auditlogin system procedureID="X81262"sp_auditloginID="IN448891418"Auditingusers
ID="IN445861719"UsersUsersSee also Aliases; Groups; Logins!see also Aliases; Groups; Logins
ID="IN448861720"AuditingusersÕ  commands
ID="IN448861721"Auditingtable access
ID="IN448861722"Auditingview access
Audits a SQL Server user's attempts to access tables and views; audits the text of a user's command batches; lists users on which auditing is enabled; gives the auditing status of a user; or displays the status of table, view, or command text auditing.FORMAT="LINESPECIFIC"sp_auditlogin [login_name [, "table" | "view"[, "ok" | "fail" | "both" | "off"]]]FORMAT="LINESPECIFIC"sp_auditlogin [login_name [, "cmdtext" [, "on" | "off"]]]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"login_name - is the SQL Server login name of the user for whom to establish auditing.ID="IN445861725"Viewsauditing use ofID="IN446861726"Tablesauditing use ofMOREINFO="NONE"table | MOREINFO="NONE"view - is the MOREINFO="NONE"table option audits MOREINFO="NONE"login_name's attempts to access tables in any database, or returns the status of table auditing for MOREINFO="NONE"login_name. MOREINFO="NONE"view audits MOREINFO="NONE"login_name's attempts to access views in any database, or returns the status of view auditing for login_name. Enable the MOREINFO="NONE"table | MOREINFO="NONE"view option for successful accesses, failed accesses (where access fails because the user doesn't have the correct permissions on the object), or both.MOREINFO="NONE"ok |MOREINFO="NONE" fail |MOREINFO="NONE" both |MOREINFO="NONE" off - selectively enables auditing for successful table or view accesses only (MOREINFO="NONE"ok), accesses that fail due to lack of permissions on an object (MOREINFO="NONE"fail), or both successful and failed accesses (MOREINFO="NONE"both). MOREINFO="NONE"off disables auditing of the named type -MOREINFO="NONE" table or MOREINFO="NONE"view.MOREINFO="NONE"cmdtext - preserves the text of all command batches that login_name submits to the server. The text is stored in the extrainfo column of sybsecurity..sysaudits.MOREINFO="NONE"on | MOREINFO="NONE"off - MOREINFO="NONE"on enables MOREINFO="NONE"cmdtext auditing for login_name; MOREINFO="NONE"off terminates it.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_auditloginREMAP="UN--Under"Returns the login names of users for whom auditing is enabled on the current server.sp_auditlogin "joe"REMAP="UN--Under"Displays the auditing status of user "joe".sp_auditlogin "joe", "table", "fail"sp_auditlogin "joe", "view", "fail"REMAP="UN--Under"Audits Joe's attempts to access tables and views on which he lacks permission.sp_auditlogin "joe", "cmdtext", "on"REMAP="UN--Under"Audits the text of commands executed by user "joe".sp_auditlogin "joe", "view"REMAP="UN--Under"Displays whether view access auditing is on or off for user "joe".ID="X96688"CommentsMARK="BULL" REMAP="BU--Bullet"You must issue separate MOREINFO="NONE"sp_auditlogin commands to enable both table and view auditing for a single user, as shown in Example 3
.MOREINFO="NONE"sp_auditlogin establishes auditing for a specified user at the server level, not the database level. SQL Server audits the user's attempts to access objects in any database on the server.You can executeMOREINFO="NONE" sp_auditlogin from within any database. ID="IN447861729"Displayauditing information
MOREINFO="NONE"sp_auditlogin can display different kinds of auditing information, depending on the number of arguments supplied:MARK="DASH" REMAP="BS--BulletSub"Used with no arguments, it displays the login names of the server users for whom auditing is currently enabled.The following syntax:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    sp_auditlogin "login_name"displays the auditing status of login_name.The following syntax:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    sp_auditlogin "login_name", "table"    sp_auditlogin "login_name", "view"displays the status of table or view auditing for login_name.The following syntax:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    sp_auditlogin "login_name", "cmdtext"displays the status of MOREINFO="NONE"cmdtext auditing for login_name.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_auditlogin from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_auditlogin updates system tables, so it cannot be run from within a transaction.login_name
MOREINFO="NONE" does not exist.REMAP="UN--Under"You specified an invalid MOREINFO="NONE"login_name.login_name
MOREINFO="NONE" has the following auditing options enabled:REMAP="UN--Under"Lists MOREINFO="NONE"login_name's current audit settings.MOREINFO="NONE"Invalid second argument. Valid options are 'table', 'view', or 'cmdtext'.REMAP="UN--Under"You specified an incorrect parameter.MOREINFO="NONE"No logins currently have auditing enabled.REMAP="UN--Under"When you execute MOREINFO="NONE"sp_auditlogin with no parameters, it returns this message if there are no logins with auditing enabled.'parameter
'MOREINFO="NONE" is not a valid argument.REMAP="UN--Under"You specified an incorrect parameter.PermissionsREMAP="BO--Body"Only a System Security Officer can execute MOREINFO="NONE"sp_auditlogin.Tables UsedREMAP="BO--Body"sybsecurity.dbo.sysauditsSee AlsoSystem procedures     LINKEND="X42468"sp_auditoption
 Topics     LINKEND="X26589"Auditing
ID="IN4431822134"sp_auditobject system procedureID="X49123"sp_auditobjectID="IN4516812336"Database objectsauditing
ID="IN458812337"Auditingsetting defaults
ID="IN458812338"Auditingtable access
ID="IN458812339"Auditingview access
Audits accesses to tables and views.FORMAT="LINESPECIFIC"REMAP="BO--Body"To audit existing tables and views:FORMAT="LINESPECIFIC"sp_auditobject objname, dbname [, {"ok" | "fail" | "both" | "off"}      [, "{d i s u}"]]REMAP="BO--Body"To audit newly created tables and views:FORMAT="LINESPECIFIC"sp_auditobject {"default table"|"default view"},dbname [, {"ok" | "fail" | "both" | "off"} [, "{d i s u}"]]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"objname - is the name of a table or view in the current database.MOREINFO="NONE"dbname - is the name of the current database, if used with the objname parameter; if used with the MOREINFO="NONE"default MOREINFO="NONE"table |MOREINFO="NONE" default view parameter, MOREINFO="NONE"dbname can be the name of any database.MOREINFO="NONE"ok|MOREINFO="NONE" fail |MOREINFO="NONE" both |MOREINFO="NONE"off - enables auditing for successful accesses only (MOREINFO="NONE"ok), accesses that fail due to lack of permissions (MOREINFO="NONE"fail), or both successful and failed accesses (MOREINFO="NONE"both). MOREINFO="NONE"off disables auditing of the specified type (MOREINFO="NONE"table or MOREINFO="NONE"view).ID="IN4514792542"update commandauditing use ofID="IN4514772743"select commandauditing use ofID="IN4514752944"insert commandauditing use ofID="IN4514733145"delete commandauditing use ofMOREINFO="NONE"d i s u - is the type of access to audit. You can specify any number of types at one time and in any order. The possible types are:TOCENTRY="1"LBL="Table 4-3:"Types of Object AuditingCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ParameterCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"d COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"delete COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"i COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"insert COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"s COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"u COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"update MOREINFO="NONE"default table |MOREINFO="NONE" default view - specifies that these audit settings are to be the defaults for newly created tables or views in the specified database. These default settings do not apply to any tables or views that exist when you execute MOREINFO="NONE"sp_auditobject. Until you execute MOREINFO="NONE"sp_auditobject "MOREINFO="NONE"default table |MOREINFO="NONE"default view" for a database, tables or views created within that database do not have any auditing options set.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_auditobject publishers, pubs2REMAP="UN--Under"Displays the current auditing status of the publishers table in the pubs2 database.sp_auditobject publishers, pubs2, "fail"REMAP="UN--Under"Audits failed attempts to access the publishers table.sp_auditobject titles, pubs2, "ok", "id"gosp_auditobject titles, pubs2, "fail", "u"goREMAP="UN--Under"Audits all successful executions of MOREINFO="NONE"insert and MOREINFO="NONE"delete and failed attempts to execute MOREINFO="NONE"update on the titles table.sp_auditobject "default table"REMAP="UN--Under"Displays the default auditing values that apply to new tables in the current database.sp_auditobject "default table", pubs2REMAP="UN--Under"Displays the default auditing values that apply to new tables in the pubs2 database.sp_auditobject "default view", pubs2, "fail", "du"REMAP="UN--Under"Establishes auditing of failed MOREINFO="NONE"delete and MOREINFO="NONE"update attempts for all new views in the pubs2 database.CommentsMARK="BULL" REMAP="BU--Bullet"You can audit use of the MOREINFO="NONE"select, update, delete, and MOREINFO="NONE"insert commands on tables and views.If you specify MOREINFO="NONE"default table or MOREINFO="NONE"default view without a database name, MOREINFO="NONE"sp_auditobject displays the default audit settings for tables and views for the current database.If you specify MOREINFO="NONE"default table or MOREINFO="NONE"default view with only a database name, MOREINFO="NONE"sp_auditobject displays the default audit settings for tables and views in the specified database.Establishing default auditing options for tables or views does not affect any views or tables that exist prior to setting the default.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"An object name must be provided.REMAP="UN--Under"Provide the name of a table or view unless you are using the MOREINFO="NONE"default table | MOREINFO="NONE"default view parameter.MOREINFO="NONE"Audit option has been changed and has taken effect immediately.MOREINFO="NONE"Audit option has been changed and will take effect after a reboot.MOREINFO="NONE"Can't run sp_auditobject from within a transaction.REMAP="UN--Under"This procedure updates system tables, so it cannot be run from within a transaction.MOREINFO="NONE"Error: An invalid letter was specified. Use only 'd', 'u', 's', or 'i'.REMAP="UN--Under"You specified an incorrect parameter.MOREINFO="NONE"Only 'default table' or 'default view' is allowed.REMAP="UN--Under"You specified an incorrect parameter.MOREINFO="NONE"Only 'ok', 'fail', 'both', or 'off' can be specified.REMAP="UN--Under"Specify  the MOREINFO="NONE"default table or MOREINFO="NONE"default view parameter.MOREINFO="NONE"You must provide 'ok', 'fail', 'both', or 'off' preceding the 'dusi' string.REMAP="UN--Under"Specify one of the MOREINFO="NONE"ok|MOREINFO="NONE" fail |MOREINFO="NONE" both |MOREINFO="NONE"off choices.PermissionsREMAP="BO--Body"Only a System Security Officer can execute MOREINFO="NONE"sp_auditobject.Tables UsedREMAP="BO--Body"sybsecurity.dbo.sysauditsSee AlsoSystem procedures     LINKEND="X42468"sp_auditoption
, LINKEND="X26489"sp_auditsprocTopics     LINKEND="X26589"Auditing
ID="IN4531693552"sp_auditoption system procedure
ID="IN458693553"Auditingglobal optionsID="X42468"sp_auditoption
Enables or disables system-wide auditing and global audit options, or reports on the status of audit options.FORMAT="LINESPECIFIC"sp_auditoption {"all" | "enable auditing" | "logouts"| "server boots" | "adhoc records"} [, {"on" | "off"}]FORMAT="LINESPECIFIC"sp_auditoption {"logins" | "rpc connections" |"roles"} [, {"ok" | "fail" | "both" | "off"}]FORMAT="LINESPECIFIC"sp_auditoption "errors" [, {"nonfatal" | "fatal" | "both"}]FORMAT="LINESPECIFIC"sp_auditoption "{sa | sso | oper | navigator |   replication} commands" [, {"ok" | "fail" | "both" | "off"}]ParametersThe available audit options to enable, disable, or query are:PGWIDE=1 TOCENTRY="1"LBL="Table 4-4:"Global Auditing OptionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="43*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OptionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ActionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"all COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enables or disables all options except MOREINFO="NONE"enable auditing simultaneously. MOREINFO="NONE"enable 
auditing must be set separately. For options that allow selective auditing for 
successful and/or failed executions, setting MOREINFO="NONE"all to MOREINFO="NONE"on is equivalent to setting all 
options to MOREINFO="NONE"on or MOREINFO="NONE"both, depending on the option.
Syntax MOREINFO="NONE"sp_auditoption "all" [, {"on"|"off"}]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"enable auditing COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enables or disables system-wide auditing. A System Security Officer must set the 
MOREINFO="NONE"enable auditing option to MOREINFO="NONE"on before any other auditing can take place. Enabling or 
disabling auditing automatically generates an audit record, so that you can bracket 
time periods when auditing was enabled.
Syntax: MOREINFO="NONE"sp_auditoption "enable auditing" [, {"on"|"off"}]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"logouts COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enables or disables auditing of all logouts from the server, including unintentional 
logouts such as dropped connections.
Syntax: MOREINFO="NONE"sp_auditoption "logouts" [, {"on"|"off"}]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"server boots COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enables or disables generation of an audit record when the server is rebooted.
Syntax: MOREINFO="NONE"sp_auditoption "server boots" [, {"on"|"off"}]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"adhoc records COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allows users to send text to the audit trail with the MOREINFO="NONE"sp_addauditrecord command.
Syntax: MOREINFO="NONE"sp_auditoption "adhoc records", {"on"|"off"}COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"logins COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enables or disables auditing of successful (MOREINFO="NONE"ok), failed (MOREINFO="NONE"fail), or all (MOREINFO="NONE"both) login 
attempts by all users. To audit individual users, use MOREINFO="NONE"sp_auditlogin.
Syntax: MOREINFO="NONE"sp_auditoption "logins" [, {"ok"|"fail"|"both"|"off"}]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"rpc connections COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"When this option is MOREINFO="NONE"on, it generates an audit record whenever a user from another 
host connects to the local server to run a procedure via a remote procedure call 
(RPC). Auditing can be enabled for all connection attempts (MOREINFO="NONE"both), successful 
attempts only (MOREINFO="NONE"ok), or failed attempts only (MOREINFO="NONE"fail).
Syntax: MOREINFO="NONE"sp_auditoption "rpc connections" [, {"ok"|"fail"|   
"both"|off"}]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"roles COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits the use of the MOREINFO="NONE"set role command to turn roles on and off. You can enable 
auditing of all attempts (MOREINFO="NONE"both), successful attempts only (MOREINFO="NONE"ok), or failed attempts only 
(MOREINFO="NONE"fail). (See the System Administration Guide for more information.)
Syntax: MOREINFO="NONE"sp_auditoption "roles" [, {"ok"|"fail"|"both"|"off"}]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"errors COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits fatal errors (errors that break the user's connection to the server and require 
the client program to be restarted), nonfatal errors, or both kinds of errors. Fatal 
errors do not include server internal fatal software errors (such as bus errors, and 
segmentation faults). In case of internal errors, information is contained in the 
errorlog file for the server.Syntax: MOREINFO="NONE"sp_auditoption "errors" [, {"nonfatal"|"fatal"   
|"both"|"off"}]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"{sa | sso | oper| navigator | replication}commandsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audits the use of privileged commands-those requiring one of the roles for 
execution. You can enable auditing for successful executions only, failed attempts 
(where failure is due to the user lacking the proper role), or both. See "Roles" in the 
SQL Server Reference Manual for a list of the commands that require the various 
roles.
Syntax: MOREINFO="NONE"sp_auditoption "{sa|sso|oper|navigator|replication}    
commands" [, {"ok"|"fail"|"both"|"off"}]REMAP="RI--RefIndent"MOREINFO="NONE"on | MOREINFO="NONE"off - MOREINFO="NONE"on enables auditing of the option.MOREINFO="NONE" off disables auditing for the option. MOREINFO="NONE"ok |MOREINFO="NONE" fail |MOREINFO="NONE" both |MOREINFO="NONE" off - enables auditing for successful attempts, failed attempts, or both when the option is one of the following: MOREINFO="NONE"logins, MOREINFO="NONE"rpc connections, or a role. MOREINFO="NONE"off disables auditing for the option. MOREINFO="NONE"nonfatal | MOREINFO="NONE"fatal | MOREINFO="NONE"both - for the MOREINFO="NONE"errors option, enables auditing of nonfatal or fatal errors, or both.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_auditoption REMAP="UN--Under"orREMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_auditoption "all"REMAP="UN--Under"Either of these commands displays the current settings of all the available global audit options.sp_auditoption "enable auditing", "on"REMAP="UN--Under"Enables system-wide auditing.sp_auditoption "server boots", "on"REMAP="UN--Under"Establishes auditing whenever the server boots.sp_auditoption "logins", "fail"REMAP="UN--Under"Establishes auditing of logins that fail due to lack of permission.sp_auditoption "rpc connections"REMAP="UN--Under"Displays the audit status of the MOREINFO="NONE"rpc connections option.sp_auditoption "errors", "fatal"REMAP="UN--Under"Establishes auditing of fatal errors (errors that break the user's connection to the server and require the client program to be restarted).sp_auditoption "sa commands", "both"REMAP="UN--Under"Establishes auditing of all commands that require the System Administrator role, whether the execution was successful or not.CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_auditoption takes effect immediately when it is executed. You do not need to reboot the server.The System Security Officer establishes system-wide auditing with this command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_auditoption "enable auditing", "on"REMAP="UN--Under"No other auditing takes place until this option is set to MOREINFO="NONE"on. An audit record is automatically generated when the MOREINFO="NONE"enable auditing option is set to MOREINFO="NONE"on or MOREINFO="NONE"off, so that the audit trail contains audit records that bracket the periods when auditing is enabled.Using MOREINFO="NONE"sp_auditoption with no arguments displays the current settings of all of the global audit options.If you specify any audit option without a further parameter, MOREINFO="NONE"sp_auditoption displays the current setting for that particular option. The exception is the MOREINFO="NONE"all option. When specified without a parameter, it displays the current settings for all of the global audit options.The initial value of all audit options is MOREINFO="NONE"off.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Audit option has been changed and has taken effect immediately.REMAP="UN--Under"The MOREINFO="NONE"sp_auditoption command succeeded. Changes made with MOREINFO="NONE"sp_auditoption take effect immediately.MOREINFO="NONE"Audit option "option
" MOREINFO="NONE"does not exist. Valid options are: REMAP="UN--Under"The valid options appear. You specified an invalid option. MOREINFO="NONE"Audit option "option
"MOREINFO="NONE" is ambiguous. Ambiguous options are: REMAP="UN--Under"You did not type enough letters of the option name to uniquely identify an option.MOREINFO="NONE"Can't run sp_auditoption from within a transaction.REMAP="UN--Under"Because this procedure updates system tables, it cannot be run from within a transaction.'option'MOREINFO="NONE" is an invalid audit option string in this context.REMAP="UN--Under"You specified an invalid parameter. MOREINFO="NONE"You must provide an audit option.REMAP="UN--Under"You did not specify an audit option.PermissionsREMAP="BO--Body"Only a System Security Officer can execute MOREINFO="NONE"sp_auditoption.Tables UsedREMAP="BO--Body"sybsecurity.dbo.sysauditoptions See AlsoSystem procedures     LINKEND="X86229"sp_addauditrecord
MOREINFO="NONE", LINKEND="X27092"sp_auditdatabase
MOREINFO="NONE", LINKEND="X81262"sp_auditlogin
MOREINFO="NONE", LINKEND="X49123"sp_auditobject
MOREINFO="NONE", LINKEND="X42468"sp_auditoption
MOREINFO="NONE", LINKEND="X26489"sp_auditsproc
 Topics     LINKEND="X26589"Auditing
ID="IN4630654064"sp_auditsproc system procedureID="X26489"sp_auditsproc ID="IN478644266"Auditingstored procedures
ID="IN478634367"Auditingtriggers
Audits the execution of stored procedures and triggers.SyntaxREMAP="BO--Body"To establish auditing for existing stored procedures and triggers:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"sp_auditsproc [sproc_name | "all", dbname[, {"ok" | "fail" | "both" | "off"}]]REMAP="BO--Body"To establish auditing for future stored procedures and triggers:REMAP="SY--Syntax" FORMAT="LINESPECIFIC"sp_auditsproc "default", dbname [, {"ok" | "fail" | "both" | "off"}]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"sproc_name | MOREINFO="NONE"all - specifies one or more stored procedures or triggers to audit. MARK="DASH" REMAP="BS--BulletSub"MOREINFO="NONE"sproc_name enables auditing for only the named stored procedure or trigger. If you specify sproc_name with no other parameters, it returns the auditing status of that stored procedure or trigger.MOREINFO="NONE"all enables auditing for all stored procedures within the specified database. If you use MOREINFO="NONE"all with no other parameters, it displays the auditing status of all stored procedures in the current database. MOREINFO="NONE"dbname - if used with the sproc_name | MOREINFO="NONE"all parameter, dbname is the name of the current database. If used with the MOREINFO="NONE"default parameter, dbname is the name of the database to audit.MOREINFO="NONE"ok | MOREINFO="NONE"fail | MOREINFO="NONE"both | MOREINFO="NONE"off - selectively enables auditing for successful executions only (MOREINFO="NONE"ok), executions that fail due to lack of permission (MOREINFO="NONE"fail), or both success and failure (MOREINFO="NONE"both). MOREINFO="NONE"off disables auditing for the named procedure or trigger. MOREINFO="NONE"fail applies only to stored procedures: triggers are not subject to permissions checks, so failure does not apply to them. (Use MOREINFO="NONE"sp_auditobject to audit the MOREINFO="NONE"select, insert, update, and MOREINFO="NONE"delete commands.)MOREINFO="NONE"default - sets the audit state for stored procedures and triggers created after setting the default. The default does not affect procedures and triggers already in existence. If you use MOREINFO="NONE"default with dbname but without the final parameter, it returns the default audit status for stored procedures and triggers in the named database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_auditsprocREMAP="UN--Under"Returns the names of all stored procedures and triggers being audited in the current database.sp_auditsproc sp_dboption REMAP="UN--Under"Returns the current auditing status of the system procedure MOREINFO="NONE"sp_dboption.sp_auditsproc sp_dboption, master, "fail"REMAP="UN--Under"Audits failed attempts to execute MOREINFO="NONE"sp_dboption in the master database.sp_auditsproc "all", pubs2REMAP="UN--Under"Returns the auditing status of all stored procedures and triggers in the pubs2 database.sp_auditsproc "all", pubs2, "fail"REMAP="UN--Under"Audits all executions of stored procedures and triggers on the current database that fail due to lack of permission.sp_auditsproc "default"REMAP="UN--Under"Returns the default settings for newly created stored procedures and triggers in the current database.sp_auditsproc "default", pubs2, okREMAP="UN--Under"Sets a default in the pubs2 database so that successful executions of new stored procedures and triggers are audited.CommentsMARK="BULL" REMAP="BU--Bullet"If you execute MOREINFO="NONE"sp_auditsproc with no parameters, it returns the names of any stored procedures and triggers on which auditing is currently enabled within the current database.MOREINFO="NONE"sp_auditsproc audits the execution of stored procedures and triggers. Any parameter values passed to a procedure are also audited.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"A sproc/trigger name or 'all' must be provided.MOREINFO="NONE"Can't run sp_auditsproc from within a transaction.REMAP="UN--Under"This procedure modifies system tables, so it cannot be run from within a transaction.MOREINFO="NONE"No databases currently have default sproc/trigger auditing enabled.MOREINFO="NONE"No sprocs/triggers currently have auditing enabled.MOREINFO="NONE"Only 'ok', 'fail', 'both' or 'off' can be specified.REMAP="UN--Under"You specified an invalid argument.sproc_name
MOREINFO="NONE" does not exist.REMAP="UN--Under"You specified an invalid stored procedure name.'sproc_name
'MOREINFO="NONE" has the following auditing options enabled:REMAP="UN--Under"MOREINFO="NONE"sp_auditsproc MOREINFO="NONE"sproc_name returns a list of the audit options on the specified stored procedure or trigger.MOREINFO="NONE"The third argument was not necessary; therefore, it was ignored.PermissionsREMAP="BO--Body"Only a System Security Officer can execute MOREINFO="NONE"sp_auditsproc.Tables UsedREMAP="BO--Body"sybsecurity.dbo.sysauditsSee AlsoSystem procedures     LINKEND="X42468"sp_auditoption
 Topics     LINKEND="X26589"AuditingREMAP="BO--Body"ID="X84736"sp_bindefaultID="IN43789134"Bindingdefaults
ID="IN43886165"Defaultssp_bindefault procedure for
ID="IN43785176"Columnsbinding defaults to
ID="IN432284187"User-defined datatypesbinding defaults to
ID="IN43983198"Datatypesbinding defaults to
ID="IN431682209"Database objectsbinding defaults to
Binds a default to a column or user-defined datatype. FORMAT="LINESPECIFIC"sp_bindefault MOREINFO="NONE"defaultname, MOREINFO="NONE"objectname [, futureonly] ParametersREMAP="RI--RefIndent"MOREINFO="NONE"defaultname - is the name of a default created with MOREINFO="NONE"create default statements to bind to specific columns or user-defined datatypes. MOREINFO="NONE"objectname - is the name of the table and column, or user-defined datatype, to which to bind the default. If the objectname parameter is not of the form "table.column", it is assumed to be a user-defined datatype. If the object name includes embedded blanks or punctuation, or is a reserved word, enclose it in quotation marks. REMAP="UN--Under"By default, existing columns of the user-defined datatype inherit the default defaultname, unless the column's default was previously changed. ID="IN4317782412"futureonly optionsp_bindefault
MOREINFO="NONE"futureonly - prevents existing columns of a user-defined datatype from acquiring the new default. This parameter is optional when binding a default to a user-defined datatype. It is never used when binding a default to a column. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_bindefault today, "employees.startdate" REMAP="UN--Under"Assuming that a default named today has been defined in the current database with MOREINFO="NONE"create default, this command binds it to the startdate column of the employees table. Each new row added to the employees table has the value of the today default in the startdate column unless another value is supplied. sp_bindefault def_ssn, ssn REMAP="UN--Under"Assuming that a default named def_ssn and a user-defined datatype named ssn exist, this command binds def_ssn to ssn. The default is inherited by all columns that are assigned the user-defined datatype ssn when a table is created. Existing columns of type ssn also inherit the default def_ssn unless you specify MOREINFO="NONE"futureonly (which prevents existing columns of that user-defined datatype from inheriting the default), or unless the column's default has previously been changed (in which case the changed default is maintained). sp_bindefault def_ssn, ssn, futureonly REMAP="UN--Under"Binds the default def_ssn to the user-defined datatype ssn. Because the MOREINFO="NONE"futureonly parameter is included, no existing columns of type ssn are affected. CommentsMARK="BULL" REMAP="BU--Bullet"You can create column defaults in two ways: by declaring the default as a column constraint in the MOREINFO="NONE"create table or MOREINFO="NONE"alter table statement, or by creating the default using the MOREINFO="NONE"create default statement and binding it to a column using MOREINFO="NONE"sp_bindefaultID="IN4330742815"sp_bindefault system procedurecreate default and
. Using MOREINFO="NONE"create default, you can bind that default to more than one column in the database.You cannot bind a default to a SQL Server-supplied datatype.Defaults bound to a column or user-defined datatype with the IDENTITY property have no effect on column values. Each time you insert a row into the table, SQL Server assigns the next sequential number to the IDENTITY column.If binding a default to a column, give the objectname argument in the form "table.column". Any other format is assumed to be the name of a user-defined datatype. If a default already exists on a column, you must remove it before binding a new default. Use MOREINFO="NONE"sp_unbindefault to remove defaults created with MOREINFO="NONE"sp_bindefault. Use MOREINFO="NONE"alter table to remove defaults created with MOREINFO="NONE"create table.Existing columns of the user-defined datatype inherit the new default unless their default was previously changed, or the value of the optional third parameter is MOREINFO="NONE"futureonly. New columns of the user-defined datatype always inherit the default. Statements that use a default cannot be in the same batch as their MOREINFO="NONE"sp_bindefault statement. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Default and table or usertype must be in current database.REMAP="UN--Under"The objectname parameter supplied with the procedure contained a reference to another database. Defaults can be bound to objects in the current database only. MOREINFO="NONE"Default bound to column.REMAP="UN--Under"The default was successfully bound to the specified column in the specified table. MOREINFO="NONE"Default bound to datatype.REMAP="UN--Under"The default was successfully bound to the specified user-defined datatype. MOREINFO="NONE"No such default exists. You must create the default first.REMAP="UN--Under"First create the default in the current database with MOREINFO="NONE"create default. Then execute MOREINFO="NONE"sp_bindefault. MOREINFO="NONE"The column already has a default. Bind disallowed.REMAP="UN--Under"Execute MOREINFO="NONE"sp_unbindefault to unbind the existing default.MOREINFO="NONE"The new default has been bound to column(s) of the specified user datatype.REMAP="UN--Under"The command succeeded. Existing columns of the user-defined datatype specified now have the new default bound to them (unless their defaults were previously changed). MOREINFO="NONE"Usage: sp_bindefault defaultname, objectname [, `futureonly']REMAP="UN--Under"Syntax summary. You incorrectly specified a parameter to MOREINFO="NONE"sp_bindefault.MOREINFO="NONE"You cannot bind a declared default. The default must be created using create default.REMAP="UN--Under"First create the default in the current database with MOREINFO="NONE"create default. Then execute MOREINFO="NONE"sp_bindefault. MOREINFO="NONE"You can't bind a default to a timestamp datatype column.REMAP="UN--Under"The value in a timestamp column represents a SQL Server-supplied sequence identifier. You cannot supply a default value for a timestamp.MOREINFO="NONE"You do not own a column of that name.REMAP="UN--Under"Only the owner of a table can bind a default to any of its columns. You are not the owner, or the object doesn't exist. MOREINFO="NONE"You do not own a datatype of that name.REMAP="UN--Under"Only the owner of a user-defined datatype can bind a default to it. You are not the owner. PermissionsREMAP="BO--Body"Only the object owner can issue MOREINFO="NONE"sp_bindefault. Tables UsedREMAP="BO--Body"syscolumns, sysobjects, sysprocedures, systypesSee AlsoCommands     LINKEND="X81463"create default
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X97463"drop defaultSystem procedures     LINKEND="X87638"sp_unbindefault
ID="IN4330703220"sp_bindefault system procedure
ID="IN437693321"Bindingdefaults
ID="IN4322683422"User-defined datatypesbinding defaults to
ID="IN437673523"Columnsbinding defaults to
ID="IN4316663624"Database objectsbinding defaults to
ID="IN439653725"Datatypesbinding defaults to
ID="IN438624026"Defaultssp_bindefault procedure for
 ID="IN4327584427"sp_bindmsg system procedureID="X87441"sp_bindmsgID="IN447574629"Bindinguser messages to constraints
ID="IN4433574630"Referential integrity constraintsbinding user messages to
ID="INA4417574631"Check constraintsbinding user messages to
ID="IN4411574632"Constraintsbinding user messages to
Binds a user message to a referential integrity constraint or check constraint. FORMAT="LINESPECIFIC"sp_bindmsg constraint_name, message_numParametersREMAP="RI--RefIndent"MOREINFO="NONE"constraint_name - is the name of the integrity constraint to which you are binding a message. Use theMOREINFO="NONE" constraint clause of the MOREINFO="NONE"create table command, or the MOREINFO="NONE"add constraint clause of the MOREINFO="NONE"alter table command to create and name constraints.MOREINFO="NONE"message_num - is the number of the user message to bind to an integrity constraint. The message must exist in the sysusermessages table in the local database prior to calling MOREINFO="NONE"sp_bindmsg.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_bindmsg positive_balance, 20100REMAP="UN--Under"Binds user message number 20100 to the positive_balance constraint. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_bindmsg binds a user message to an integrity constraint by adding the message number to the constraint row in the ID="IN4420535037"sysconstraints tablesp_bindmsg and
sysconstraints table. ID="IN4420535038"Number (quantity of)messages per constraintOnly one message can be bound to a constraint. To change the message for a constraint, just bind a new message. The new message number replaces the old message number in the sysconstraints table. Use the MOREINFO="NONE"sp_addmessage procedure to insert user messages into the sysusermessages table.MOREINFO="NONE"sp_help tablename displays all constraint names declared on tablename.MOREINFO="NONE"sp_getmessage procedure retrieves message text from the sysusermessages table.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Binding message failed unexpectedly. Please try again.REMAP="UN--Under"An error occurred while binding this message. Reissue the command.MOREINFO="NONE"Constraint name must be in `current' database.REMAP="UN--Under"You can only bind messages to constraints that are defined in the current database.MOREINFO="NONE"Constraint name must belong to the current user.REMAP="UN--Under"You cannot bind a message to a constraint created by another user.MOREINFO="NONE"Message bound to constraintREMAP="UN--Under"You successfully bound the message to the constraint.MOREINFO="NONE"Message id must be a user defined message.REMAP="UN--Under"User-defined messages must have a number greater than 20000. Only user-defined messages can be bound to constraints.MOREINFO="NONE"No such constraint exists. Please create the constraint first using CREATE/ALTER TABLE command.REMAP="UN--Under"Use MOREINFO="NONE"create table or MOREINFO="NONE"alter table to create the constraint before binding a message to it. You can see a list of all existing constraints on a table by using MOREINFO="NONE"sp_help tablename.MOREINFO="NONE"No such message exists. Please create the message first using sp_addmessage.REMAP="UN--Under"The message must exist in the sysusermessages table before you can bind it to a constraint. Use MOREINFO="NONE"sp_addmessage to create the message.MOREINFO="NONE"No such referential or check constraint exists. Please check whether the constraint name is correct.REMAP="UN--Under"You can see a list of all existing constraints on a table by using MOREINFO="NONE"sp_help tablename. PermissionsREMAP="UN--Under"Only the object owner can execute MOREINFO="NONE"sp_bindmsg. Tables UsedREMAP="BO--Body"sysconstraints, sysobjects, sysusermessagesSee AlsoCommands     LINKEND="X68185"alter table
MOREINFO="NONE", LINKEND="X80969"create tableSystem procedures     LINKEND="X36529"sp_addmessage
MOREINFO="NONE", LINKEND="X61947"sp_getmessage
MOREINFO="NONE", LINKEND="X39400"sp_unbindmsg
ID="IN4428495443"sp_bindrule system procedureID="X38718"sp_bindruleID="IN455475745"Rulesbinding;Binding:rules
ID="IN457455946"Columnsbinding rules to;Columns:rules
Binds a rule to a column or user-defined datatype. FORMAT="LINESPECIFIC"sp_bindrule MOREINFO="NONE"rulename, MOREINFO="NONE"objectname [, futureonly] ParametersREMAP="RI--RefIndent"ID="IN455455949"Rulesnaming user-created
MOREINFO="NONE"rulename - is the name of a rule. Create rules with MOREINFO="NONE"create rule statements and bind rules to specific columns or user-defined datatypes with MOREINFO="NONE"sp_bindrule. ID="IN4516455950"Database objectsbinding rules to
MOREINFO="NONE"objectname ID="IN4522455951"User-defined datatypesbinding rules to
- is the name of the table and column, or user-defined datatype, to which the rule is to be bound. If objectname is not of the form "table.column", it is assumed to be a user-defined datatype. If the object name has embedded blanks or punctuation, or is a reserved word, enclose it in quotation marks.ID="IN4517416352"futureonly optionsp_bindrule
MOREINFO="NONE"futureonly - prevents existing columns of a user-defined datatype from inheriting the new rule. This parameter is optional when binding a rule to a user-defined datatype. It is meaningless when binding a rule to a column. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_bindrule today, "employees.startdate" REMAP="UN--Under"Assuming that a rule named today has been created in the current database with MOREINFO="NONE"create rule, this command binds it to the startdate column of the employees table. When a row is added to employees, the data for the startdate column is checked against the rule today. sp_bindrule rule_ssn, ssn REMAP="UN--Under"Assuming the existence of a rule named rule_ssn and a user-defined datatype named ssn, this command binds rule_ssn to ssn. In a MOREINFO="NONE"create table statement, columns of type ssn inherit the rule rule_ssn. Existing columns of type ssn also inherit the rule rule_ssn, unless ssn's rule was previously changed (in which case the changed rule is maintained in the future only). sp_bindrule rule_ssn, ssn, futureonly REMAP="UN--Under"The rule rule_ssn is bound to the user-defined datatype ssn, but no existing columns of type ssn are affected. MOREINFO="NONE"futureonly prevents existing columns of type ssn from inheriting the rule.CommentsMARK="BULL" REMAP="BU--Bullet"First use the MOREINFO="NONE"create rule statement to create a rule. Then execute MOREINFO="NONE"sp_bindrule to bind it to a column or user-defined datatype in the current database. ID="IN4514396555"insert commandbound rules andREMAP="UN--Under"The rule is enforced when an MOREINFO="NONE"insert is attempted, not at binding. You can bind a character rule to a column with an exact or approximate numeric datatype, even though such an MOREINFO="NONE"insert is illegal. You cannot use MOREINFO="NONE"sp_bindrule to bind a check constraint for a column in a MOREINFO="NONE"create table statement.You cannot bind a rule to a SQL Server-supplied datatype, or to a text or image column. If binding to a column, the objectname argument must be of the form "table.column". Any other format is assumed to be the name of a user-defined datatype. Statements that use a rule cannot be in the same batch as their MOREINFO="NONE"sp_bindrule statement. ID="IN459366856"HierarchyHierarchySee also Precedence!see also Precedence
ID="IN4535337157"Datatype precedence. See Precedence
ID="IN4510337158"Precedencerule bindingYou can bind a rule to a column or user-defined datatype without unbinding an existing rule. Rules bound to columns always take precedence over rules bound to user-defined datatypes. Binding a rule to a column will replace a rule bound to the user-defined datatype of that column, but binding a rule to a datatype will not replace a rule bound to a column of that user-defined datatype. The following chart indicates the precedence when binding rules to columns and user-defined datatypes where rules already exist:TOCENTRY="1"LBL="Table 4-5:"Precedence of New and Old Bound RulesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="13*"COLNAME="C2" COLWIDTH="13*"COLNAME="C3" COLWIDTH="11*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"New Rule Bound toCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Old Rule Bound to user-defined datatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"user-defined datatypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"replaces old ruleCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"no change COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"columnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"replaces old ruleCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"replaces old ruleID="IN4517297559"futureonly optionsp_bindruleExisting columns of the user-defined datatype inherit the new rule unless their rule was previously changed, or the value of the optional third parameter is MOREINFO="NONE"futureonly. New columns of the user-defined datatype always inherit the rule. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"No such rule exists. You must create the rule first.REMAP="UN--Under"First create the rule in the current database with MOREINFO="NONE"create rule. Then execute MOREINFO="NONE"sp_bindrule. MOREINFO="NONE"Rule and table or usertype must be in current database.REMAP="UN--Under"The objectname parameter contained a reference to another database. Rules can only be bound to objects in the current database. MOREINFO="NONE"Rule bound to datatype.REMAP="UN--Under"The rule was successfully bound to the specified user-defined datatype. MOREINFO="NONE"Rule bound to table column.REMAP="UN--Under"The rule was successfully bound to the specified column in the specified table. MOREINFO="NONE"The new rule has been bound to column(s) of the specified user datatype.REMAP="UN--Under"Existing columns of the specified user-defined datatype now have the new rule bound to them (unless their rules were previously changed). MOREINFO="NONE"Usage: sp_bindrule rulename, objectname [,futureonly]REMAP="UN--Under"Syntax summary. You incorrectly specified a parameter to MOREINFO="NONE"sp_bindrule.MOREINFO="NONE"You can't bind a rule to a text, image, or timestamp datatype column.REMAP="UN--Under"The column you specified was a text, image, or timestamp column. Rules cannot be applied to text, image, or timestamp datatypes. MOREINFO="NONE"You can't bind a rule to a text, image, or timestamp datatype.REMAP="UN--Under"The datatype you specified was a text, image, or timestamp datatype. Rules cannot be applied to text, image, or timestamp datatypes.MOREINFO="NONE"You cannot bind a declared constraint. The rule must be created using create rule.REMAP="UN--Under"First create the rule in the current database with MOREINFO="NONE"create rule. Then execute MOREINFO="NONE"sp_bindrule. MOREINFO="NONE"You do not own a column of that name.REMAP="UN--Under"Only the owner of a table can bind a rule to any of its columns. You are not the owner, or the object doesn't exist. MOREINFO="NONE"You do not own a datatype of that name.REMAP="UN--Under"Only the owner of a user-defined datatype can bind a rule to it. You are not the owner.PermissionsREMAP="BO--Body"Only the object owner can execute MOREINFO="NONE"sp_bindrule. Tables UsedREMAP="BO--Body"syscolumns, sysconstraints, sysobjects, sysprocedures, systypesSee AlsoCommands     LINKEND="X43186"create rule
MOREINFO="NONE", LINKEND="X62555"drop ruleSystem procedures     LINKEND="X37191"sp_unbindrule
ID="IN4528257964"sp_bindrule system procedure
ID="IN455238165"Rulesbinding;Binding:rules
ID="IN457218366"Columnsbinding rules to;Columns:rules
 REMAP="BO--Body"ID="X78355"sp_changedbownerID="IN4389573"Changingcurrent database owner
ID="IN435592104"Owners. See Database object owners; Database Owners
ID="IN431592105"Database Ownerschanging
ID="IN431589136"Database OwnersDatabase OwnersSee also Database object owners; Permissions!see also
Changes the owner of a database. Do not change the owner of the sybsystemprocs database.FORMAT="LINESPECIFIC"sp_changedbowner MOREINFO="NONE"login_name [, true ] ParametersREMAP="RI--RefIndent"MOREINFO="NONE"login_name - is the login name of the new owner of the current database. The new owner must not already be known as either a user or alias (that is, the new owner must not already be listed in sysusers or sysalternates). Executing MOREINFO="NONE"sp_changedbowner with the single parameter login_name changes the database ownership to login_name and drops aliases of users who could act as the old "dbo." ID="IN432985179"true option, sp_changedbowner
MOREINFO="NONE"true - To transfer aliases and their permissions to the new "dbo," add this optional parameter. The only acceptable values are "true" or "TRUE". ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_changedbowner albertREMAP="UN--Under"Makes the user "albert" the owner of the current database. CommentsMARK="BULL" REMAP="BU--Bullet"After executing MOREINFO="NONE"sp_changedbowner, the new owner is known as Database Owner inside the database. ID="IN4315851712"Database Ownerschanging the login of;Logins:changing current database ownerThe new owner must already have a login name on SQL Server, but must notID="IN437851713"Aliasesdatabase ownership transfer and
 have a database user name or alias name in the database. To assign Database Ownership to such a user, drop the user name or alias entry before executing MOREINFO="NONE"sp_changedbowner. ID="IN4311851714"Permissionsnew Database OwnerTo grant permissions to the new owner, a System Administrator must grant them to the Database Owner, since the user is no longer known inside the database under any other name. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't change the owner of the master database.REMAP="UN--Under"No one can change the owner of the master database.MOREINFO="NONE"Database owner changed.REMAP="UN--Under"The MOREINFO="NONE"sp_changedbowner command succeeded and the Database Owner changed. MOREINFO="NONE"Only the System Administrator (SA) or the Database Owner (dbo) can change the owner of a database.REMAP="UN--Under"You must be a System Administrator or the Database Owner to execute MOREINFO="NONE"sp_changedbowner. MOREINFO="NONE"The dependent aliases were mapped to the new dbo.REMAP="UN--Under"You set the optional parameter "true". Aliases and their permissions transferred to the new "dbo".MOREINFO="NONE"The dependent aliases were dropped.REMAP="UN--Under"You did not set the optional parameter "true". Aliases and their permissions have been dropped.MOREINFO="NONE"No login with the specified name exists.REMAP="UN--Under"The proposed new Database Owner must have a login on SQL Server. MOREINFO="NONE"The proposed new db owner already is a user in the database.REMAP="UN--Under"The specified login_name is already a user in the current database. To make the user the Database Owner, drop the user entry from the current database's sysusers table. MOREINFO="NONE"The proposed new db owner already is aliased in the database.REMAP="UN--Under"The specified login_name is already aliased in the current database. To make the user the Database Owner, drop the user alias entry from the current database's sysalternates table. PermissionsREMAP="BO--Body"Only a System Administrator or the Database Owner can execute MOREINFO="NONE"sp_changedbowner. Tables UsedREMAP="BO--Body"master.dbo.syslogins, sysalternates, sysobjects, sysusersSee AlsoCommands     LINKEND="X75308"create databaseSystem procedures     LINKEND="X25636"sp_addlogin
MOREINFO="NONE", LINKEND="X47662"sp_dropalias
MOREINFO="NONE", LINKEND="X46789"sp_dropuser
MOREINFO="NONE", LINKEND="X90458"sp_helpdb
ID="IN4333812119"sp_changedbowner system procedure
ID="IN438802220"Changingcurrent database owner
 ID="IN4331762621"sp_changegroup system procedure
ID="IN4329703222"sp_dropgroup system proceduresp_dropgroup system procedureSee also sp_changegroup!see also sp_changegroupID="X18596"sp_changegroupID="IN445693424"Userschange group for
ID="IN446683525"Groupschanging
ID="IN448673626"Changinguser's group
Changes a user's group. FORMAT="LINESPECIFIC"sp_changegroup MOREINFO="NONE"grpname, MOREINFO="NONE"name_in_db ParametersREMAP="RI--RefIndent"MOREINFO="NONE"grpname - is the name of the group. The group must already exist in the current database. If you use "public" as the grpname, enclose it in quotes because it is a SQL keyword. MOREINFO="NONE"name_in_db - is the name of the user to add to the group. The user must already exist in the current database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_changegroup fort_mudge, albert REMAP="UN--Under"The user "albert" is now a member of the "fort_mudge" group. It doesn't matter what group "albert" belonged to before. sp_changegroup "public", albertREMAP="UN--Under"Removes "albert" from the group he belonged to without making him a member of a new group (all users are always members of "public".)CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_changegroup adds the specified user to the specified group. The user is dropped from the group he or she previously belonged to and added to the one specified by grpname. New database users can be added to groups at the same time they are given access to the database with MOREINFO="NONE"sp_adduser. ID="IN4414653831""public" grouppublic groupsp_changegroup andsp_changegroup and
ID="IN4420653832"Number (quantity of)groups per userGroups are used as a collective name for granting and revoking privileges. Every user is always a member of the default group, "public", and can belong to only one other group. ID="IN448653833"Droppinguser from a groupTo remove someone from a group without making him a member of a new group, use this command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_changegroup "public", MOREINFO="NONE"name_in_dbWhen a user changes from one group to another, the user loses all permissions that he or she had as a result of belonging to the old group, and gains the permissions granted to the new group.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Group changed.REMAP="UN--Under"The user now belongs to the specified group. MOREINFO="NONE"No group with the specified name exists.REMAP="UN--Under"The specified group doesn't exist in the current database. MOREINFO="NONE"No user with the specified name exists in the current database.REMAP="UN--Under"The specified user doesn't exist in the current database. PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_changegroup. Tables UsedREMAP="BO--Body"master.dbo.syssrvroles, syscolumns, sysobjects, sysprotects, sysusers See AlsoCommands     LINKEND="X69087"grant
MOREINFO="NONE", LINKEND="X29921"revokeSystem procedures     LINKEND="X65925"sp_addgroup
MOREINFO="NONE", LINKEND="X68639"sp_adduser
MOREINFO="NONE", LINKEND="X17416"sp_dropgroup
MOREINFO="NONE", LINKEND="X25329"sp_helpgroup
ID="IN4431614238"sp_changegroup system procedure
ID="IN448604339"Changinguser's group
ID="IN446594440"Groupschanging
ID="IN445584541"Userschange group for
ID="IN4430544942"sp_checknames system proceduresp_checknamesID="IN4514525244"Character setschecking with sp_checknames
ID="IN4551505445"7-bit ASCII characters, checking with sp_checknames
ID="IN4516485646"ASCII characterschecking for with sp_checknames
Checks the current database for names that contain characters not in the 7-bit ASCII set. FORMAT="LINESPECIFIC"sp_checknamesParametersREMAP="BO--Body"None.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_checknamesREMAP="UIW--UserInputWide" FORMAT="LINESPECIFIC"Looking for non 7-bit ASCII characters in the system tables of database: "master"  =============================================================Table.Column name:  "syslogins.password" The following logins have passwords that contain non 7-bitASCII characters.  If you wish to change them use "sp_password";Remember, only the sa and the login itself may examine or changethe syslogins.password column:  suid   name                            ------ ------------------------------       1 sa      2 probe      3 bogususer CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_checknamesID="IN4522465851"Object names, databasechecking with sp_checknames
ID="IN457446052"Columnschecking with sp_checknames
ID="IN457426253"Indexeschecking with sp_checknames
ID="IN459406454"Databaseschecking with sp_checknames
 examines the names of all objects, columns, indexes, user names, group names, and other elements in the current database for characters outside of the 7-bit ASCII set. It reports illegal names and gives instructions to make them compatible with the 7-bit ASCII set. ID="IN455386655"Nameschecking with sp_checknames
ID="IN457366856"Serversupgrading and sp_checknamesRun MOREINFO="NONE"sp_checknames in every database on your server after upgrading from a server of release 4.0.x or 4.2.x, and using a default character set that was not 7-bit ASCII.Follow the instructions in the MOREINFO="NONE"sp_checknames report to correct all of the non-ASCII names. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Good news? Database "master" has no obj/user/etc. names that contain non 7-bit ASCII characters.REMAP="UN--Under"If MOREINFO="NONE"sp_checknames finds any names are found that are not fully 7-bit ASCII, appropriate messages and remedial instructions appear. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_checknames. Tables UsedREMAP="BO--Body"MOREINFO="NONE"sp_checknames uses the following tables when run in any database: REMAP="BO--Body"dbo.syscolumns, dbo.sysindexes, dbo.sysobjects, dbo.syssegments, dbo.systypes, dbo.sysusers REMAP="BO--Body"MOREINFO="NONE"sp_checknames uses the following tables only when run in the master database: REMAP="BO--Body"master.dbo.sysdatabases, master.dbo.sysdevices, master.dbo.syslogins, master.dbo.sysremotelogins, master.dbo.sysservers See AlsoCommandsLINKEND="X54355"updateSystem procedures     
LINKEND="X24535"sp_modifylogin
, LINKEND="X96621"sp_password
MOREINFO="NONE", LINKEND="X37949"sp_rename
MOREINFO="NONE", LINKEND="X99854"sp_renamedb
ID="IN4533327261"sp_checkreswords system procedureID="X60474"sp_checkreswordsID="IN468327363"KeywordsKeywordsas identifiersidentifiers
ID="IN4611307564"IdentifiersReserved wordsreserved words and;Reserved words:as identifiersidentifiers
ID="IN465287765"Nameschecking with sp_checkreswords
Detects and displays identifiers that are Transact-SQL reserved words. Checks server names, device names, database names, segment names, user-defined datatypes, object names, column names, user names, login names, and remote login names.FORMAT="LINESPECIFIC"sp_checkreswords [username]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"username - is the name of a user in the current database. If you supply username, MOREINFO="NONE"sp_checkreswords checks only for objects that the specified user owns.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_checkreswords (executed in master)REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC" Reserved Words Used as Database Object Names for Database master  Upgrade renames sysobjects.schema to sysobjects.schemacnt.  Owner                           ------------------------------  dbo                              Table                          Reserved Word Column Names    ------------------------------ ------------------------------  authorization                  cascade                          Object Type                    Reserved Word Object Names    ------------------------------ ------------------------------  rule                           constraint                      stored procedure               check                           user table                     arith_overflow                  user table                     authorization                    -------------------------------------------------------------  -------------------------------------------------------------   Owner                           ------------------------------  lemur                            Table                          Reserved Word Column Names    ------------------------------ ------------------------------  key                            close                  Table                          Reserved Word Index Names     ------------------------------ ------------------------------  key                            isolation                        Object Type                    Reserved Word Object Names    ------------------------------ ------------------------------  default                        isolation                       rule                           level                           stored procedure               mirror                          user table                     key                              Reserved Word Datatype Names  ------------------------------  identity                                                                                        -------------------------------------------------------------  -------------------------------------------------------------   Database-wide Objects  ---------------------                          Reserved Word User Names      ------------------------------  at                              identity                         Reserved Word Login Names     ------------------------------  at                              identity                         Reserved Word as Database Names  ------------------------------  work                             Reserved Word as Language Names  ------------------------------  national                         Reserved Word as Server Names    ------------------------------  mirror                          primary                          Reserved Word ServerNetNames    --------------------------------  mirror                            primary                           (return status = 22)sp_checkreswords (executed in user database) REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Reserved Words Used as Database Object Names for Database user_db  Upgrade renames sysobjects schema to sysobjects.schemacnt.  Owner                           ------------------------------  tamarin                          Table                          Reserved Word Column Names    ------------------------------ ------------------------------  cursor                         current                         endtran                        current                         key                            identity                        key                            varying                         schema                         primary                         schema                         references                      schema                         role                            schema                         some                            schema                         user                            schema                         work                             Table                          Reserved Word Index Names     ------------------------------ ------------------------------  key                            double                           Object Type                    Reserved Word Object Names    ------------------------------ ------------------------------  default                        escape                          rule                           fetch                           stored procedure               foreign                         user table                     cursor                          user table                     key                             user table                     schema                          view                           endtran                                                                                         -------------------------------------------------------------  -------------------------------------------------------------   Database-wide Objects  ---------------------                        Found no reserved words used as names for database-wide objects. (return status = 18)CommentsMARK="BULL" REMAP="BU--Bullet"Use MOREINFO="NONE"sp_checkreswordsID="IN467267970"Serversupgrading and sp_checkreswords
 before or immediately after upgrading to a new version of SQL Server. See the Sybase SQL Server Installation Guide for your platform for information on installing and running this procedure before performing the upgrade.MOREINFO="NONE"sp_checkreswords also finds reserved words used as identifiers that were created using the MOREINFO="NONE"set quoted_identifier option.Run MOREINFO="NONE"sp_checkreswordsID="IN4615228371"master databasechecking with sp_checkreswords
 in master and each of your user databases. Also run it in model if you have added users or objects to the model database.The return status indicates the number of items found.MOREINFO="NONE"sp_checkreswordsID="IN4622208572"Object names, databasechecking with sp_checkreswords
ID="IN4612208573"Transact-SQLreserved words
 reports the names of existing objects that are reserved words. Transact-SQL does not allow words that are part of any command syntax to be used for identifiers, unless you are using delimited identifiers. Reserved words are pieces of SQL syntax, and they have special meaning when you type them as part of a command. For example, in a pre-System 10.0 server, you could have a table called work, and select data from it with this query:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select * from workREMAP="UN--Under"work is a new reserved word in System 10.0, part of the command MOREINFO="NONE"commit work. Typing the same MOREINFO="NONE"selectID="IN466208574"Syntaxchecking for reserved words
 statement in a System 10.0 SQL Server causes a syntax error. MOREINFO="NONE"sp_checkreswords finds identifiers that would cause these problems.If you supply a user
name,MOREINFO="NONE"sp_checkreswordsID="IN466188775"Tableschecking name with sp_checkreswordsID="IN467168976"Indexeschecking name with sp_checkreswordsID="IN465149177"Viewschecking name with sp_checkreswordsID="IN468129378"Triggerschecking name with sp_checkreswordsID="IN465109579"Ruleschecking name with sp_checkreswordsID="IN46889780"Defaultschecking name with sp_checkreswordsID="IN462269981"User-defined datatypeschecking name with sp_checkreswords checks for all of the objects that a user can own: tables, indexes, views, procedures, triggers, rules, defaults, and user-defined datatypes. It reports all identifiers that are reserved words.If your current database is a user database, model, or tempdb, and you do not provide a user name, MOREINFO="NONE"sp_checkreswords  checks for all of the objects above, with a separate section in the report for each user name. It also checks sysusers and syssegmentsID="IN4610410182"User nameschecking with sp_checkreswords
ID="IN468210383"Segmentschecking names with sp_checkreswords
 for user names and segment names that are reserved words. You only need to check model if you have added objects, users, or user-defined datatypes to model.If your current database is master, and you do not provide a user name, MOREINFO="NONE"sp_checkreswords performs all of the checks above and also checks sysdatabases, syslogins, syscharsets, sysservers, sysremotelogins, sysdevices and syslanguagesID="IN4614010584"Character sets checking with sp_checkreswords
ID="IN4620-210785"Languages, alternatechecking with sp_checkreswords
for reserved words used as the names of databases, local or remote logins, local and remote servers, character sets or languages.Handling Reported Instances of Reserved WordsMARK="BULL" REMAP="BU--Bullet"If MOREINFO="NONE"sp_checkreswords reports that reserved words are used as identifiers, you have two options:MARK="DASH" REMAP="BS--BulletSub"Change the name of the identifier using MOREINFO="NONE"sp_rename, sp_renamedb, or, in some cases, by performing updates to system tables. ID="IN4618-410986"Quoted identifiersusing;Identifiers:set quoted_identifiers on
ID="IN4611-611187"Identifierssp_checkreswords andUse the MOREINFO="NONE"quoted_identifier option of the MOREINFO="NONE"setID="IN4617-811388"Stored proceduressp_checkreswords and
 command if the reserved word is a table name, view name, or column name. If most of your applications use stored procedures, you can drop and re-create these procedures with the MOREINFO="NONE"quoted_identifier option set, and all identifiers quoted. All users will be able to run them, without having to turn the MOREINFO="NONE"quoted_identifier option on for their session. You can also turn on the MOREINFO="NONE"quoted_identifier option, create views that give alternative names to tables or columns, and change your applications to reference the view instead. The following example provides alternatives for the new reserved words "key", "level", and "work":REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create view keyviewasselect lvl = "level", wrk = "work"from "key"ID="IN4611-811389"IdentifiersquotingIf you do not change the identifiers, or use delimited identifiers, any query that uses the reserved words as identifiers reports an error, usually a syntax error. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select level, work from keyREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Msg 156, Level 15, State 1:Server 'rosie', Line 1:Incorrect syntax near the keyword 'level'.REMAP="UN--Under"You can ignore reserved words used as identifiers only if no queries of any kind ever reference the identifier. This is probably impossible to avoid.ID="IN4618-811390"Quoted identifierstestingThe quoted identifier option is a SQL 92 option, and may not be supported by many client products which support other SQL Server features. For example, you cannot use MOREINFO="NONE"bcpID="IN4621-811391"Quotation marks (" ")enclosing reserved words;" " (quotation marks):enclosing reserved words
 on tables whose names are reserved words. Before choosing the quoted identifier option, perform a test on various objects using all of the tools you will use to access SQL Server. Turn on the quoted identifier option, and create a table with a reserved word for a name, and reserved-word column names. If the client product generates SQL code, it must enclose identifiers in double quotes (if they are reserved words) and character constants in single quotes.ID="IN4629-811392"Dependencies, database objectchanging names ofProcedures, triggers and views that depend on objects whose names have changed may continue to work for some time after the name change, and then suddenly stop working when the query plan is recompiled. Recompilation takes place for many reasons, without notification to the user. Change the names of objects in procedures, triggers, or views immediately after you change the object name.Whether you choose to change the object names or use delimited identifiers, you must change all stored procedures, views, triggers, and applications that include the reserved word. If you change object names, you must change identifiers; if you use delimited dentifiers, you must add the MOREINFO="NONE"set MOREINFO="NONE"quoted_identifier option and quotation marks.ID="IN464-1011593"Textcopying with defncopyIf you do not have the text of your procedures, triggers, views, rules or defaults saved in operating system files, you can use ID="IN4624-1211794"defncopy utility command
MOREINFO="NONE"defncopy to copy the definitions from the server to files. See MOREINFO="NONE"defncopy in the SQL Server Utility Programs manual for your platform.Changing IdentifiersID="IN465-1211795"Nameschanging identifier;Identifiers:changing names ofMARK="BULL" REMAP="BU--Bullet"If you choose to change the names of the items reported by MOREINFO="NONE"sp_checkreswords, you must change the names in all of the procedures, triggers, views and applications that reference the object using the reserved word.Dump your database before changing identifier names. After you change the identifier names, run MOREINFO="NONE"dbcc to determine that there are no problems, and dump the database again.If you are changing identifiers on an active production database:MARK="DASH" REMAP="BS--BulletSub"Perform these changes when the system is least busy, so that you will disrupt as few users as possible.ID="IN4619-1211796"DB-Library programschanging identifier names andPrepare carefully by finding all Open Client DB-Library programs, windowing applications, stored procedures, triggers, and scripts that use a particular identifier. This way, you can make the edits needed in the source code, and then change the identifiers and replace the procedures and code as quickly as possible.The procedure MOREINFO="NONE"sp_depends can help find procedures, views, and triggers that use table and view names.Using sp_rename to Change IdentifiersMARK="BULL" REMAP="BU--Bullet"The system procedure MOREINFO="NONE"sp_rename renames tables, indexes, views, procedures, triggers, rule, defaults, user-defined datatypes, and columns. Use MOREINFO="NONE"sp_renamedb, explained later, for renaming databases.LINKEND="X26305"Table 4-6
 shows the types of identifiers that you can change with MOREINFO="NONE"sp_rename. See the MOREINFO="NONE"sp_rename examples immediately after the table. The table lists other changes that may have to be made on the server and in your application programs. TOCENTRY="1"LBL="Table 4-6:" ID="X26305"sp_rename and Changing IdentifiersCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="16*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"IdentifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ConsiderationsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drop all procedures, triggers and views that reference the 
table, and re-create them with the new name. Use MOREINFO="NONE"sp_depends 
to find the objects that depend on the table. Change all applications or SQL source scripts that reference 
the table to use the new table name.Change MOREINFO="NONE"dbcc scripts that perform table-level checks using 
table names.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"index nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drop any stored procedures that create or drop the index, and 
re-create them with the new name. Change all applications or SQL source scripts that create or 
drop the index.Change MOREINFO="NONE"dbcc scripts that perform index-level checks using 
index names.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"view nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drop all procedures, triggers, and views that reference the 
view, and re-create them with the new name. Use MOREINFO="NONE"sp_depends 
to find the objects that depend on the view.Change all applications or SQL source scripts that reference 
the view to use the new view name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"procedure nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drop and re-create with the new procedure name all 
procedures and triggers that reference the procedure. Change all applications or SQL source scripts that execute the 
procedure to use the new name. If another server remotely calls the procedure, change 
applications on the remote server to use the new procedure 
name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"trigger nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Change any SQL source scripts that create the trigger.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"rule nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Change any SQL source scripts that create the rule.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"default nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Change any SQL source scripts that create the default.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"user-defined 
datatype nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drop all procedures that create tables with user-defined 
datatypes, and re-create them with the new name.
Change any applications that create tables with user-defined 
datatypes.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drop all procedures, triggers and views that reference the 
column, and re-createthem with the new column name. 

MOREINFO="NONE"sp_depends cannot find column name references. The 
following query displays the names of procedures, triggers 
and views that reference a column named "key":
MOREINFO="NONE"select distinct sysobjects.name
MOREINFO="NONE"from sysobjects, syscomments
MOREINFO="NONE"where sysobjects.id = syscomments.id
MOREINFO="NONE"and syscomments.text like "%key%"
Change all applications and SQL source scripts that reference 
the column by name.REMAP="UN--Under"The following command changes the name of the view isolation:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_rename "isolation", isolatedREMAP="UN--Under"The following command changes the name of a column in the just-renamed isolated table:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_rename "isolated.key", keynameUse MOREINFO="NONE"sp_depends to get a list of all of the views, procedures or triggers that reference a view, procedure or table that needs to be renamed. To use MOREINFO="NONE"sp_depends after renaming an object, give the new name. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_depends new_nameRenaming Databases with sp_renamedbID="IN4628-1411997"sp_renamedb system procedureMARK="BULL" REMAP="BU--Bullet"To change the name of a database, use MOREINFO="NONE"sp_renamedb. The database must be in single-user mode. Drop and recreate any procedures, triggers and views that reference the database name explicitly. See LINKEND="X99854"sp_renamedb
 for more information.ID="IN469-1411998"Databaseschanging nameIf you change the database name, drop, change to reflect the new name, and re-create all stored procedures, triggers and views that include the database name to refer to objects in the database (dbname.[owner].object_name). Also change all applications and SQL source scripts that reference the database, either in a MOREINFO="NONE"use command, or as part of a fully qualified identifier (in the form dbname.[owner].objectname).REMAP="UN--Under"If you use scripts to run your MOREINFO="NONE"dbcc commands or MOREINFO="NONE"dump database and MOREINFO="NONE"dump transaction commands on your databases, be sure to update those scripts.REMAP="UN--Under"The following example renames the database work:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_dboption work, single, trueuse workcheckpointsp_renamedb work, workdbuse mastersp_dboption workdb, single, falseuse workdbcheckpointChanging Other IdentifiersMARK="BULL" REMAP="BU--Bullet"To change user names, login names, device names, remote server names, remote server user names, segment names, and character set and language names, first determine if you can drop the object or user and re-add or re-create it. If not, use MOREINFO="NONE"sp_configure "allow updates", 1 and MOREINFO="NONE"reconfigure with override to allow updates to system catalogs. Only a System Administrator can use MOREINFO="NONE"sp_configure and MOREINFO="NONE"reconfigure with override.ID="IN4631-1411999"Direct updates to system tablesREMAP="UN--Under"Since errors during direct updates to system tables can create severe problems in SQL Server, check LINKEND="X41722"Table 4-7: Alternatives to Direct System Tables Updates When Changing Identifiers
 to determine whether you can drop the objects or users, and re-create them. LINKEND="X16345"Table 4-9: Considerations When Changing Identifiers
 shows possible dependencies on this set of identifiers. Check this table for possible dependencies whether you choose to upgrade by dropping and recreating objects, by using delimited identifiers, or by performing direct updates to system tables.TOCENTRY="1"LBL="Table 4-7:" ID="X41722"Alternatives to Direct System Tables Updates When Changing 
IdentifiersCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="13*"COLNAME="C2" COLWIDTH="39*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Identifier TypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Suggested Actions to Avoid Updates to System TablesVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"user names and login 
namesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"To change the name of a user with no objects, first use MOREINFO="NONE"sp_helprotect username 
in each database to record the user's permissions. Then, drop the user from 
all of the databases (MOREINFO="NONE"sp_dropuser), and drop the login (MOREINFO="NONE"sp_droplogin). Then, 
add the new login name (MOREINFO="NONE"sp_addlogin), add the new user name to the 
databases (MOREINFO="NONE"sp_adduser), and restore the user's permissions with MOREINFO="NONE"grant.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"device namesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"If this device is completely allocated, so you will not need to use its name in a 
MOREINFO="NONE"create database command, you can leave the name unchanged.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remote server namesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Unless there are large numbers of remote login names from the remote server, 
drop the remote server (MOREINFO="NONE"sp_dropserver)and add it with a new name 
(MOREINFO="NONE"sp_addserver).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remote server loginsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drop the remote login withMOREINFO="NONE" sp_dropremotelogin, add it with a new name 
using MOREINFO="NONE"sp_addremotelogin, and restore the user's permission to execute 
procedures with MOREINFO="NONE"grant.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"segment namesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"These are rarely used, once objects have been created on the segments.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"character set and 
language namesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Languages and character sets only have reserved words as identifiers if a 
System Administrator has created alternative languages with 
MOREINFO="NONE"sp_addlanguage. Drop the language with MOREINFO="NONE"sp_droplanguage, and add it with a 
new name.ID="IN4613-14119100"System tablesdirect updates dangerous toDirect updates to system tables can be very dangerous. You can make mistakes that make it impossible for SQL Server to run, or make it impossible to access objects in your databases. Undertake this effort when you are calm and collected, and when no production activity (or very little) is taking place on the server. Use the alternative methods described above, if possible. The following example shows a "safe" procedure for updating a user name, with all data modification proceeded by a MOREINFO="NONE"begin transaction command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_configure "allow updates", 1REMAP="UI--UserInput" FORMAT="LINESPECIFIC"reconfigure with overrideREMAP="UI--UserInput" FORMAT="LINESPECIFIC"begin tranupdate sysusersset name = "workerbee"where name = "work"REMAP="UN--Under"At this point, run the query, and check to be sure that the command affected only the row that you intended to change. The only identifier change that affects more than one row is changing the language name in syslogins. MARK="DASH" REMAP="BS--BulletSub"If the query affected only the correct row, use MOREINFO="NONE"commit transaction.If the query affected more than one row, or the incorrect row, use MOREINFO="NONE"rollback transaction, determine the source of the problem, and execute the command correctly.Only update system tables in a single database in each user defined transaction. Do not issue a MOREINFO="NONE"begin transaction command, and then update tables in several databases. Such actions can make recovery extremely difficult.ID="IN4613-14119101"System tableschanging reserved wordsREMAP="UN--Under"The following table shows the system tables and columns to update in order to change reserved words. The tables preceded by "master.dbo." occur only in the master database. All other tables occur in master and in user database. Be certain you are using the correct database before you attempt the update by issuing a MOREINFO="NONE"select db_name() queryTOCENTRY="1"LBL="Table 4-8:"System Tables and Columns to Update When Changing IdentifiersCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="15*"COLNAME="C2" COLWIDTH="15*"COLNAME="C3" COLWIDTH="8*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Type of IdentifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table to UpdateCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column 
NameVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"user nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysusers COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"login namesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"master.dbo.syslogins COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"segment namesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syssegments COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"device nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysdevices COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remote server nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysservers COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"srvname COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remote server network nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysservers COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"srvnetname COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"character set namesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"master.dbo.syscharsets COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"language nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"master.dbo.syslanguages 

master.dbo.syslogins COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name 

language REMAP="UN--Under"The following table lists considerations and other changes that might be needed if you change the identifiers:PGWIDE=1 TOCENTRY="1"LBL="Table 4-9:" ID="X16345"Considerations When Changing IdentifiersCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="19*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Identifier TypeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ConsiderationsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"login nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Also change the user name in each database where this person is a user.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"user nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drop, edit, and recreate all procedures, triggers, and views that use 
qualified (owner_name.object_name) references to objects owned by this user. 
Change all applications and SQL source scripts that use qualified object 
names to use the new user name. Note that you do not have to drop the 
objects themselves; sysusers is linked to sysobjects by the column that stores 
the user's ID, not the user's name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"device nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Change any SQL source scripts or applications that reference the device 
name to use the new name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remote server 
nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Also change the name on the remote server. If the name that 
MOREINFO="NONE"sp_checkreswords reports is the name of the local server, you must reboot 
the server before you can issue or receive remote procedure calls.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remote server 
network nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Change the server's name in the interfaces files.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remote server 
login nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Also change the name on the remote server.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"segment nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Drop and recreate all procedures that create tables or indexes on the 
segment name. Change all applications that create objects on segments to 
use the new segment name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"character set 
nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"None.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"language nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Change both master.dbo.syslanguages and master.dbo.syslogins. The update to 
syslogins may involve many rows. Also change the names of your 
localization files. Using Delimited IdentifiersMARK="BULL" REMAP="BU--Bullet"You can use delimited identifiers for table names, column names, and view names. You cannot use delimited identifiers any other places where identifiers are needed.ID="IN4618-18123102"Quoted identifiersusing;Identifiers:set quoted_identifiers onIf you choose to use delimited identifiers, set the quoted identifier option on and drop and re-create all of the procedures, triggers and views that use the identifier. Edit the text for these objects, enclosing the reserved words in double quotes, and enclosing all character strings in single quotes. The syntax for the MOREINFO="NONE"set command is:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set quoted_identifiers onREMAP="UN--Under"The following example shows the changes to make to queries in order to use delimited identifiers. This example updates a table named work, with columns named key and level. Here is the original query, which enclosed character literals in double quotes, and the edited version of the query for use with delimited identifiers:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"/* pre-release 10.0 version of query */update work set level = "novice"    where key = "19-732"REMAP="UI--UserInput" FORMAT="LINESPECIFIC"/* 10.0 version of query, using ** the quoted identifiers option*/update "work" set "level" = 'novice'     where "key" = '19-732'All applications that use the reserved word as an identifier must be changed as follows:MARK="DASH" REMAP="BS--BulletSub"The application must set the quoted identifier option on.All uses of the reserved word must be enclosed in double quotes.ID="IN4621-20125103"" " (quotation marks)single, and quoted_identifier
ID="IN4621-22127104"Quotation marks (" ")single, and quoted_identifierAll character literals that the application uses while the quoted identifier option is turned on must be enclosed in single quotes. Otherwise, SQL Server attempts to interpret them as object names. REMAP="UN--Under"For example, the following query results in an error message:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set quoted_identifier onREMAP="UI--UserInput" FORMAT="LINESPECIFIC"select * from titles where title_id like "BU%"REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Msg 207, Level 16, State 2:Server 'beta10', Line 1:Invalid column name 'BU%'.REMAP="UN--Under"Here is the correct query:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select * from titles where title_id like 'BU%'Stored procedures that you create while the delimited identifiers are in effect can be run without turning on the option. (The MOREINFO="NONE"allow updates option works this way, also.) This means that you can turn on quoted identifier mode, drop a stored procedure, edit it to insert quotation marks around reserved words used as identifiers, and re-create the procedure. All users can execute the procedure without using MOREINFO="NONE"set quoted_identifierID="IN4618-26131105"Quoted identifiersusing;Identifiers:set quoted_identifiers on
 themselves.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Found no reserved words used as database object names.REMAP="UN--Under"No tables, views, procedures, triggers, rules or defaults in the current database use reserved words as names.MOREINFO="NONE"Found no reserved words used as names for database-wide objects.REMAP="UN--Under"No items such as segments or user names use reserved words as names. MOREINFO="NONE"No user with the specified name exists in the current database.REMAP="UN--Under"The user name you specified is not a user in the current database. Be sure you spelled the name correctly, and be sure you are using the correct database.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_checkreswords.Tables UsedREMAP="BO--Body"#uids, master.dbo.spt_values, master.dbo.syscharsets, master.dbo.sysdatabases, master.dbo.sysdevices, master.dbo.syslanguages, master.dbo.syslogins, master.dbo.sysremotelogins, master.dbo.sysservers, master.dbo.sysmessages, syscolumns, sysindexes, sysobjects, syssegments, systypes, sysusers See AlsoCommands     LINKEND="X18140"reconfigure
MOREINFO="NONE", LINKEND="X64136"setSystem procedures     LINKEND="X60334"sp_configure
MOREINFO="NONE", LINKEND="X55445"sp_depends
MOREINFO="NONE", LINKEND="X37949"sp_rename
MOREINFO="NONE", LINKEND="X99854"sp_renamedb
ID="IN4633-30135110"sp_checkreswords system procedure
ID="IN4611-32137111"IdentifiersReserved wordsreserved words and;Reserved words:as identifiersidentifiers
 ID="IN4630-36141112"sp_clearstats system procedureID="X43748"sp_clearstatsID="IN4721-39145114"Chargeback accountingsp_clearstats procedure
ID="IN4710-41147115"Statisticssp_clearstats procedure
ID="IN478-42148116"Clearingaccounting statistics
ID="IN4710-44150117"Accountingsp_clearstats procedure
Initiates a new accounting period for all server users or for a specified user. Prints statistics for the previous period by executing
MOREINFO="NONE"sp_reportstatsID="IN476-44150118"Loginsaccounting statistics;Users:accounting statistics
. FORMAT="LINESPECIFIC"sp_clearstats [MOREINFO="NONE"user_name]ParametersREMAP="BO--Body"user_name - is the user's login name.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_clearstatsREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Name    Since           CPU  Percent CPU     I/O    Percent I/O ------  --------     ------  ----------- -------    ------------- probe   Jun 19 1990       0           0%       0         0% julie   Jun 19 1990   10000     24.9962%    5000         24.325% jason   Jun 19 1990   10002     25.0013%    5321         25.8866% ken     Jun 19 1990   10001     24.9987%    5123         24.9234%kathy   Jun 19 1990   10003     25.0038%    5111         24.865% (5 rows affected)                  Total CPU   Total I/O                  ---------      ---------                 40006       20555                  5 login accounts cleared.                  Initiates a new accounting period for all users. sp_clearstats kathyREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Name  Since         CPU     Percent CPU     I/O     Percent I/O ----- -----------   -----   ------------    -----   ----------- KATHY Jul 24 1990   498     49.8998%        483924  9.1829% (1 row affected)               Total CPU   Total I/O              ---------   ----------              998         98392              1 login account cleared.             (1 row affected, return status = 0) REMAP="UN--Under"Initiates a new accounting period for the user "kathy." CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_clearstats creates an accounting period, and should be run only at the end of a period. MOREINFO="NONE"sp_clearstats clears out the accounting statistics; the statistics should be recorded before running the procedure.  MOREINFO="NONE"sp_clearstats updates the syslogins field accdate and clears the syslogins fields totcpu and totio. MessagesMARK="BULL" REMAP="BU--Bullet"number MOREINFO="NONE"login account(s) cleared.REMAP="UN--Under"The MOREINFO="NONE"sp_clearstats command initiated a new accounting period for number users. PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_clearstats. Sensitivity Label RequirementsREMAP="BO--Body"MOREINFO="NONE"sp_clearstats is a trusted stored procedure. It is configured with the following session sensitivity labels:REMAP="BO--Body"There are no special requirements for your curread and curwrite. MOREINFO="NONE"sp_clearstats writes data to the syslogins system table at Data High.Tables UsedREMAP="BO--Body"master.dbo.syslogins, sysobjectsSee AlsoSystem procedures     LINKEND="X30761"sp_reportstats
ID="IN4730-48154128"sp_clearstats system procedure
ID="IN478-49155129"Clearingaccounting statistics
ID="IN4721-52158130"Chargeback accountingsp_clearstats procedure
 ID="IN4729-56162131"sp_commonkey system procedureID="X22659"sp_commonkeyID="IN487-60167133"Columnscommon key;Common keys:sp_commonkey
ID="IN486-62169134"Tablescommon key between;Tables:joined common key
ID="IN485-64171135"Joinssp_commonkey
ID="IN485-65172136"Viewscommon key between
ID="IN4811-68175137"Common keysCommon keysSee also Foreign keys; Joins; Primary keys!see also Foreign keys; Joins; Primary keys
Defines a common key-columns that are frequently joined-between two tables or views. FORMAT="LINESPECIFIC"sp_commonkey MOREINFO="NONE"tabaname, MOREINFO="NONE"tabbname, MOREINFO="NONE"col1a, MOREINFO="NONE"col1b   [, MOREINFO="NONE"col2a, MOREINFO="NONE"col2b, ..., MOREINFO="NONE"col8a, MOREINFO="NONE"col8b]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"tabaname - is the name of the first table or view to be joined. MOREINFO="NONE"tabbname - is the name of the second table or view to be joined. MOREINFO="NONE"col1a - is the name of the first column in table or view tabanameID="IN4843-71178140"Pair of columns. See Common keys; Joins
 that makes up the common key. Specify at least one pair of columns (one column from the first table or view, and one from the second table or view). REMAP="UN--Under"The number of columns in each table or view must be the same, and their datatypes must be the same. Their lengths and nulltypes need not be the same. Up to eight columns from each table or view can participate in the common key. MOREINFO="NONE"col1b - is the name of the partner column in table or view tabbname that is joined with col1a in table or view tabaname.   ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_commonkey projects, departments, empid, empidREMAP="UN--Under"Assume two tables, projects and departments, each with a column named empid. This statement defines a frequently used join on the two columns. CommentsID="IN4841-71178143"Database design, logical relationships inMARK="BULL" REMAP="BU--Bullet"Common keys are created in order to make explicit a logical relationship that is implicit in your database design. The information can be used by an application. Executing MOREINFO="NONE"sp_commonkeyID="IN4811-73180144"Keys, tablesyskeys table
 adds the key to the syskeys system table. To display a report on the common keys that have been defined, execute MOREINFO="NONE"sp_helpkey. You must be the owner of at least one of the two tables or views in order to define a common key between them. The number of columns from the first table or view must be the same as the number of columns from the second table or view. Up to eight columns from each table or view can participate in the common key. The datatypes of the common columns must also agree. For columns that take a length specification, the lengths can differ. The nulltypes of the common columns need not agree. The installation process runs MOREINFO="NONE"sp_commonkey on appropriate columns of the system tables. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"First table in the common key doesn't exist.REMAP="UN--Under"The table or view you gave as tabaname doesn't exist in the current database. MOREINFO="NONE"New common key added.REMAP="UN--Under"The common key between the specified tables or views has been added to syskeys. MOREINFO="NONE"Only the table owner may define its common keys.REMAP="UN--Under"You aren't the owner of either tabaname or tabbname. MOREINFO="NONE"Second table in the common key doesn't exist.REMAP="UN--Under"The table or view you gave as tabbname doesn't exist in the current database. MOREINFO="NONE"Table or view name must be in current database.REMAP="UN--Under"Either the column pair that you specified doesn't exist, or the columns in the pair are different types. MOREINFO="NONE"The tables have no such nth
MOREINFO="NONE" column or the columns are of different types. REMAP="UN--Under"Either the column pair that you specified doesn't exist, or the columns in the pair are different types.PermissionsREMAP="BO--Body"Only the owner of tabaname or tabbname can issue MOREINFO="NONE"sp_commonkey.Tables UsedREMAP="BO--Body"syscolumns, syskeys, sysobjects See AlsoCommands     LINKEND="X19955"create triggerSystem procedures     LINKEND="X18196"sp_dropkey
MOREINFO="NONE", LINKEND="X50021"sp_foreignkey
MOREINFO="NONE", LINKEND="X90336"sp_helpjoins
MOREINFO="NONE", LINKEND="X44026"sp_helpkey
MOREINFO="NONE", LINKEND="X43109"sp_primarykey
ID="IN4829-77184149"sp_commonkey system procedure
ID="IN487-81188150"Columnscommon key;Common keys:sp_commonkey
ID="IN486-83190151"Tablescommon key between;Tables:joined common key
ID="IN485-84191152"Viewscommon key between
 Topics     LINKEND="X70715"Joins
ID="IN4829-88195153"sp_configure system procedureID="X60334"sp_configureID="IN4923-91199155"Configuration variablessp_configure procedure
Displays or changes configuration variables. FORMAT="LINESPECIFIC"sp_configure [MOREINFO="NONE"config_name [, MOREINFO="NONE"config_value]] ParametersREMAP="RI--RefIndent"MOREINFO="NONE"config_name - is the name of the configuration variable. SQL Server understands any unique string that is part of the configuration name. MOREINFO="NONE"config_value - is the value for the configuration option. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"MOREINFO="NONE"sp_configure REMAP="UN--Under"Displays a list of all the configuration parameters with their current and permissible range of values.REMAP="UN--Under"The report contains four columns:MARK="DASH" REMAP="BS--BulletSub"The minimum column contains the minimum possible value for the variable.The maximum column contains the maximum possible value.The config_value column of the report contains the value to which the configuration variable has been set with MOREINFO="NONE"sp_configure. It changes after you execute MOREINFO="NONE"sp_configure. (This is the value in sysconfigs.value.) The run_value column contains the value SQL Server is using. It changes after you run the MOREINFO="NONE"reconfigure command, or, in some cases, after SQL Server is rebooted. (This is the value in syscurconfigs.value.) sp_configure "recovery interval", 3 REMAP="UN--Under"Sets the system MOREINFO="NONE"recovery interval to 3 minutes. ID="X18281"CommentsMARK="BULL" REMAP="BU--Bullet"With no parameters, MOREINFO="NONE"sp_configure displays all of the possible options with their current settings and range of permitted values. If you specify MOREINFO="NONE"sp_configure config_name, the value of config_name appears. Any user can execute MOREINFO="NONE"sp_configure with no parameters or with one parameter.A System Administrator can execute MOREINFO="NONE"sp_configure with two parameters to change the value of a specific configuration variable to a new MOREINFO="NONE"config_value specified in the second parameter, except that only a System Security Officer can execute MOREINFO="NONE"sp_configure with theID="IN4939-95203160"audit queue size configuration variablesetting with sp_configure
ID="IN4936-99207161"allow updates configuration variablesetting with sp_configure
MOREINFO="NONE" password expiration interval, audit queue size, allow updates, and MOREINFO="NONE"remote access options. Once MOREINFO="NONE"sp_configure completes successfully, the System Administrator installs the changed config_value by:ID="IN4919-103211162"reconfigure commandsp_configure andMARK="DASH" REMAP="BS--BulletSub"Issuing the MOREINFO="NONE"reconfigure command, thenRestarting SQL Server (for all non-dynamic variables).REMAP="UN--Under" See the System Administration Guide for details. ID="IN4932-107215163"reconfigure with override optionsp_configureUse MOREINFO="NONE"reconfigure MOREINFO="NONE"with MOREINFO="NONE"override when you set MOREINFO="NONE"allow updates on, or when you set a configuration variable to a value that SQL Server considers less than optimal. To instruct SQL Server to supply a default configuration variable, give the value 0 as the config_value. ID="IN494-110218164"Listconfiguration variables;Names:configuration variables;Values:configuration variableList of Configuration VariablesMARK="BULL" REMAP="BU--Bullet"The following briefly describes the configuration variables. For more information, see "Fine Tuning Performance and Operations" in the System Administration Guide.MARK="DASH" REMAP="BS--BulletSub"MOREINFO="NONE"additional network memory allocates additional memory for clients which request packet sizes that are larger than the default packet size for the server.MOREINFO="NONE"allow updatesID="IN4931-110218165"Direct updates to system tables
 allows system tables to be updated directly. The default is 0 (off). MOREINFO="NONE"audit queue size determines the number of audit records that the audit queue can hold. The default is 100.MOREINFO="NONE"cpu flush specifies how many machine clock ticks to accumulate before adding cpu usage data to syslogins for use in chargeback accounting statistics.MOREINFO="NONE"database size sets the default number of megabytes allocated to each new user database. The default run value is 2 (megabytes).MOREINFO="NONE"default character set id is the number of the default character set used by the server.MOREINFO="NONE"default language is the number of the language that is used to display system messages unless a user has chosen another language from those available on the server.MOREINFO="NONE"default network packet size sets the default size of network packets for all users on SQL Server.MOREINFO="NONE"default sortorder id is the number of the sort order that is the current default on this SQL Server. Do not change this variable. See the System Administration Guide for more information about changing the sort order. MOREINFO="NONE"devices controls the number of database devices that SQL Server can use. MOREINFO="NONE"engine adjust interval is not currently used.MOREINFO="NONE"extent i/o buffers allocates the specified number of extents (8 data pages) for use by MOREINFO="NONE"create index. MOREINFO="NONE"fillfactor determines how full SQL Server makes each page when it is creating a new index on existing data (unless the user specifies some other value in the MOREINFO="NONE"create index statement). The default run value is 0.MOREINFO="NONE"i/o flush specifies how many disk I/Os to accumulate before flushing the data to syslogins for use in chargeback accounting.MOREINFO="NONE"identity burning set factor determines the percentage of potential IDENTITY column values that is made available in each block. The default value, 5000, releases .05% of the potential IDENTITY column values for use at a time. MOREINFO="NONE"language in cache is the maximum number of languages that can simultaneously be held in the language cache. The default is 3.MOREINFO="NONE"locks sets the number of available locks. The default run value is 5000.MOREINFO="NONE"max online engines controls the number of engines in a symmetric multiprocessor environment.MOREINFO="NONE"maximum network packet size sets the maximum network packet size that a client program can request.MOREINFO="NONE"memory sets the size of memory, in 2K units, that SQL Server allocates from the operating system. The default varies according to platform.MOREINFO="NONE"min online engines is not currently used.MOREINFO="NONE"nested trigger determines whether triggers can call other triggers (that is, be "nested") or not. The default is 1 (nested triggers enabled).MOREINFO="NONE"open databases sets the maximum number of databases that can be open at one time on SQL Server. The default run value is 12.MOREINFO="NONE"open objects sets the maximum number of database objects that can be open at one time on SQL Server. The default run value is 500.MOREINFO="NONE"password expiration interval is the number of days that passwords remain in effect after they are changed. The default is 0 (passwords do not expire).MOREINFO="NONE"pre-read packets controls the number of packets that a site handler will pre-read in connections with remote servers. The default is 3.MOREINFO="NONE"procedure cache gives the percentage of memory allocated to the procedure cache after SQL Server's memory needs are met. The default run value is 20.MOREINFO="NONE"recovery flags sets a toggle that determines what information SQL Server displays on the console during recovery. The default run value is 0, which means that SQL Server displays only the database name and a message saying that recovery is in progress.MOREINFO="NONE"recovery interval sets the maximum number of minutes per database that SQL Server should use to complete its recovery procedures in case of a system failure. The default is 5 (minutes per database).MOREINFO="NONE"remote access determines whether users from remote servers can access this SQL Server. The default is 1, to allow SQL Server to communicate with Backup Server.MOREINFO="NONE"remote connections controls the limit on active connections initiated to and from this SQL Server. The default is 20.MOREINFO="NONE"remote logins controls the number of active user connections from this SQL Server to remote servers. The default is 20.MOREINFO="NONE"remote sites controls the number of simultaneous remote sites that can access this SQL Server. The default is 10.MOREINFO="NONE"stack size sets the size of SQL Server's stack. MOREINFO="NONE"tape retention sets the number of days that you expect to retain each tape after it has been used for a database or transaction log dump. The default run value is 0.MOREINFO="NONE"time slice sets the number of milliseconds that SQL Server's scheduler allows a user process to run. The default run value is 100 milliseconds.MOREINFO="NONE"upgrade version is changed by the upgrade program provided with new releases.ID="IN4939-112220166"user connections configuration variable
MOREINFO="NONE"user connections sets the maximum number of user connections that can be connected to SQL Server at the same time. The maximum value for your system is stored in the global variable @@max_connectionsID="IN494-115223167"Listconfiguration variables;Names:configuration variables;Values:configuration variable
ID="IN4965-120228168"Reserved connections. See user connections configuration variable
, and varies according to platform and operating system.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Configuration option changed. Run the RECONFIGURE command to install.REMAP="UN--Under"After changing a configuration variable with MOREINFO="NONE"sp_configure, the change does not take effect until the MOREINFO="NONE"reconfigure command is issued and (for all but MOREINFO="NONE"allow updates and MOREINFO="NONE"recovery interval) SQL Server is restarted. MOREINFO="NONE"Configuration option doesn't exist.REMAP="UN--Under"The name supplied as the config_name parameter is unknown. MOREINFO="NONE"Configuration option is not unique.REMAP="UN--Under"The name supplied as the config_name parameter is not unique. No configuration variable was changed. For example, two of the configuration variables are MOREINFO="NONE"recovery interval and MOREINFO="NONE"recovery flags. Using recovery for the config_name parameter generates this message because it matches both names. The complete names that match the string supplied are printed out so you can see how to make the config_name more specific. MOREINFO="NONE"Configuration option value is not legal.REMAP="UN--Under"The config_value supplied is not in the range of permissible values for the specified configuration variable. For a display of the range of permissible values, re-run MOREINFO="NONE"sp_configure with the name of the configuration variable as the only parameter. REMAP="UN--Under"A config_value of 0 is always legal. It instructs SQL Server to set the configuration value to its default. MOREINFO="NONE"You can't set the number of devices to be less than the number of devices already defined in sysdevices.REMAP="UN--Under"Use MOREINFO="NONE"sp_helpdevice to see a list of the devices defined for this server.MOREINFO="NONE"Can't run sp_configure from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_configure modifies system tables, so it cannot not be run within a transaction.MOREINFO="NONE"You can't set the default language to a language ID that is not defined in syslanguages.REMAP="UN--Under"Use MOREINFO="NONE"sp_helplanguage to see the list of official language names available on this SQL Server.MOREINFO="NONE"Maximum file descriptors or FILLM process quota too low to support requested number of user connections. Configuration variable 'user connections' will not be modified.REMAP="UN--Under"Use this command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"    select @@max_connections REMAP="UN--Under"to find the maximum value to which MOREINFO="NONE"user connections can be configured.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_configure with no parameters or only the first parameter (optname). A System Administrator can execute MOREINFO="NONE"sp_configure with both parameters, except for the MOREINFO="NONE"password expiration interval, audit queue size, MOREINFO="NONE"allow updates, and MOREINFO="NONE"remote access variables. Only a System Security Officer can set these variables. Tables UsedREMAP="BO--Body"master.dbo.spt_values, master.dbo.sysdevices, master.dbo.sysservers, master.dbo.sysconfigures, master.dbo.syscurconfigs, master.dbo.sysdevices, master.dbo.syslanguages, master.dbo.sysmessages, master.dbo.sysservers, sysobjectsSee AlsoCommands     LINKEND="X18140"reconfigure
MOREINFO="NONE", LINKEND="X64136"setSystem procedures     LINKEND="X44244"sp_addlanguage
MOREINFO="NONE",LINKEND="X42468"sp_auditoption
MOREINFO="NONE", LINKEND="X29657"sp_dboption
MOREINFO="NONE", LINKEND="X82772"sp_droplanguage
MOREINFO="NONE", 
LINKEND="X24535"sp_modifylogin
ID="IN4930-124232173"sp_cursorinfo system procedureID="X95439"sp_cursorinfoID="IN507-124233175"Cursorsinformation about
Reports information about a specific cursor or all cursors that are active.FORMAT="LINESPECIFIC"sp_cursorinfo [{cursor_level | null}] [, cursor_name]ParametersREMAP="RI--RefIndent"ID="IN507-124233178"Nestingcursors
MOREINFO="NONE"cursor_level | MOREINFO="NONE"null - is the level about which SQL Server returns information for the cursors. You can specify the following for cursor_level:TOCENTRY="1"LBL="Table 4-10:"Cursor Information LevelsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="4*"COLNAME="C2" COLWIDTH="31*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"LevelCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Types of CursorsVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any cursors declared inside stored procedures at a specific 
procedure nesting level. You can specify any positive 
number for its level.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any cursors declared outside stored procedures.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any cursors from either of the above. You can substitute any 
negative number for this level.REMAP="UN--Under"If you want information about cursors with a specific cursor_name, regardless of cursor level, specify MOREINFO="NONE"null for this parameter.MOREINFO="NONE"cursor_name - is the specific name for the cursor. SQL Server reports information about all active cursors which use this name at the cursor_level you specify. If you omit this parameter, SQL Server reports information about all the cursors at that level.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_cursorinfo 0, authors_crsrREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Cursor name 'authors_crsr' is declared at nesting level '0'.The cursor has been successfully opened 1 times.The cursor is not open.The cursor will remain open when a transaction is commited or rolled back.The number of rows returned for each FETCH is 1.The cursor is updatable.There are 3 columns returned by this cursor.The result columns are:Name = 'au_id', Table = 'authors', Type = ID,      Length = 11 (updatable)Name = 'au_lname', Table = 'authors', Type = VARCHAR, Length = 40 (updatable)Name = 'au_fname', Table = 'authors', Type = VARCHAR, Length = 20 (updatable)REMAP="UN--Under"Displays the information about the cursor named authors_crsr at level 0.sp_cursorinfo null, author_salesREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Cursor name 'author_sales' is declared on procedure 'au_sales'.Cursor name 'author_sales' is declared at nesting level '1'.The cursor has been successfully opened 1 times.The cursor is positioned after the last row.The cursor will be closed when a transaction is commited or rolled back.The number of rows returned for each FETCH is 1.The cursor is updatable.There are 3 columns returned by this cursor.The result columns are:Name = 'title_id', Table = 'titleauthor', Type = ID,       Length = 11 (updatable)Name = 'title', Table = 'titles', Type = VARCHAR,       Length = 80 (updatable)Name = 'total_sales', Table = 'titles', Type = INT (updatable)REMAP="UN--Under"Displays the information about any cursors named author_sales declared by a user across all levels.CommentsMARK="BULL" REMAP="BU--Bullet"If you do not specify either cursor_level or cursor_name, SQL Server displays information about all active cursors. Active cursors are those declared by a user and allocated by SQL Server.SQL Server reports the following information about each cursor:MARK="DASH" REMAP="BS--BulletSub"The cursor name, its nesting level, and the procedure name if it is declared in a stored procedure.The number of times the cursor has been opened.Whether the cursor is open or closed. If the cursor is open, it indicates the current cursor position and the number of rows fetched.Whether the open cursor will be closed if the cursor's current position is deleted.Whether the cursor will remain open or be closed if the cursor's current transaction is committed or rolled back.The number of rows returned for each fetch of that cursor.Whether the cursor is updatable or read-only.The number of columns returned by the cursor. For each column it displays the column name, the table name or expression result, and if it is updatable.REMAP="UN--Under"In addition to the above, MOREINFO="NONE"sp_cursorinfo displays the MOREINFO="NONE"showplan output for the cursor. See the MOREINFO="NONE"set command in Volume 1 of the Commands Reference Manual for more information about MOREINFO="NONE"showplan. The output from MOREINFO="NONE"sp_cursorinfo varies depending on the status of the cursor.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"There are no active cursors.REMAP="UN--Under"SQL Server could not find any declared cursors.MOREINFO="NONE"There are no active cursors that match the search criteria.REMAP="UN--Under"SQL Server could not find any declared cursors that match the values you specified for cursor_level and cursor_name.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_cursorinfo.Tables UsedREMAP="BO--Body"sysobjectsID="IN5030-128237184"sp_cursorinfo system procedureSee AlsoCommands     LINKEND="X11816"declare cursor
MOREINFO="NONE", LINKEND="X64136"setTopics     LINKEND="X80039"CursorsREMAP="BO--Body"ID="X29657"sp_dboptionID="IN43792104"Displaydatabase options
ID="IN43891115"Changingdatabase options
ID="IN43990126"Databasesoptions
ID="INA43789137"Optionsdisplaying/changing
ID="IN431686168"Database optionsDatabase optionsSee also Individual option names!see also
ID="IN433883199"Settable options. See Database options
Displays or changes database options. FORMAT="LINESPECIFIC"sp_dboption [MOREINFO="NONE"dbname, MOREINFO="NONE"optname, {true | false}] ParametersREMAP="RI--RefIndent"dbname - is the name of the database in which to set the option. You must be using master to execute MOREINFO="NONE"sp_dboption with parameters (that is, in order to change a database option). You cannot, however, change master's database option settings. optname - is the name of the option to set or unset. SQL Server understands any unique string that is part of the option name. Use quotes around the option name if it is a keyword or includes embedded blanks or punctuation. ID="IN4320802212"true | false clausessp_dboption{MOREINFO="NONE"true | MOREINFO="NONE"false} - MOREINFO="NONE"true  to set the option, MOREINFO="NONE"false to unset the option. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dboptionREMAP="UN--Under"Displays a list of the database options: REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Settable database options  database_options ------------------------ ALL SETTABLE OPTIONS abort tran on log full  allow nulls by default  auto identity dbo use only  ddl in tran  no chkpt on recovery  no free space acctg  read only  select into/bulkcopy  single user  trunc log on chkpt trunc. log on chkpt. use master go sp_dboption pubs2, "read", true use pubs2 go checkpointgoREMAP="UN--Under"Makes the database puMOREINFO="NONE"bs2 read only. The MOREINFO="NONE"read string uniquely identifies the MOREINFO="NONE"read only option from among all available database options. Note the use of quotes around the keyword MOREINFO="NONE"read.use master go sp_dboption pubs2, "read", false use pubs2 go checkpoint goREMAP="UN--Under"Makes the database pMOREINFO="NONE"ubs2 writable again. use mastergosp_dboption pubs2, "select into", truegocheckpointgoREMAP="UN--Under"Allows MOREINFO="NONE"select into and MOREINFO="NONE"bcp operations on tables in the pubs2 database. The MOREINFO="NONE"select into string uniquely identifies the MOREINFO="NONE"select into/ bulkcopy option from among all available database options. Note that quotes are required around the option because of the embedded space.use mastergosp_dboption mydb, "auto identity", truegocheckpointgoREMAP="UN--Under"Automatically defines 10-digit IDENTITY columns in new tables created in mydb. The IDENTITY column, MOREINFO="NONE"SYB_IDENTITY_COL, is defined in each new table that is created without specifying either a MOREINFO="NONE"primary key, a MOREINFO="NONE"unique constraint, or an IDENTITY column. The column is not visible when you select all columns with the MOREINFO="NONE"select * statement. To retrieve it, you must explicitly include the column name in the select list.CommentsID="IN4315762615"master databasesp_dboption andMARK="BULL" REMAP="BU--Bullet"The MOREINFO="NONE"master database option settings cannot be changed. To display a list of the user-settable database options, execute MOREINFO="NONE"sp_dboption with no parameters from inside the MOREINFO="NONE"master database. ID="IN4316742816"Database optionsdisplaying with sp_helpdbFor a report on which database options are set in a particular database, execute MOREINFO="NONE"sp_helpdb. ID="IN4314703217"model databasesp_dboption andThe Database Owner or System Administrator can set or unset particular database options for all new databases by executing MOREINFO="NONE"sp_dboption on model. ID="IN4318663618"checkpoint commandsp_dboption andAfter MOREINFO="NONE"sp_dboption has been executed, the change does not take effect until the MOREINFO="NONE"checkpoint command is issued in the database for which the option was changed. ID="IN4316653719"Database optionsDatabase OptionsMARK="BULL" REMAP="BU--Bullet"ID="IN4338614120"abort tran on log full database optionsetting with sp_dboption
The MOREINFO="NONE"abort tran on log full option determines the fate of a transaction that is running when the last-chance threshold is crossed in the log segment of the specified database. The default value is MOREINFO="NONE"false, meaning that the transaction is suspended and is awakened only when space has been freed. If you change the setting to MOREINFO="NONE"true, all user queries that need to write to the transaction log are killed until space in the log has been freed.ID="IN4338574521"allow nulls by default database optionsetting with sp_dboptionSetting the MOREINFO="NONE"allow nulls by default option to MOREINFO="NONE"true changes the default value of a column from MOREINFO="NONE"not null to MOREINFO="NONE"null, in compliance with the ANSI standard. The Transact-SQL default value for a column is MOREINFO="NONE"not null, meaning that null values are not allowed in a column unless MOREINFO="NONE"null is specified in the column definition. MOREINFO="NONE"allow nulls by default true reverses this.ID="IN4329534922"auto identity database optionsetting with sp_dboptionWhile the MOREINFO="NONE"auto identity option is MOREINFO="NONE"true, a 10-digit IDENTITY column is defined in each new table that is created without specifying either a MOREINFO="NONE"primary key, a MOREINFO="NONE"unique constraint, or an IDENTITY column. The column is not visible when you select all column with theMOREINFO="NONE" select * statement. To retrieve it, you must explicitly mention the column name, SYB_IDENTITY_COL, in the select list.ID="IN4328495323"dbo use only database optionsetting with sp_dboptionWhile the MOREINFO="NONE"dbo use only option is set on (MOREINFO="NONE"trueID="IN4315475524"Database Ownersdbo use only database option
), only the database's owner can use the database. When theMOREINFO="NONE" ddl in tran option is set on (MOREINFO="NONE"true), you can use certain data definition language commands in transactions. If MOREINFO="NONE"ddl in tran is MOREINFO="NONE"true in a particular database, commands such as MOREINFO="NONE"create table, MOREINFO="NONE"grant, and MOREINFO="NONE"alter table are allowed inside transactions in that database. If MOREINFO="NONE"ddl in tran is true in the model database, the commands are allowed inside transactions in all databases created after MOREINFO="NONE"ddl in tran was set in modelID="IN4354445825"User permissions. See Database Owners; Permissions
.Data definition language commands hold locks on system tables such as sysobjects. Avoid using them inside transactions; if you must use them, keep the transactions short.  Using any data definition language commands on tempdb within transactions may cause your system to grind to a halt. Always leave MOREINFO="NONE"ddl in tran set to MOREINFO="NONE"false in tempdb.The following commands can be used inside a user-defined transaction only if theID="IN4327406226"ddl in tran database optionsetting with sp_dboption
 MOREINFO="NONE"ddl in tran option is set to MOREINFO="NONE"true:TOCENTRY="1"LBL="Table 4-11:"DDL Commands Allowed in TransactionsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"alter table COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create table COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop rule COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create default COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create trigger COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop table COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create index COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create view COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop trigger COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create procedure COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop default COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop view COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create rule COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop index COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"grant  COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create schema COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop procedure COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"revoke The following commands cannot be used inside a user-defined transaction under any circumstances:TOCENTRY="1"LBL="Table 4-12:"DDL Commands Not Allowed in TransactionsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"alter database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load database COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"truncate table COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"create database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"load transaction COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"update statistics COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"disk init COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"reconfigure COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"drop database COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select into COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"REMAP="UN--Under"In addition, the following system procedures cannot be used inside user-defined transactions because they create temporary tables: MOREINFO="NONE"sp_helpdb, MOREINFO="NONE"sp_helpdevice, MOREINFO="NONE"sp_helpindex, MOREINFO="NONE"sp_helpjoins, MOREINFO="NONE"sp_helpserver, and MOREINFO="NONE"sp_spaceused. REMAP="UN--Under"System procedures that change the master database cannot be used inside user-defined transactions. ID="IN4335366627"no free space acctg database optionsetting with sp_dboptionMARK="DASH" REMAP="BS--BulletSub"The MOREINFO="NONE"no free space acctg option suppresses free space accounting and execution of threshold actions for the non-log segments. This speeds recovery time because the free-space counts will not be recomputed for those segments.ID="IN4336327028"no chkpt on recovery database optionsetting with sp_dboptionThe MOREINFO="NONE"no chkpt on recovery option is set on (MOREINFO="NONE"true) when an up-to-date copy of a database is kept. In these situations, there is a "primary" and a "secondary" database. Initially, the primary database is dumped and loaded into the secondary database. Then, at intervals, the transaction log of the primary database is dumped and loaded into the secondary database. If this option is set off (MOREINFO="NONE"false), the default condition, a checkpoint record is added to a database after it is recovered when you restart SQL Server. This checkpoint, which insures that the recovery mechanism won't be unnecessarily re-run, changes the sequence number and causes a subsequent load of the transaction log from the primary database to fail. Turning on this option for the secondary database causes it not to get a checkpoint from the recovery process, so that subsequent transaction log dumps from the primary database can be loaded into it. ID="IN4325287429"read only database optionsetting with sp_dboptionThe MOREINFO="NONE"read only option means that users can retrieve data from the database, but can't modify any data. Setting the MOREINFO="NONE"select into/bulkcopy option on enables the use of MOREINFO="NONE"writetext, MOREINFO="NONE"select MOREINFO="NONE"intoID="IN4341247830"Bulk copying. See bcp (bulk copy utility)
ID="IN4323228031"bcp (bulk copy utility)fast version
 a permanent table, or "fast" bulk copy into a table that has no indexes or triggers, using MOREINFO="NONE"bcp or the bulk copy library routines. Because a transaction log dump cannot recover these unlogged operations, MOREINFO="NONE"dump transaction to a dump device is prohibited. After non-logged operations are completed, turn MOREINFO="NONE"select into/bulk copy off and issue MOREINFO="NONE"dump database. Issuing the MOREINFO="NONE"dump transaction statement after unlogged changes have been made to the database with MOREINFO="NONE"select MOREINFO="NONE"into or bulk copy produces an error message instructing you to use MOREINFO="NONE"dump database instead. (The MOREINFO="NONE"writetext command does not have this protection.) You do not have to set the MOREINFO="NONE"select into/bulkcopy option on in order to MOREINFO="NONE"select MOREINFO="NONE"into a temporary table, since MOREINFO="NONE"tempdb is never recovered. The option need not be on in order to run MOREINFO="NONE"bcp on a table that has indexes, because tables with indexes are always copied with the slower version of bulk copy and are logged. ID="IN4327188432"single user database optionsetting with sp_dboptionWhen MOREINFO="NONE"single user is set to MOREINFO="NONE"true, only one user at a time can access the database. ID="IN4325148833"trunc log on chkpt optionsetting with sp_dboptionThe MOREINFO="NONE"trunc log on chkpt option means that the transaction log is truncated (committed transactions are removed) every time the MOREINFO="NONE"checkpoint checking process occurs (usually more than once per minute). When the Database Owner runs MOREINFO="NONE"checkpoint manually, however, the log is not truncated. It may be useful to turn this option on while doing development work, to prevent the log from growing. While the MOREINFO="NONE"trunc log on chkpt option is on, MOREINFO="NONE"dump transactionID="IN4315129034"Failures, mediatrunc log on chkpt database option and
 to a dump device is prohibited, since dumps from the truncated transaction log cannot be used to recover from a media failure. Issuing the MOREINFO="NONE"dump transaction statement produces an error message instructing you to use MOREINFO="NONE"dump database instead. REMAP="BO--Body"See the System Administration GuideID="IN4316119135"Database options
 for additional information on database options. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_dboption from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_dboption modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"Database option `option_name' turned [OFF | ON] for database `database_name'.REMAP="UN--Under"The MOREINFO="NONE"sp_dboption command succeeded. This message reports on the option you have just set.MOREINFO="NONE"Database option doesn't exist or can't be set by user.REMAP="UN--Under"Either the option does not exist or the user does not have permission to set or unset it. Run MOREINFO="NONE"sp_dboption with no parameters to display a list of the user-settable options. MOREINFO="NONE"Database option is not unique.REMAP="UN--Under"The name supplied as the optname parameter is not unique. No database option value was changed. For example, two of the database options are MOREINFO="NONE"dbo use only and MOREINFO="NONE"read only. Using MOREINFO="NONE"only for the optname parameter generates this message because it matches both names. The complete names that match the string supplied are printed out so you can see how to make the optname more specific. MOREINFO="NONE"No such database-run sp_helpdb to list databases.REMAP="UN--Under"No database with the supplied name exists. Run MOREINFO="NONE"sp_helpdb to get a list of databases. MOREINFO="NONE"Run the CHECKPOINT command in the database that was changed.REMAP="UN--Under"The change in the database option takes effect only after the MOREINFO="NONE"checkpoint command is run. MOREINFO="NONE"Settable database options.REMAP="UN--Under"Executing MOREINFO="NONE"sp_dboption with no parameters displays a list of the user-settable options. MOREINFO="NONE"The database is currently in use -- `read only' option disallowed.REMAP="UN--Under"You must wait until no one is using the database before issuing this command. Use sp_who to monitor usage.MOREINFO="NONE"The `master' database's options cannot be changed.REMAP="UN--Under"No one can change any of the master's database option settings. MOREINFO="NONE"Usage: sp_dboption [dbname, optname, {true | false}]REMAP="UN--Under"Either the optname parameter was omitted or the third parameter was something other than TRUE or FALSE. MOREINFO="NONE"You must be in the `master' database in order to change database options.REMAP="UN--Under"In order to change a database option (of any database other than master), execute the MOREINFO="NONE"sp_dboption procedure, with the appropriate parameters, while using master. MOREINFO="NONE"Run sp_dboption with no parameters to see options.REMAP="UN--Under"The command failed. Check the spelling of the options and reissue MOREINFO="NONE"sp_dboption.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_dboption with no parameters (display options only). Only a System Administrator or the Database Owner can execute MOREINFO="NONE"sp_dboption with parameters (change an option). Tables UsedREMAP="BO--Body"master.dbo.spt_values, master.dbo.sysdatabases, master.dbo.sysmessages, master.dbo.sysprocesses, sysobjectsSee Also Commands     LINKEND="X68400"checkpoint
MOREINFO="NONE", LINKEND="X35229"selectSystem procedures     LINKEND="X60334"sp_configure
MOREINFO="NONE", LINKEND="X90458"sp_helpdb
MOREINFO="NONE", LINKEND="X90336"sp_helpjoins
ID="IN432879540"sp_dboption system procedure
ID="IN43769641"Optionsdisplaying/changing
ID="IN431639942"Database optionssp_dboption and
ID="IN438210043"Changingdatabase options
ID="IN437110144"Displaydatabase options
ID="IN439010245"Databasesoptions
ID="IN4327-410646"sp_dbremap system proceduresp_dbremap
Forces SQL Server to recognize changes made by MOREINFO="NONE"alter database. Run this procedure only if instructed to do so by SQL Server messages.FORMAT="LINESPECIFIC"sp_dbremap database_nameParametersREMAP="RI--RefIndent"database_name - is the name of the database in which the MOREINFO="NONE"alter database command was interrupted.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dbremap sample_dbREMAP="UN--Under"An MOREINFO="NONE"alter database command changed the database sample_db. This command makes the changes visible to SQL Server.CommentsID="IN4422-811152"alter database commanddb_remap andMARK="BULL" REMAP="BU--Bullet"If an MOREINFO="NONE"alter databaseID="IN4414-811153"Dump, databaseinterrupted
 statement issued on a database that is in the process of being dumped is interrupted, SQL Server prints a message instructing the user to execute MOREINFO="NONE"sp_dbremap. REMAP="UN--Under"Any changes to sysusagesID="IN447-811154"Mappingdatabases;Memory:mapping
 during a database or transaction dump are not copied into active memory until the dump completes to ensure that database mapping does not change during the dump. Running MOREINFO="NONE"alter database makes changes to system tables on the disk immediately. In-memory allocations cannot be changed until a dump completes. This is why MOREINFO="NONE"alter database pauses.REMAP="UN--Under"When you execute MOREINFO="NONE"sp_dbremap, it must wait until the dump process completes.If you are instructed to run MOREINFO="NONE"sp_dbremap, but do not do it, the space you have allocated with MOREINFO="NONE"alter database does not become available to SQL Server until the next reboot.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_dbremap from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_dbremap modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"'database_name' is not a valid identifier.REMAP="UN--Under"The database name you specified is not a valid identifier.MOREINFO="NONE"The specified database does not existREMAP="UN--Under"The database name you specified is not the name of a database on this server.PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_remap. Tables UsedREMAP="BO--Body"master.dbo.sysdatabases, sysobjectsSee Also Commands     LINKEND="X61977"alter database
, LINKEND="X68345"dump database
, LINKEND="X47924"dump transaction
ID="IN4427-1211559"sp_depends system procedureID="X55445"sp_dependsID="IN4516-1612061"Database objectsdependencies of;Dependencies, database object:sp_depends system procedure
ID="IN458-1712162"Triggersobject dependencies and
ID="IN4517-1812263"Stored proceduresobject dependencies and
ID="IN456-1912364"Tablesobject dependencies and
ID="IN455-2012465"Viewsobject dependencies and
ID="IN4550-2312766"Data dependency. See Dependencies, database object
ID="IN4554-2613067"Referencing, object. See Dependencies, database object
ID="IN4516-2913368"Database objectsDatabase objectsSee also individual object names!see also
Displays information about database object dependencies-the view(s), trigger(s), and procedure(s) that depend on a specified table or view, and the table(s) and view(s) that the specified view, trigger, or procedure depends on. FORMAT="LINESPECIFIC"sp_depends MOREINFO="NONE"objnameParametersREMAP="RI--RefIndent"objname ID="IN4522-3113571"Database object ownerssp_depends system procedure and
ID="IN4541-3413872"Object owners. See Database object owners
- is the name of the table, view, stored procedure, or trigger to examine for dependencies. You cannot specify a database name. Use owner names if the object owner is not the user running the command and not the dbo.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_depends sysobjects REMAP="UN--Under"Lists the database objects that depend on the table sysobjects. sp_depends titleview REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Things that the object references in the current database.REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"object          type        updated selected--------------  ----------- ------- -----dbo.authors     user table  no      nodbo.titleauthor user table  no      nodbo.titles      user table  no      no Things inside the current database that reference the object.  object          type ------------    --------------- dbo.tview2      view sp_depends "mary.titles"REMAP="UN--Under"Lists the database objects that depends on the titles table owned by the user mary. The quotes are needed, since "." is a special character. ID="X47049"CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_depends lists all the objects, if any, that depend on objname, and all the objects, if any, that objname depends on. For example, views depend on one or more tables and can have procedures or other views that depend on them. An object that references another object is considered dependent on that object. References to objects outside the current database are not reported. The MOREINFO="NONE"sp_depends procedure determines the dependencies by looking at the sysdepends table. The updated and selected columns in the report from MOREINFO="NONE"sp_depends are meaningful if the object being reported on is a stored procedure or trigger. The values in these columns indicate whether the stored procedure or trigger updates or selects from that object.ID="IN4516-3413875"Database objectsfinding;Finding database objects:rules for;Rules:for finding objects
MOREINFO="NONE"sp_depends follows SQL Server's rule for finding objects:MARK="DASH" REMAP="BS--BulletSub"If  the user doesn't specify an owner  name, and the user executing the command owns an object with the specified name, that object is used. If  the user doesn't specify an owner  name, and the user does not own an object of that name, but the dbo does, the dbo's object is used. If neither the user nor the dbo owns  an object of that name, the command reports an error condition, even if an object exists in the database with that object name, but different owner.If the  user and the dbo both own objects with the specified  name, and the user wants to access the dbo's object, the name must be specified, as in dbo.objectname.Objects owned by database users other than the user executing a command and the dbo must always  be qualified with the owner's name, as in Example 3.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object does not exist in this database.REMAP="UN--Under"The object name supplied for the objname parameter does not exist in the current database. MOREINFO="NONE"Object doesn't reference any object and no objects reference it.REMAP="UN--Under"Nothing depends upon objname and objname doesn't reference any objects. MOREINFO="NONE"Object must be in the current database.REMAP="UN--Under"You cannot reference an object that is not in your current database. MOREINFO="NONE"Things inside the current database that reference the object.REMAP="UN--Under"These are the objects in the current database that reference objname. (See Example 2.) MOREINFO="NONE"Things the object references in the current database.REMAP="UN--Under"These are the objects in the current database that objname depends on. (See Example 2.) PermissionsREMAP="BO--Body"All users can execute MOREINFO="NONE"sp_depends. Tables UsedREMAP="BO--Body"master.dbo.spt_values, master.dbo.sysmessages, sysdepends, sysobjects, sysusersSee Also Commands     LINKEND="X52197"create procedure
MOREINFO="NONE", LINKEND="X80969"create table
MOREINFO="NONE", LINKEND="X30101"create view
MOREINFO="NONE", LINKEND="X30305"executeSystem procedures     LINKEND="X91431"sp_help
ID="IN4527-3814280"sp_depends system procedure
ID="IN4516-4214681"Database objectsdependencies of;Dependencies, database object:sp_depends system procedure
ID="IN458-4314782"Triggersobject dependencies and
ID="IN4517-4414883"Stored proceduresobject dependencies and
ID="IN456-4514984"Tablesobject dependencies and
ID="IN455-4615085"Viewsobject dependencies and
ID="IN4531-5015486"sp_diskdefault system procedureID="X92302"sp_diskdefaultID="IN4616-5516088"Database devicesdefaulton or defaultoff status
ID="IN4616-5516089"Database devicesstatus;Database devices:status
ID="IN466-5516090"Statusdatabase device;Defaults:database device
Sets a database device's status to MOREINFO="NONE"defaulton or MOREINFO="NONE"defaultoff. This indicates whether or not a database device can be used for database storage if the user does not specify a database device or specifies MOREINFO="NONE"default with the MOREINFO="NONE"create database or MOREINFO="NONE"alter database commands. FORMAT="LINESPECIFIC"sp_diskdefault MOREINFO="NONE"logical_name {defaulton | defaultoff} ParametersREMAP="RI--RefIndent"ID="IN4645-5816393"Process logical name. See Logical device nameID="IN4619-5816394"Logical device nameID="IN4616-6116695"Default databaseDefault databaseSee also sysdevices table!see alsoID="IN467-6416996"DevicesDevicesSee also sysdevices table!see alsoID="IN4616-6617197"sysdevices tablelogical_name-is the logical name of the device as given in master.dbo.sysdevices.name. The device must be a database device rather than a dump device. ID="IN4645-7017598"defaulton | defaultoff option, sp_diskdefaultMOREINFO="NONE"defaulton | MOREINFO="NONE"defaultoff - MOREINFO="NONE"defaulton if the specified database device is to be designated a default database device; MOREINFO="NONE"defaultoff if the specified database device is not to be designated a default database device. REMAP="UN--Under"The keyword MOREINFO="NONE"defaulton is most often used after a database device is added to the system with MOREINFO="NONE"disk init. The keyword MOREINFO="NONE"defaultoff is most often used to change the default status of the MOREINFO="NONE"master device (which is on when SQL Server is first installed). ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_diskdefault master, defaultoffREMAP="UN--Under"The master device is no longer used by MOREINFO="NONE"create database or MOREINFO="NONE"alter database for default storage of a database. CommentsMARK="BULL" REMAP="BU--Bullet"A default database device is one that is used for database storage by MOREINFO="NONE"create database or MOREINFO="NONE"alter database if the user does not specify a database device name or specifies the keyword MOREINFO="NONE"default. You can have multiple default devices. They are used in the order they appear in the master.dbo.sysdevices table (that is, alphabetical order). When the first default device is filled, the second default device is used, and so on. When you first install SQL Server, the master device, d_master, is the only default database device.Once you initialize devices to store user databases, use MOREINFO="NONE"sp_diskdefault to turn off the master device's default status. This prevents users from accidentally creating databases on the master device, and makes recovery of the master database simpler.To find out which database devices are default database devices, execute MOREINFO="NONE"sp_helpdevice. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_diskdefault from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_diskdefault modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"No such device exists -- run sp_helpdevice to list the SQL Server devices.REMAP="UN--Under"The device name supplied for the logicalname parameter doesn't exist. Run MOREINFO="NONE"sp_helpdevice without a parameter to see a list of all devices. To add a new database device to the system, use the MOREINFO="NONE"disk init command. MOREINFO="NONE"The device name supplied is not a database disk.REMAP="UN--Under"The device name supplied for the device_name parameter is in sysdevices, but it is a dump device rather than a database device. Run MOREINFO="NONE"sp_helpdevice without a parameter to see a list of all devices. To add a new database device to the system, use the MOREINFO="NONE"disk init command. MOREINFO="NONE"Usage: sp_diskdefault logicalnameMOREINFO="NONE" {defaulton | defaultoff}.REMAP="UN--Under"The second parameter must be either MOREINFO="NONE"defaulton or MOREINFO="NONE"defaultoff. PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_diskdefault. Tables UsedREMAP="BO--Body"master.dbo.sysdevices, sysobjects See Also Commands     LINKEND="X61977"alter database
, LINKEND="X75308"create database
, LINKEND="X64061"disk initSystem procedures     LINKEND="X11789"sp_helpdevice
ID="IN4631-74179105"sp_diskdefault system procedure
ID="IN4616-79184106"Database devicesdefaulton or defaultoff status
 ID="IN4632-83188107"sp_displaylogin system procedureID="X68664"sp_displayloginID="IN476-83189109"Loginsinformation on
ID="IN4720-83189110"Information (Server)users
ID="IN4711-83189111"Permissionsdisplaying userÕ s
Displays information about a login account. FORMAT="LINESPECIFIC"sp_displaylogin [login_name]ParametersREMAP="RI--RefIndent"ID="IN475-83189114"Usersinformation onlogin_name - is the user login account about which you want information if it is other than your own. You must be a System Security Officer or System Administrator to get information about someone else's login account.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_displayloginREMAP="UN--Under"Displays information about your server login account.sp_displaylogin bobREMAP="UN--Under"Displays information about the login account "bob". The information displayed depends on the role of the user executing MOREINFO="NONE"sp_displaylogin.CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_displaylogin displays configured roles, so that even if you have made a role inactive with the MOREINFO="NONE"set command, it is displayed.When you use MOREINFO="NONE"sp_displaylogin to get information about your own account you do not need to use the login_name parameter. MOREINFO="NONE"sp_displayloginID="IN478-83189117"User IDsdisplaying
ID="IN4731-86192118"Authorizations. See Permissions
ID="IN479-86192119"Passwordsdate of last change
ID="IN477-86192120"Lockinglogin account status
 displays your server user ID, login name, full name, any roles that have been granted to you, date of last password change, and whether your account is locked.If you are a System Security Officer or System Administrator, you can use the login_name parameter to access information about any account.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"No login with the specified name exists.REMAP="UN--Under"You specified an incorrect login_name.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_displaylogin to get information about his or her own login account. System Security Officers and System Administrators can use MOREINFO="NONE"sp_displaylogin with the login_name parameter to get information about other users' login accounts.Tables UsedREMAP="BO--Body"master.dbo.sysloginroles, master.dbo.syslogins, master.dbo.syssrvroles, sysobjects See Also Topics     LINKEND="X96191"Roles
ID="IN4732-90196126"sp_displaylogin system procedureREMAP="BO--Body"ID="X47662"sp_dropaliasID="IN432292104"Removing. See Dropping
ID="IN43590125"Usersdropping aliased;Dropping:aliased user
ID="IN43590126"Namesalias
Removes the alias user name identity established with MOREINFO="NONE"sp_addalias. FORMAT="LINESPECIFIC"sp_dropalias MOREINFO="NONE"login_nameParametersREMAP="RI--RefIndent"ID="IN43690129"Loginsalias
login_name - is the name (in master.dbo.syslogins) of the user who was aliased to another user. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dropalias victoriaREMAP="UN--Under"Assuming that "victoria" was aliased (for example, to the Database Owner) in the current database, this statement drops "victoria" as an aliased user from the database. CommentsID="IN437861612"Aliasessysalternates table;sysalternates tableMARK="BULL" REMAP="BU--Bullet"Executing the MOREINFO="NONE"sp_dropalias procedure deletes an alternate suid mapping for a user from the sysalternates table. When a user's alias is dropped, he or she no longer has access to the database for which the alias was created. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Alias user dropped.REMAP="UN--Under"The user is no longer aliased to another user in the current database. The user cannot use the database until reinstated by the Database Owner with MOREINFO="NONE"sp_adduser or MOREINFO="NONE"sp_addalias. MOREINFO="NONE"No alias for specified user exists.REMAP="UN--Under"The named user doesn't have an alias in the current database. MOREINFO="NONE"No login with the specified name exists.REMAP="UN--Under"The login_name you supplied has no account on SQL Server. No action was taken. PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_dropalias. Tables UsedREMAP="BO--Body"sysalternates, sysobjectsSee Also Commands     LINKEND="X39034"useSystem procedures     LINKEND="X12007"sp_addalias
,LINKEND="X68639"sp_adduser
,LINKEND="X78355"sp_changedbowner
, LINKEND="X49053"sp_droplogin
, LINKEND="X46789"sp_dropuser
, LINKEND="X28192"sp_helpuser
ID="IN4329822017"sp_dropalias system procedure
ID="IN437802218"Aliasesdropping;Dropping:aliased user
ID="IN435792319"Usersdropping aliased
ID="IN4330752720"sp_dropdevice system procedure
ID="IN438723021"DeletingDeletingSee also Dropping!see also Dropping
ID="IN438693322"DroppingDroppingSee also Deleting!see also DeletingID="X57787"sp_dropdeviceID="IN4416673624"Database devicesdropping;Dropping:database devices
ID="IN4412663725"Dump devicesdropping
Drops a SQL Server database device or dump device. FORMAT="LINESPECIFIC"sp_dropdevice MOREINFO="NONE"device_name ParametersREMAP="RI--RefIndent"device_name - is the name of the device as listed in master.dbo.sysdevices.name. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dropdevice tape5 REMAP="UN--Under"Drops the device named tape5 from SQL Server. sp_dropdevice fredsdata REMAP="UN--Under"Drops the database device named fredsdata from SQL Server. The device must not be in use by any databases. CommentsMARK="BULL" REMAP="BU--Bullet"The MOREINFO="NONE"sp_dropdevice procedure drops a device from SQL Server, deleting the device entry from master.dbo.sysdevices.ID="IN445643930"Filesinaccessible after sp_dropdevice
MOREINFO="NONE"sp_dropdeviceID="IN4425614231"Database files. See Files
ID="IN448614232"Deletingfiles;Files:deleting
 does not remove a file that is being dropped as a database device; it makes the file inaccessible to SQL Server. Use operating system commands to delete a file after using MOREINFO="NONE"sp_dropdevice.ID="IN4416594433"Restarts, Serverafter using sp_dropdeviceYou must restart SQL Server after you drop a device because the kernel has a process that is accessing the dropped device, and there is no way to kill the process. Restarting with MOREINFO="NONE"startserver or MOREINFO="NONE"dataserver frees up the logical device number.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_dropdevice from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_dropdevice modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"Device dropped.REMAP="UN--Under"The device was dropped from the master.dbo.sysdevices table. MOREINFO="NONE"Device is being used by a database. You can't drop it.REMAP="UN--Under"Only database devices that are not in use can be dropped. You must drop all the databases associated with the device before dropping the device. MOREINFO="NONE"No such device exists -- run sp_helpdevice to list the SQL Server devices.REMAP="UN--Under"You tried to drop a device that doesn't exist on SQL Server. PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_dropdevice. Tables UsedREMAP="BO--Body"master.dbo.sysdatabases, master.dbo.sysdevices, master.dbo.sysusages, sysobjects See Also Commands     LINKEND="X72692"drop databaseSystem procedure     LINKEND="X85886"sp_addumpdevice
, LINKEND="X90458"sp_helpdb
,LINKEND="X11789"sp_helpdevice
ID="IN4430554838"sp_dropdevice system procedure
ID="IN4416535039"Database devicesdropping;Dropping:database devices
ID="IN4412525140"Dump devicesdropping
 ID="IN4429485541"sp_dropgroup system procedureID="X17416"sp_dropgroupID="IN458465843"Droppinggroup from a database;Groups:dropping
Drops a group from a database. FORMAT="LINESPECIFIC"sp_dropgroup MOREINFO="NONE"grpnameParametersREMAP="RI--RefIndent"grpname - is the name of a group in the current database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_changegroup accounting, martha sp_changegroup "public", george sp_dropgroup purchasing REMAP="UN--Under"The "purchasing" group has merged with the "accounting" group. These commands move "martha" and "george", members of the "purchasing" group, to other groups before dropping the group. The group name "public" is quoted because "public" is a reserved word. CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_dropgroup drops a group name from a database's sysusers table. ID="IN4531426248"sp_changegroup system proceduresp_dropgroup andYou cannot drop a group if it has members. You must execute MOREINFO="NONE"sp_changegroup for each member before you can drop the group. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't drop the group 'public'.ID="IN4514406450""public" grouppublic groupsp_dropgroup andsp_dropgroup andREMAP="UN--Under"The "public" group exists in every database. It is the group that all users belong to by default, and cannot be dropped. MOREINFO="NONE"Group has been dropped.REMAP="UN--Under"The command succeeded. The group no longer exists in the current database. MOREINFO="NONE"Group has members. It must be empty before it can be dropped.REMAP="UN--Under"Groups with members cannot be dropped. Reassign the members of the group to another group using MOREINFO="NONE"sp_changegroup. A list of the group members appears after this message. MOREINFO="NONE"No group with the specified name exists.REMAP="UN--Under"The specified group doesn't exist. PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_dropgroup. Tables UsedREMAP="BO--Body"master.dbo.syssrvroles, sysobjects, sysprotects, sysusers See Also Commands     LINKEND="X69087"grant
, LINKEND="X29921"revoke
,LINKEND="X39034"useSystem procedures     LINKEND="X65925"sp_addgroup
,LINKEND="X68639"sp_adduser
,LINKEND="X18596"sp_changegroup
, LINKEND="X46789"sp_dropuser
, LINKEND="X25329"sp_helpgroup
ID="IN4527366854"sp_dropkey system procedureID="X18196"sp_dropkey
Removes from the syskeys table a key that had been defined using MOREINFO="NONE"sp_primarykey, MOREINFO="NONE"sp_foreignkey, or MOREINFO="NONE"sp_commonkey. FORMAT="LINESPECIFIC"sp_dropkey keytype, tabaname [, tabbnameMOREINFO="NONE"] ParametersREMAP="RI--RefIndent"keytype - is the type of key to drop. The keytypeID="IN4612347158"Primary keyssp_dropkey procedure
 must be MOREINFO="NONE"primary, ID="IN4612347159"Foreign keysdropping
MOREINFO="NONE"foreignID="IN4611327360"Common keyssp_dropkey procedure
, or MOREINFO="NONE"common. tabaname ID="IN466327361"Tablesdropping keys between
ID="IN465327362"Viewsdropping keys between
- is the name of the key table or view that contains the key to drop. tabbname - specifies the name of the second table in the relation if the keytype is MOREINFO="NONE"foreign or MOREINFO="NONE"common. If the keytype is MOREINFO="NONE"primary, this parameter is not needed, since MOREINFO="NONE"primary keys have no dependent tables. If the keytype is MOREINFO="NONE"foreign, this is the name of the primary key table. If the keytype is MOREINFO="NONE"common, give the two table names in the order in which they appear with MOREINFO="NONE"sp_helpkey.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dropkey primary, employees REMAP="UN--Under"Drops the primary key for the table employees. Any foreign keys that were dependent on the primary key for employees are also dropped. sp_dropkey common, employees, projects REMAP="UN--Under"Drops the common keys between the tables employees and projects.sp_dropkey foreign, titleauthor, titles REMAP="UN--Under"Drops the foreign key between the tables titleauthor and titles. CommentsID="IN4611327365"Keys, tabledroppingMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_dropkeyID="IN4613287766"syskeys tablesp_dropkey and
 deletes the specified key from syskeys. Only the owner of a table may drop a key on that table. ID="IN4641287767"Database design, logical relationships inKeys are created to make explicit a logical relationship that is implicit in your database design. This information can be used by an application program. Dropping a primary key automatically drops any foreign keys associated with it. Dropping a foreign key has no effect on a primary key specified on that table. Executing MOREINFO="NONE"sp_commonkey, MOREINFO="NONE"sp_primarykey, or MOREINFO="NONE"sp_foreignkey adds the key to the syskeys system table. To display a report on the keys that have been defined, execute MOREINFO="NONE"sp_helpkey. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Common keys dropped.REMAP="UN--Under"The MOREINFO="NONE"sp_dropkey command succeeded, dropping the common keys and deleting them from syskeys. MOREINFO="NONE"Dependent foreign keys were also dropped.REMAP="UN--Under"When a primary key is dropped, any foreign keys that depend on it are also dropped. MOREINFO="NONE"Foreign key dropped.REMAP="UN--Under"The MOREINFO="NONE"sp_dropkey command succeeded, dropping the foreign key and deleting it from syskeys. MOREINFO="NONE"No common keys exist between the two tables or views supplied.REMAP="UN--Under"There are no common keys between the tabaname and tabbname tables, or the table names were given in the wrong order. No action was taken. Use MOREINFO="NONE"sp_helpkey to see the keys and the order in which to give the arguments.MOREINFO="NONE"No foreign key for the table or view exists.REMAP="UN--Under"tabaname has no foreign key defined. MOREINFO="NONE"No primary key for the table or view exists.REMAP="UN--Under"tabaname has no primary key defined. MOREINFO="NONE"Primary key for the table or view dropped.REMAP="UN--Under"The MOREINFO="NONE"sp_dropkey command succeeded, dropping the primary key and deleting it from syskeys. MOREINFO="NONE"Table or view name must be in current database.REMAP="UN--Under"You can't drop keys on tables or views in other databases. MOREINFO="NONE"The dependent table or view doesn't exist in the current database.REMAP="UN--Under"The name supplied for the tabbname parameter isn't a table or view in the current database. MOREINFO="NONE"The table or view named doesn't exist in the current database.REMAP="UN--Under"The tabaname supplied isn't a table or view in the current database. MOREINFO="NONE"Usage: sp_dropkey {primary | foreign | common}, tabaname [, tabbname]. Type must be 'primary', 'foreign', or 'common'.REMAP="UN--Under"The keytype parameter should specify the type of key to drop. MOREINFO="NONE"You must be the owner of the table or view to drop its key.REMAP="UN--Under"You aren't the owner of the table, so you can't drop the key. MOREINFO="NONE"You must supply the dependent table or view as the third parameter.REMAP="UN--Under"When dropping a foreign or common key, both the tabaname and tabbname tables must be named. PermissionsREMAP="BO--Body"Only the owner of tabaname can issue MOREINFO="NONE"sp_dropkey. Tables UsedREMAP="BO--Body"syskeys, sysobjects See Also System procedures     LINKEND="X22659"sp_commonkey
, LINKEND="X50021"sp_foreignkey
,LINKEND="X44026"sp_helpkey
, LINKEND="X43109"sp_primarykey
ID="IN4627248172"sp_dropkey system procedure
 ID="IN4632208573"sp_droplanguage system procedureID="X82772"sp_droplanguageID="IN4720198775"Languages, alternatedropping
Drops an alternate language from the server and removes its row from ID="IN4718159176"syslanguages tablesp_droplanguages and
master.dbo.syslanguages. FORMAT="LINESPECIFIC"sp_droplanguage MOREINFO="NONE"language [, dropmessages]ParametersREMAP="RI--RefIndent"language - is the official name of the language to drop. ID="IN4736119579"dropmessages option, sp_droplanguage
MOREINFO="NONE"dropmessages - drops all SQL Server system messages in languageID="IN47899780"Messagesdropping system with sp_droplanguage
. You cannot drop a language with associated system messages without also dropping its messages by entering MOREINFO="NONE"dropmessages.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_droplanguage french REMAP="UN--Under"This command drops French from the set of available alternate languages, if there are no associated messages. sp_droplanguage french, dropmessages REMAP="UN--Under"This command drops French from the set of available alternate languages, if there are associated messages. CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_droplanguage drops a language from a list of alternate languages by deleting its entry from the master.dbo.syslanguages table. If you try to drop a language that has system messages, the request fails unless you supply the MOREINFO="NONE"dropmessages parameter. MessagesMARK="BULL" REMAP="BU--Bullet"language
MOREINFO="NONE" is not an official language name from syslanguages.REMAP="UN--Under"Use MOREINFO="NONE"sp_helplanguage to see the list of official languages available on this SQL Server. MOREINFO="NONE"Can't drop 'language
MOREINFO="NONE"' because there are associated entries in master.dbo.sysmessages. Run sp_droplanguage with `dropmessages' flag.REMAP="UN--Under"You cannot drop a language for which the master database contains associated system messages. Rerun MOREINFO="NONE"sp_droplanguage with the MOREINFO="NONE"dropmessages option to drop the language and all associated system messages.MOREINFO="NONE"The only legal value for the second parameter is `dropmessages'.REMAP="UN--Under"You cannot specify any option other than MOREINFO="NONE"dropmessages.MOREINFO="NONE"Language deleted.REMAP="UN--Under"The language is deleted from master.dbo.syslanguages. Error messages associated with this language are deleted from master.dbo.sysmessages. PermissionsREMAP="BO--Body"Only a System Administrator can issue MOREINFO="NONE"sp_droplanguage.Tables UsedREMAP="BO--Body"master.dbo.syslanguages, master.dbo.sysmessages, sysobjects See Also System procedures     LINKEND="X44244"sp_addlanguage
, LINKEND="X13013"sp_helplanguage
ID="IN4732510187"sp_droplanguage system procedure
ID="IN4720410288"Languages, alternatedropping
 ID="IN4729010689"sp_droplogin system procedureID="X49053"sp_droploginID="IN485-311091"Usersdropping with sp_droplogin
ID="IN486-511292"Loginsdropping with sp_droplogin system procedure
Drops a SQL Server user login by deleting the user's entry in master.dbo.syslogins. FORMAT="LINESPECIFIC"sp_droplogin MOREINFO="NONE"login_nameParametersREMAP="RI--RefIndent"login_name - is the name of the user as listed in master.dbo.syslogins. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_droplogin victoriaREMAP="UN--Under"Drops "victoria" from SQL Server.CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_droplogin drops a user login from SQL Server, deleting the user's entry from master.dbo.syslogins. ID="IN488-711497"User IDsdropping with sp_droplogin andSQL Server reuses a dropped login's server user IDs, which compromises accountability. You may avoid dropping accounts at all and instead use MOREINFO="NONE"sp_locklogin to lock any accounts that will no longer be used. If you do need to drop logins, be sure to audit these events (using MOREINFO="NONE"sp_auditsproc) so that you have a record of them.MOREINFO="NONE"sp_droplogin fails if the login to be dropped is a user in any database on the server. Use MOREINFO="NONE"sp_dropuser to drop the user from a database. You cannot drop a user from a database if that user owns any objects in the database.If the login to be dropped is a System Security Officer, MOREINFO="NONE"sp_droplogin verifies that at least one other unlocked System Security Officer's account exists. If not, MOREINFO="NONE"sp_droplogin fails. Similarly, MOREINFO="NONE"sp_droplogin ensures that there is always at least one unlocked System Administrator's account.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_droplogin from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_droplogin modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"Login dropped.REMAP="UN--Under"The user's entry in master.dbo.syslogins has been deleted. The user no longer has access to SQL Server. MOREINFO="NONE"No such account -- nothing changed.REMAP="UN--Under"The specified login name does not exist. MOREINFO="NONE"User exists or is an alias in at least one database. Drop user/alias before dropping login.REMAP="UN--Under"You cannot drop a login who is a user in any database on the server, or an user who has an alias in a database. Use MOREINFO="NONE"sp_dropuser to drop a user from a database or MOREINFO="NONE"sp_dropalias to drop the alias from the databases.MOREINFO="NONE"Warning: the specified account is currently active. Nothing changed.REMAP="UN--Under"You cannot drop an account if it is active. Run the command again when the user has logged off. You may be able to use MOREINFO="NONE"kill to end their SQL Server session.PermissionsREMAP="BO--Body"Only the System Administrator can execute MOREINFO="NONE"sp_droplogin.Tables UsedREMAP="BO--Body"master.dbo.sysloginroles, master.dbo.syslogins, master.dbosysprocesses, sysobjects See Also System procedures     LINKEND="X25636"sp_addlogin
,LINKEND="X26489"sp_auditsproc
, LINKEND="X78355"sp_changedbowner
, LINKEND="X47662"sp_dropalias
,LINKEND="X46789"sp_dropuser
, LINKEND="X28192"sp_helpuser
, LINKEND="X98458"sp_lockloginTopics     LINKEND="X16582"Login Management
ID="IN4831-11118102"sp_dropmessage system procedureID="X40499"sp_dropmessageID="IN498-13121104"Messagesdropping user-defined;Dropping:user-defined messages
ID="IN4921-17125105"sysusermessages tablesp_dropmessage and
Drops user-defined messages from sysusermessages. FORMAT="LINESPECIFIC"sp_dropmessage MOREINFO="NONE"message_number [, lMOREINFO="NONE"anguage]ParametersREMAP="RI--RefIndent"ID="IN4914-17125108"Message numbermessage
message_number - is the message number of the message to drop. Message numbers must have a value of 20000 or higher. ID="IN498-17125109"Messageslanguage setting for;Languages, alternate:dropping messages in
language - is the language of the message to drop. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dropmessage 20002, frenchREMAP="UN--Under"Removes the French version of the message with the number 20002 from sysusermessages.CommentsMARK="BULL" REMAP="BU--Bullet"The language parameter is optional. If included, only the message with the indicated message_number in the indicated language is dropped. If you do not specify a language, all messages with the indicated message_number are dropped. MessagesMARK="BULL" REMAP="BU--Bullet"language
MOREINFO="NONE" is not an official language name from syslanguages.REMAP="UN--Under"The language given is not a valid name in the syslanguages table. MOREINFO="NONE"Message number must be at least 20000.REMAP="UN--Under"Only user-defined messages, which have message numbers of 20000 or higher, can be deleted. MOREINFO="NONE"Message number message_number does not exist.REMAP="UN--Under"No message with the given message number exists in sysusermessages. MOREINFO="NONE"Message number message_number
does not exist in the language
language.REMAP="UN--Under"A message with the given message number does not exist in the language given. MOREINFO="NONE"Message deleted.REMAP="UN--Under"The message has been dropped.MOREINFO="NONE"User user_name
MOREINFO="NONE" does not have permission to drop message number message_number
.MOREINFO="NONE"User user_name
MOREINFO="NONE" does not have permission to drop message number message_number
MOREINFO="NONE" in the languageMOREINFO="NONE" language.REMAP="UN--Under"Only System Administrators, the Database Owner, and the user who originally created the message being dropped can delete a message. PermissionsREMAP="BO--Body"Only a System Administrator, the Database Owner, and the user who originally created the message being dropped can execute MOREINFO="NONE"sp_dropmessage. Tables UsedREMAP="BO--Body"master.dbo.syslanguages, sysobjects, sysusermessages See Also System procedures     LINKEND="X36529"sp_addmessage
, LINKEND="X61947"sp_getmessage
ID="IN4931-21129116"sp_dropmessage system procedure
ID="IN498-23131117"Messagesdropping user-defined;Dropping:user-defined messages
 REMAP="BO--Body"ID="X85991"sp_dropremoteloginID="IN43139393"Remote loginsdropping;Dropping:remote logins;Logins:dropping remote
Drops a remote user login. FORMAT="LINESPECIFIC"sp_dropremotelogin MOREINFO="NONE"remoteserver [,MOREINFO="NONE" login_name [, MOREINFO="NONE"remotename] ] ParametersREMAP="RI--RefIndent"ID="IN431491116"Remote serverssp_dropremotelogin and
remoteserver - is the name of the server which has the remote login to be dropped. login_name ID="IN43685177"Loginssysremotelogins table;sysremotelogins table:sp_dropremotelogin and
- is the local server's user name that is associated with the remote server in the sysremotelogins table. ID="IN43585178"Namesremote user
remotename - is the remote user name that gets mapped to login_name when logging in from the remote server. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dropremotelogin GATEWAY REMAP="UN--Under"Drops the entry for the remote server named GATEWAY. sp_dropremotelogin GATEWAY, churchy REMAP="UN--Under"Drops the entry for mapping remote logins from the remote server GATEWAY to the local user named "churchy". sp_dropremotelogin GATEWAY, churchy, pogo REMAP="UN--Under"Drops the login for the remote user "pogo" on the remote server GATEWAY that was mapped to the local user named "churchy". CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_dropremotelogin drops a user login from a remote server, deleting the user's entry from master.dbo.sysremotelogins. For a more complete discussion on remote logins, see LINKEND="X52745"sp_addremotelogin
. To add and drop local server users, use the system procedures MOREINFO="NONE"sp_addlogin and MOREINFO="NONE"sp_droplogin. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_dropremotelogin from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_dropremotelogin modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"Remote login dropped.REMAP="UN--Under"The remote user's entry in master.dbo.sysremotelogins has been deleted. The remote user no longer has access to this server. MOREINFO="NONE"There is no remote user 'remotenam
eMOREINFO="NONE"' mapped to local user 'login_name
MOREINFO="NONE"' from the remote server 'remoteserver
MOREINFO="NONE"'. REMAP="UN--Under"The specified remote login name does not exist for the named server. PermissionsREMAP="BO--Body"Only the System Administrator can execute MOREINFO="NONE"sp_dropremotelogin. Tables UsedREMAP="BO--Body"master.dbo.sysremotelogins, master.dbo.sysservers, sysobjects See Also System procedures     LINKEND="X25636"sp_addlogin
, LINKEND="X52745"sp_addremotelogin
, LINKEND="X18765"sp_addserver
, LINKEND="X49053"sp_droplogin
,LINKEND="X68669"sp_helpremotelogin
, LINKEND="X45409"sp_helpserver
ID="IN4335812115"sp_dropremotelogin system procedure
ID="IN4313782416"Remote loginsdropping;Dropping:remote logins;Logins:dropping remoteREMAP="BO--Body"ID="X10014"ID="IN4431742917"sp_dropsegment system procedure
sp_dropsegmentID="IN448723119"Droppingsegment from a database;Unmapping a segment from a database
ID="INA4416703320"Database devicesdropping segments from;Databases:dropping segments from
ID="IN448693421"Segmentsdropping
Drops a segment from a database or unmaps a segment from a particular database device. FORMAT="LINESPECIFIC"sp_dropsegment MOREINFO="NONE"segname, dbname [, MOREINFO="NONE"devname]ParametersREMAP="RI--RefIndent"segname - is the name of the segment to drop. dbname - is the name of the database.devname - is the name of the database device for the segment segname to no longer use. This parameter is optional, except when dropping the system segments system, default and logsegment from a database device. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dropsegment indexes, pubs2REMAP="UN--Under"This command drops the segment indexes from the pubs2 database. sp_dropsegment indexes, pubs2, dev1 REMAP="UN--Under"This command unmaps the segment indexes from the database device dev1. CommentsMARK="BULL" REMAP="BU--Bullet"You can drop a segment if it is not referenced by any table or index in the specified database. If you do not supply the optional argument devname, the segment is dropped from the specified database. If you do supply a devname name, the segment is no longer mapped to the named database device, but the segment is not dropped. Dropping a segment drops all thresholds associated with that segment. When you unmap a segment from one or more devices, SQL Server drops any thresholds that exceed the total space on the segment. When you unmap the logsegment from one or more devices, SQL Server recalculates the last-chance threshold.ID="IN4431653826"sp_dropsegment system proceduresp_placeobject andUsing MOREINFO="NONE"sp_placeobject to change future space allocations for a table or index from one segment to another dereferences the original segment. You can drop the original segment name with MOREINFO="NONE"sp_dropsegment. ID="IN4414634027"system segmentdroppingFor the system segments systemID="IN4415614228"default segmentdropping
, defaultID="IN4422594429"logsegment log storagedropping
 and logsegment, you must specify the device name from which you want the segments dropped. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't drop the 'segname
MOREINFO="NONE"' segment completely.REMAP="UN--Under"You did not specify the device from which you want the segment dropped. MOREINFO="NONE"Can't run sp_dropsegment from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_dropsegment modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"Segment dropped.REMAP="UN--Under"The procedure was successful. There is no longer a segment named segname in the specified database. MOREINFO="NONE"Segment reference to device dropped.REMAP="UN--Under"The procedure was successful. The segment segname no longer refers to database device devname. MOREINFO="NONE"Segment 'segname
MOREINFO="NONE"' does not reference device 'devname
MOREINFO="NONE"'.REMAP="UN--Under"The segment you tried to drop from devname isn't referenced by segname. Run MOREINFO="NONE"sp_helpsegment segname to list the devices that segname references. MOREINFO="NONE"The specified device is not used by the database.REMAP="UN--Under"The specified database doesn't use device devname. Use MOREINFO="NONE"sp_helpsegment to see which devices are referenced by segname. MOREINFO="NONE"The segment`segname
MOREINFO="NONE"' is being used.REMAP="UN--Under"You can't drop a segment that is referenced by a table or index. If you still want to drop the segment, you must redefine the segment for the affected tables or indexes by using the system procedure MOREINFO="NONE"sp_placeobject. MOREINFO="NONE"There is no such segment as 'segname
MOREINFO="NONE"'.ID="IN4417574631"syssegments tableREMAP="UN--Under"The segment you have tried to drop does not exist. All segments for a database are listed in the syssegments table. MOREINFO="NONE"There is only one device mapping for the segment MOREINFO="NONE"'segname
MOREINFO="NONE"' -- use sp_dropsegment with no device argument.ID="IN4416574632"Database deviceslast device reference for;Segments:last device reference forREMAP="UN--Under"The device you have tried to drop is the last device reference for segname. It's illegal to drop the last device reference for a segment. MOREINFO="NONE"WARNING: There are no longer any segments referencing device 'devname
MOREINFO="NONE"'. This device will no longer be used for space allocation.REMAP="UN--Under"The procedure was successful, but the device is now unassigned and can't be used for storing data or log information.MOREINFO="NONE"WARNING: There are no longer any segments referencing devices 'devname_list
MOREINFO="NONE"'. These devices will no longer be used for space allocation.REMAP="UN--Under"The procedure was successful, but the devices are now  unassigned and can't be used for storing data or log information.MOREINFO="NONE"You must execute this procedure from the database in which you wish to add a segment. Please execute `use database_name
MOREINFO="NONE"' and try again.REMAP="UN--Under"MOREINFO="NONE"sp_dropsegment can drop segments only in the database you are currently using. Issue the MOREINFO="NONE"use command to open the database in which you want to drop a segment. Then run MOREINFO="NONE"sp_dropsegment again.PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_dropsegment. Tables UsedREMAP="BO--Body"#temptable, master.dbo.spt_values, sysdatabases, sysdevices, sysindexes, sysobjects, syssegments, systhresholds, sysusagesSee Also System procedures     LINKEND="X62957"sp_addsegment
MOREINFO="NONE", LINKEND="X96491"sp_addthreshold
MOREINFO="NONE", LINKEND="X36403"sp_helpsegment
MOREINFO="NONE", LINKEND="X52248"sp_helpthreshold
MOREINFO="NONE", LINKEND="X20401"sp_placeobject
ID="IN4431535036"sp_dropsegment system procedure
ID="IN448525137"Segmentsdropping
ID="IN4416505338"Database devicesdropping segments from;Databases:dropping segments from
ID="IN448485539"Droppingsegment from a database;Unmapping a segment from a database
ID="IN4430445940"sp_dropserver system procedureID="X78977"sp_dropserverID="IN457426242"Serversdropping;Dropping:servers
Drops a server from the list of known servers. FORMAT="LINESPECIFIC"sp_dropserver MOREINFO="NONE"server [, droplogins]ParametersREMAP="RI--RefIndent"server - is the name of the server to be dropped. ID="IN4533386645"drop logins option, sp_dropserver
MOREINFO="NONE"droplogins ID="IN456366846"Loginssp_dropserver droplogins procedure
- indicates that any remote logins for server should also be dropped.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dropserver GATEWAYREMAP="UN--Under" This command drops the remote server GATEWAY. CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_dropserver drops a server from a list of known servers, deleting the entry from the master.dbo.sysservers table. Running MOREINFO="NONE"sp_dropserverID="IN456327249"Loginssysremotelogins table;sysremotelogins table
 on a server that has associated entries in the master.dbo.sysremoteloginsID="IN455287650"Usersremote, dropping with sp_dropserver;Users:dropping remote with sp_dropserver
 table results in an error message stating that you must drop the remote users before you can drop the server. To drop all the remote logins for a server when dropping the server, supply the value MOREINFO="NONE"droplogins.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_dropserver from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_dropserver modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"Remote logins for remote server 'server
'MOREINFO="NONE" have been dropped.REMAP="UN--Under"The MOREINFO="NONE"sp_dropserver command succeeded, and dropped the remote server and all the associated logins.MOREINFO="NONE"Server dropped.REMAP="UN--Under"The procedure was successful. The server named MOREINFO="NONE"server is no longer accessible through this server and it can no longer access this server. MOREINFO="NONE"There are still remote logins for the server MOREINFO="NONE"'server
MOREINFO="NONE"'.REMAP="UN--Under"The server you want to drop has associated entries in the sysremotelogins table. You must either drop the remote logins with MOREINFO="NONE"sp_dropremotelogin or use the MOREINFO="NONE"droplogins parameter to the MOREINFO="NONE"sp_dropserver system procedure. MOREINFO="NONE"There is not a server named 'server
'.REMAP="UN--Under"The server you have tried to drop is not a known server. All known servers for a SQL Server are listed in the master.dbo.sysservers table.MOREINFO="NONE"Usage: sp_dropserver server [, droplogins]REMAP="UN--Under"The only valid parameter to MOREINFO="NONE"sp_dropserver is MOREINFO="NONE"droplogins.PermissionsREMAP="BO--Body"Only a System Security Officer can execute MOREINFO="NONE"sp_dropserver. Tables UsedREMAP="BO--Body"master.dbo.sysremotelogins, master.dbo.sysservers, sysobjects See AlsoSystem procedures     LINKEND="X18765"sp_addserver
MOREINFO="NONE", LINKEND="X85991"sp_dropremotelogin
MOREINFO="NONE", LINKEND="X68669"sp_helpremotelogin
MOREINFO="NONE", LINKEND="X45409"sp_helpserver
ID="IN4530248055"sp_dropserver system procedure
ID="IN457228256"Serversdropping;Dropping:servers
 ID="IN4533188657"sp_dropthreshold system procedureID="X39966"sp_dropthresholdID="IN4610178859"Thresholdsremoving
Removes a free-space threshold from a segment.FORMAT="LINESPECIFIC"sp_dropthreshold database, segment, free_pagesParametersREMAP="RI--RefIndent"database - is the database from which you are dropping the threshold. This must be the name of the current database.segment - is the segment whose free space is monitored by the threshold. Use quotes when specifying the "default" segment.free_pages - is the number of free pages at which the threshold is crossed.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dropthreshold mydb, segment1, 200REMAP="UN--Under"Removes a threshold from segment1 of mydb. You must specify the database, segment, and amount of free space to identify the threshold.CommentsID="IN4610178864"Thresholdslast-chance;Transaction logs:thresholds andMARK="BULL" REMAP="BU--Bullet"You cannot drop the last-chance threshold from the log segment.ID="IN4610178865"Thresholdsdisabling
You can use the MOREINFO="NONE"no free space acctg option of MOREINFO="NONE"sp_dboption as an alternative to MOREINFO="NONE"sp_dropthreshold. This option disables free-space accounting on non-log segments. You cannot disable free-space accounting on log segments.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Dropping threshold for segment MOREINFO="NONE"'segment_name
MOREINFO="NONE"' at 'pageno
MOREINFO="NONE"' pages.REMAP="UN--Under"The MOREINFO="NONE"sp_dropthreshold command succeeded.MOREINFO="NONE"Segment 'segment_name
'MOREINFO="NONE" does not have a threshold at 'pageno
'MOREINFO="NONE" pages.REMAP="UN--Under"Run MOREINFO="NONE"sp_helpthreshold to see the names of the thresholds in the current database.MOREINFO="NONE"Table 'systhresholds
'MOREINFO="NONE" does not exist in database MOREINFO="NONE"'dbname
MOREINFO="NONE"' -- cannot drop thresholds.ID="IN4619159067"systhresholds tableREMAP="UN--Under"The systhresholds table is missing. This table is created when the database is created (or an upgrade to Release 10 is performed), and must not be removed.MOREINFO="NONE"There is no segment named 'segment_name
'.REMAP="UN--Under"Run MOREINFO="NONE"sp_helpsegment to see the names of the segments in the current database.MOREINFO="NONE"You may not drop the log's last-chance threshold.REMAP="UN--Under"The threshold name and size you specified identify the last-chance threshold. You cannot drop this threshold.PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_dropthreshold.Tables UsedREMAP="BO--Body"sysobjects, syssegments, systhresholds See Also System proceduresLINKEND="X96491"sp_addthreshold
MOREINFO="NONE", LINKEND="X29657"sp_dboption
MOREINFO="NONE", LINKEND="X52248"sp_helpthreshold
MOREINFO="NONE", LINKEND="X67172"sp_thresholdaction
ID="IN468139271"Droppinguser-defined datatype;User-defined datatypes:dropping
ID="IN462899672"sp_droptype system procedureID="X68983"sp_droptypeID="IN47999774"Datatypesdropping user-defined
Drops a user-defined datatype. FORMAT="LINESPECIFIC"sp_droptype MOREINFO="NONE"typename ParametersREMAP="RI--RefIndent"typename - is the name of a user-defined datatype that you own. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_droptype birthdayREMAP="UN--Under"Drops the user-defined datatype named birthday. CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_droptype deletes a user-defined datatype from ID="IN471479979"systypes table
systypes. A user-defined datatype cannot be dropped if tables or other database objects reference it. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"The type doesn't exist or you don't own it.REMAP="UN--Under"You do not own a user-defined datatype with that name. MOREINFO="NONE"Type is being used. You cannot drop it.REMAP="UN--Under"You cannot drop a user-defined datatype referenced by a table or other database object. Drop the tables and/or database objects first. MOREINFO="NONE"Type has been dropped.REMAP="UN--Under"The user-defined datatype no longer exists in the current database. PermissionsREMAP="BO--Body"Only the Database Owner or datatype owner can execute MOREINFO="NONE"sp_droptype. Tables UsedREMAP="BO--Body"syscolumns, sysobjects, systypes, sysusers See Also System procedures     LINKEND="X32817"sp_addtype
MOREINFO="NONE", LINKEND="X37949"sp_rename
ID="IN4728310384"sp_droptype system procedure
ID="IN478110585"Droppinguser-defined datatype;User-defined datatypes:dropping
 ID="IN4728-310986"sp_dropuser system procedureID="X46789"sp_dropuserID="IN488-511288"Droppinguser from a database;Users:dropping from databases
Drops a user from the current database. FORMAT="LINESPECIFIC"sp_dropuser MOREINFO="NONE"name_in_dbParametersREMAP="RI--RefIndent"name_in_db - is the user's name in the current database's sysusers table. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_dropuser albert REMAP="UN--Under"Drops the user "albert" from the current database. "albert" can no longer use the database. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_dropuser drops a user from the current database by deleting the user's row from sysusers. You cannot drop users who own objects in the database.You cannot drop users who have granted permissions to other users.You cannot drop the Database Owner from a database. ID="IN487-511293"Aliasesdropping;Names:aliasIf other users are aliased to the user being dropped, their aliases are also dropped. They no longer have access to the database. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"The dependent aliases were also dropped.REMAP="UN--Under"Other users were aliased to the user being dropped. Their aliases have been dropped, and they can no longer access the database. MOREINFO="NONE"No user with the specified name exists in the current database.REMAP="UN--Under"The specified user doesn't exist in the current database. MOREINFO="NONE"User has been dropped from current database.REMAP="UN--Under"The specified user is no longer known to the database. MOREINFO="NONE"You cannot drop the 'database owner'.REMAP="UN--Under"The name_in_db is that of the Database Owner. MOREINFO="NONE"You cannot drop the 'guest' user from master or tempdb.ID="IN4814-511295"Guest accountsguestREMAP="UN--Under"The "guest" user must exist in master and tempdb to allow the "guest" mechanism to work in other databases. MOREINFO="NONE"You cannot drop user because user 'name_in_db
'MOREINFO="NONE" owns objects in database.REMAP="UN--Under"Users who own objects in the current database cannot be dropped. Drop the owned objects first. A list of datatypes and their owners is appears after this message. MOREINFO="NONE"You cannot drop user because user 'name_in_db
'MOREINFO="NONE" owns thresholds in database.REMAP="UN--Under"Users who own thresholds in the current database cannot be dropped. Drop the owned thresholds first. MOREINFO="NONE"You cannot drop user because user 'name_in_db
'MOREINFO="NONE" owns types in database.REMAP="UN--Under"Users who own user-defined datatypes in the current database cannot be dropped. Drop the owned datatypes first. A list of datatypes and their owners is appears after this message. MOREINFO="NONE"You cannot drop user because he or she owns grantable privileges and granted them to other users. Use sp_helprotect for more information.REMAP="UN--Under"Remove the grantable permissions from the user before he or she can be dropped.PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_dropuser.Tables UsedREMAP="BO--Body"#sysprotects1, #sysprotects2, master.dbo.spt_values, sysalternates, syscolumns, sysobjects, sysprotects, syssegments, systhresholds, systypes, sysusersSee AlsoCommands     LINKEND="X69087"grant
MOREINFO="NONE", LINKEND="X29921"revoke
MOREINFO="NONE", LINKEND="X39034"useSystem procedures     LINKEND="X12007"sp_addalias
MOREINFO="NONE", LINKEND="X68639"sp_adduser
MOREINFO="NONE", LINKEND="X49053"sp_droplogin
ID="IN4828-911699"sp_dropuser system procedure
ID="IN488-11118100"Droppinguser from a database;Users:dropping from databases
 sp_estspaceID="IN4359573"Spaceestimating
ID="INA4369574"Tablesestimating space for
ID="IN4379575"Indexesestimating space and time requirements
ID="IN43139576"Time intervalestimating index creation
Estimates the amount of space required for a table and its indexes, and the time needed to create the index.FORMAT="LINESPECIFIC"sp_estspace table_name, no_of_rows [, fill_factor[, cols_to_max [, textbin_len [, iosec]]]]ParametersREMAP="RI--RefIndent"table_name - is the name of the table. It must already exist, and be in the current database.no_of_rows - is the estimated number of rows that the table will contain.fill_factor - is the index fillfactor. The default is null, which means the SQL Server uses its default fillfactor.cols_to_max - is a comma-separated list of the variable length columns for which to use the maximum length instead of the average. The default is to use the average declared length of the variable-length columns.textbin_len -  is the length of all text and image columns, per row. The default value is 0. You only need to provide a value if the table stores text and/or image data. text and image columns are stored in a separate set of data pages from the rest of the table's data. The actual table row stores a pointer to the text or image value. MOREINFO="NONE"sp_estspace provides a separate line of information about the size of the text/image pages for a row.iosec - is the number of disk I/Os per second on this machine. The default is 30 I/Os per second.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_estspace titles, 10000, 50, "title,notes", 0, 25REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"name             type         idx_level Pages        Kbytes       ---------------- ------------ --------- ------------ ------------ titles           data                 0         3364         6728 titles           text/image           0            0            0 titleidind       clustered            0           21           43 titleidind       clustered            1            1            2 titleind         nonclustered         0         1001         2002 titleind         nonclustered         1           54          107 titleind         nonclustered         2            4            8 titleind         nonclustered         3            1            2  Total_Mbytes      -----------------              8.68  name               type         total_pages  time_mins    ------------------ ------------ ------------ ------------ titleidind         clustered            3386           13 titleind           nonclustered         1060            5 titles             data                    0            2 REMAP="UN--Under"Calculates the space requirements for the titles table and its indexes, and the time required to create the indexes. The number of rows is 10,000, the fillfactor 50%, two variable-length columns are to be computed using the maximum size for the column, and the disk I/O speed is 25 I/Os per second.declare @i intselect @i =  avg(datalength(pic)) from au_pixexec sp_estspace au_pix, 1000, null, null, @iREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"au_pix has no indexes name            type         idx_level Pages     Kbytes     --------------- ------------ --------- --------- ---------  au_pix          data                 0        31        63  au_pix          text/image           0     21000     42000   Total_Mbytes       -----------------              41.08 REMAP="UN--Under"Uses the average length of existing image data in the au_pix table to calculate the size of the table with 1,000 rows. You can also provide this size as a constant.sp_estspace titles, 50000REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"name             type         idx_level Pages        Kbytes        --------------- ------------ --------- ------------ ------------  titles          data                 0         4912         9824  titleidind      clustered            0           31           61  titleidind      clustered            1            1            2  titleind        nonclustered          0         1390         2780  titleind        nonclustered          1           42           84  titleind        nonclustered         2            2            4  titleind        nonclustered         3            1            2   Total_Mbytes       -----------------              12.46   name               type         total_pages  time_mins     ------------------ ------------ ------------ ------------  titleidind         clustered            4943           19  titleind           nonclustered         1435            8  REMAP="UN--Under"Calculates the size of the titles table with 50,000 rows, using defaults for all other values.ID="X46688"CommentsMARK="BULL" REMAP="BU--Bullet"To estimate the amount of space required by a table and its indexes:NUMERATION="ARABIC" REMAP="S1--StepOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"Create the table.Create all indexes on the table.Run MOREINFO="NONE"sp_estspace, giving the table name, the estimated number of rows that the table will contain, and the optional arguments, as needed. REMAP="UN--Under"You do not need to insert data into the tables. MOREINFO="NONE"sp_estspace uses information in the system tables-not the size of the data in the tables-to calculate the size of tables and indexes.If the MOREINFO="NONE"auto identity option is turned on in a database, SQL Server automatically defines a 10-digit IDENTITY column in each new table that is created without specifying a MOREINFO="NONE"primary key, a MOREINFO="NONE"unique constraint, or an IDENTITY column. To estimate how much extra space is required by this column:NUMERATION="ARABIC" REMAP="S1--StepOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"In the master database, use MOREINFO="NONE"sp_dboption to turn on the MOREINFO="NONE"auto identity option for the database.Create the table.Run MOREINFO="NONE"sp_estspace on the table and record the results.Drop the table.Turn the MOREINFO="NONE"auto identity option off for the database.Recreate the table.Rerun MOREINFO="NONE"sp_estspace on the table and record the results.For information about tables or columns, use MOREINFO="NONE"sp_help MOREINFO="NONE"tablenameMOREINFO="NONE".MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object does not exist in this database.REMAP="UN--Under"MOREINFO="NONE"sp_estspace can be used only on tables that already exist in the current database. MOREINFO="NONE"Table contains text/image type columns. You must specify the total length per row for these columns in the argument list.REMAP="UN--Under"The table you specified contains text or image columns.  Specify a length for these columns as the fifth argument. See Example 2
.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_estspace.Tables UsedREMAP="BO--Body"#col_table, #results, #times, syscolumns, sysindexes, sysobjects See Also Commands     LINKEND="X58868"create index
, LINKEND="X80969"create table
 System procedures     LINKEND="X91431"sp_helpTopics     LINKEND="X39672"text and image Datatypes
ID="IN4328911115"sp_estspace system procedure
ID="IN435901216"Spaceestimating
ID="IN4333861617"sp_extendsegment system procedureID="X53708"sp_extendsegment
Extends the range of a segment to another database device, or extends an existing segment on the current database device. FORMAT="LINESPECIFIC"sp_extendsegment MOREINFO="NONE"segname, MOREINFO="NONE"dbname, devname ParametersREMAP="RI--RefIndent"segname - is the name of the existing segment, previously defined with MOREINFO="NONE"sp_addsegment. dbname - is the name of the database on which to extend the segment. dbname must be the name of the current database.devname - is the name of the database device to add to the current database device range already included in segname. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_extendsegment indexes, pubs2, dev2 REMAP="UN--Under"This command extends the range of the segment indexes for the database pubs2 on the database device dev2. CommentsID="IN4420822123"create table commandsp_extendsegment andMARK="BULL" REMAP="BU--Bullet"After defining a segment, you may use it in the MOREINFO="NONE"create tableID="IN4420782524"create index commandsp_extendsegment and
 and MOREINFO="NONE"create index commands to place the table or index on the segment. If you create a table or index on a particular segment, all the subsequent data for the table or index is located on the segment. To associate a segment with a database device, create or alter the database with a reference to that device. A database device can have more than one segment associated with it. ID="IN4418782525"Extending segmentsextendingA segment can be extended over several database devices. When you extend the logsegment, SQL Server recalculates its last-chance threshold.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_extendsegment from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_extendsegment updates system tables, so it cannot be run from within a transaction.MOREINFO="NONE"Device 'devname
'MOREINFO="NONE" is now exclusively used by 'segname'MOREINFO="NONE".'devname
'MOREINFO="NONE" is reserved exclusively as a log device.REMAP="UN--Under"You can't create a segment on a database device that is dedicated to the database log. MOREINFO="NONE"No such device exists -- run sp_helpdb to list the devices for the current database.REMAP="UN--Under"The named device doesn't exist in master.dbo.sysdevices. MOREINFO="NONE"Segment extended.REMAP="UN--Under"MOREINFO="NONE"sp_extendsegment succeeded. The segment named segname now includes space on the database device devname. 'segname
'MOREINFO="NONE" is not a valid identifier.REMAP="UN--Under"Segment names must conform to the rules for identifiers. They must begin with a letter, an underscore character ( _ ), or a pound sign (#). After the first character, identifiers may include letters, underscores, pound signs, or dollar signs ($). MOREINFO="NONE"The specified device is not used by the database.REMAP="UN--Under"Although the device named as the devname parameter exists in master.dbo.sysdevices, it is not used by the specified database. Segments may only be extended on database devices used by the database. Use MOREINFO="NONE"alter database to extend a database on a device listed in the master.dbo.sysdevices table. MOREINFO="NONE"There is no such segment as 'segname
'MOREINFO="NONE".REMAP="UN--Under"The segment you have tried to extend does not exist. All segments for a database are listed in the syssegments table. Run MOREINFO="NONE"sp_helpsegment to list them. MOREINFO="NONE"This command has been ignored. Extending the log segment on device 'devname
'MOREINFO="NONE" would leave no space for creating objects in database 'database_name
'MOREINFO="NONE".REMAP="UN--Under"devname is the only, or the last, database device with space available for the database database_name.MOREINFO="NONE"You must execute this procedure from the database in which you wish to add a segment. Please execute `use database_name
'MOREINFO="NONE" and try again.REMAP="UN--Under"MOREINFO="NONE"sp_extendsegment can extend segments only in the database you are currently using. Issue the MOREINFO="NONE"use command to open the database in which you want to extend a segment. Then run MOREINFO="NONE"sp_extendsegment again.PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_extendsegment. Tables UsedREMAP="BO--Body"master.dbo.sysdatabases, sysdevices, master.dbo.sysusages, sysobjects, syssegments See Also Commands     LINKEND="X61977"alter database
, LINKEND="X58868"create index
, LINKEND="X80969"create table
 System proceduresLINKEND="X62957"sp_addsegment
, LINKEND="X10014"sp_dropsegment
, LINKEND="X90458"sp_helpdb
, LINKEND="X11789"sp_helpdevice
, LINKEND="X36403"sp_helpsegment
, LINKEND="X20401"sp_placeobject
ID="IN4433742930"sp_extendsegment system procedure
 ID="IN4430703331"sp_foreignkey system procedureID="X50021"sp_foreignkeyID="IN4512703433"Foreign keysdefining
Defines a foreign key on a table or view in the current database. FORMAT="LINESPECIFIC"sp_foreignkey tabname, MOREINFO="NONE"pktabname, MOREINFO="NONE"col1 [, MOREINFO="NONE"col2] ... [, MOREINFO="NONE"col8] ParametersREMAP="RI--RefIndent"tabname - is the name of the table or view that contains the foreign key. pktabname - is the name of the table or view that has the primary key to which the foreign key applies. The primary key must already be defined. ID="IN457683636"Columnssp_foreignkey
col1 - is the name of the first column that makes up the foreign key. The foreign key must consist of at least one column, and can have a maximum of eight columns. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_foreignkey titles, publishers, pub_id REMAP="UN--Under"The primary key of the publishers table is the pub_id column. The titles table also contains a pub_id column, which is a foreign key of publishers. sp_foreignkey orders, parts, part, subpart ID="IN4512663838"Primary keyssp_foreignkey andREMAP="UN--Under"The primary key of the parts table has been defined with ID="IN4530624239"sp_primarykey system proceduresp_foreignkey and
MOREINFO="NONE"sp_primarykey as the partnumber and subpartnumber columns. The orders table contains the columns part and subpart, which make up a foreign key of parts. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_foreignkeyID="IN4513584641"syskeys tablesp_foreignkey and
ID="IN4511564842"Keys, tablesyskeys table
 adds the key to the syskeys table.  ID="IN4541564843"Database design, logical relationships inKeys make explicit a logical relationship that is implicit in your database design. The number and order of columns that make up the foreign key must be the same as the number and order of columns that make up the primary key. The datatypes (and the lengths) of the primary and foreign keys must agree, but the nulltypes need not agree. The installation process runs MOREINFO="NONE"sp_foreignkey procedure on the appropriate columns of the system tables. To display a report on the keys that have been defined, execute MOREINFO="NONE"sp_helpkey. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Datatypes of the column 'column_name
' MOREINFO="NONE"in the keys are different.REMAP="UN--Under"The datatypes of the columns of the foreign key of tabname and the primary key of pktabname must be the same. MOREINFO="NONE"Foreign key table doesn't exist.REMAP="UN--Under"The table or view specified with the tabname parameter doesn't exist in the current database. MOREINFO="NONE"New foreign key added.REMAP="UN--Under"The foreign key has been defined and added to syskeys.MOREINFO="NONE"Only the owner of the table may define a foreign key.REMAP="UN--Under"You are not the owner of the table or view. MOREINFO="NONE"Primary key does not exist with the same number of columns as the foreign key. REMAP="UN--Under"The number of columns in the foreign key of tabname and in the primary key of pktabname must be the same. MOREINFO="NONE"Primary key table doesn't exist.REMAP="UN--Under"The table or view specified with the pktabname parameter doesn't exist in the current database, or doesn't have a primary key defined. MOREINFO="NONE"Table or view name must be in current database.REMAP="UN--Under"You cannot add foreign keys to a table or view in a different database.MOREINFO="NONE"The table does not have a column named 'column_name
'MOREINFO="NONE".REMAP="UN--Under"The table or view specified with the tabname parameter does not have a column of the specified name. MOREINFO="NONE"Primary key does not exist.REMAP="UN--Under"The primary key specified with the col1-col8 parameters doesn't exist in the primary key table, or is not defined.PermissionsREMAP="BO--Body"You must be the owner of the table or view in order to define its foreign key.Tables UsedREMAP="BO--Body"#spconstrtab, syscolumns, sysindexes, syskeys, sysobjects, sysreferences See Also Commands     LINKEND="X19955"create trigger
 System procedures     LINKEND="X22659"sp_commonkey
, LINKEND="X18196"sp_dropkey
, LINKEND="X44026"sp_helpkey
, LINKEND="X90336"sp_helpjoins
, LINKEND="X43109"sp_primarykey
ID="IN4530525248"sp_foreignkey system procedure
 ID="IN4530485649"sp_getmessage system procedureID="X61947"sp_getmessageID="IN4610485751"Retrievingerror message text
ID="IN468456052"Messagessp_getmessage procedure
ID="IN4617436253"sysmessages tableerror message text
Retrieves stored message strings from sysmessagesID="IN4621416454"sysusermessages tableerror message text
 and sysusermessages for MOREINFO="NONE"print and MOREINFO="NONE"raiserrorID="IN4652376855"Getting messages. See sp_getmessage system procedure
 statements. FORMAT="LINESPECIFIC"sp_getmessage MOREINFO="NONE"message_num, MOREINFO="NONE"@msg_var output [, MOREINFO="NONE"language]ParametersREMAP="RI--RefIndent"ID="IN4614376858"Message numbermessage
message_num - is the message number of the message to be retrieved. ID="IN4639297659"Message output parameter, sp_getmessagesp_getmessage
@msg_var MOREINFO="NONE"output- is the variable that receives the returned message text, followed by a space and the keyword MOREINFO="NONE"output. The variable must have a datatype of char, MOREINFO="NONE"nchar, varchar, or MOREINFO="NONE"nvarchar. ID="IN468277860"Languagesp_getmessage;Messages:language setting for
language - is the language of the message to retrieve. Must be a valid language name in syslanguages table. If you include language, the message with the indicated message_num and language is retrieved. If not included, then the message for the default session language as indicated by the variable @@langid is retrieved. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_getmessage 20001, @myvar outputREMAP="UN--Under"Retrieves the message with the number 20001 from sysusermessages. CommentsMARK="BULL" REMAP="BU--Bullet"Any appliacation can use MOREINFO="NONE"sp_getmessage, and any user can read the messages stored in sysmessages and sysusermessages. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Message number must be greater than or equal to 17000.REMAP="UN--Under"You specified an invalid message_num.'language
'MOREINFO="NONE" is not an official language name from syslanguages.REMAP="UN--Under"The language given is not a valid name in the syslanguages table. MOREINFO="NONE"Message number message_number
MOREINFO="NONE" does not exist in the language
MOREINFO="NONE" language.REMAP="UN--Under"The message number given does not exist in the language indicated. PermissionsREMAP="BO--Body"Any user can issue MOREINFO="NONE"sp_getmessage. Tables UsedREMAP="BO--Body"master.dbo.syslanguages, master.dbo.sysmessages, sysobjects, sysusermessages See Also Commands     LINKEND="X69372"print
, LINKEND="X60573"raiserror
 System procedures     LINKEND="X36529"sp_addmessage
, LINKEND="X40499"sp_dropmessage
ID="IN4630238267"sp_getmessage system procedure
ID="IN468208568"Messagessp_getmessage procedure
 Topics     LINKEND="X44102"Variables (Local and Global)REMAP="BO--Body"ID="X91431"sp_helpID="IN431689134"Database objectssp_help and;Datatypes:sp_help information on
ID="IN432089135"Information (Server)database objects
ID="IN431689136"Database objectslistings of;Help reports:database object
Reports information about a database object (any object listed in sysobjectsID="IN432089137"Information (Server)datatypesID="IN434486168"Objects. See Database objects; DatabasesID="IN43983199"DatabasesDatabasesSee also Database objects!see also Database objectsID="IN4312802210"Help reportsHelp reportsSee also Information (Server); System procedures!see also Information (Server); System proceduresID="IN4328772511"Object. See Database objectsID="IN4342742812"User-created objects. See Database objects), and about SQL Server-supplied or user-defined datatypes. FORMAT="LINESPECIFIC"sp_help [MOREINFO="NONE"objname]ParametersREMAP="RI--RefIndent"objname - is the name of any object in sysobjects or of any user-defined datatype or system datatype in systypes. You cannot specify database names. objname can include tables, views, stored procedures, logs, rules, defaults, triggers, referential constraints, and check constraints. Use owner names if the object owner is not the user running the command and not the dbo.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpREMAP="UN--Under"Displays a brief listing of each object in sysobjects, giving the object's name, owner, and object type, and a brief listing of each user-defined datatype in systypes, giving the datatype's name, storage type, length, nulltype, default name, and rule name. Nulltype is 0 if null values are not permitted, 1 if null values are allowed. sp_help publishersREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Name                         Owner       Type REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"--------------------------   ----------  --------publisher                    dbo         user table Data_located_on_segment         When_created ------------------------------  -------------------default                         Jan  1 1900 12:00AM Column_name  Type     Length  Prec   ScaleREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"----------   -------  ------  -----  ----- pub_id       char        4    NULL   NULLpub_name     varchar     40   NULL   NULLcity         varchar     20   NULL   NULLstate        char        2    NULL   NULL Nulls        Default_name   Rule_name      Identity-----        ------------   ----------      --------    0        NULL            NULL                0    1        NULL            NULL                0    1        NULL            NULL                0    1        NULL            NULL                0 index_name       index_description                     index_keys--------------   -------------------------------       -------pubind           clustered, unique located on default  pub_id (1 row affected)keytype   object      related_object   object_keysrelated_keys-------   ----------  --------------   ---------------------------------------------------primary   publishers   -- none --   pub_id, *, *, *, *, *, *, **, *, *, *, *, *, *, *foreign   titles       publishers   pub_id, *, *, *, *, *, *, *pub_id, *, *, *, *, *, *, * (return status = 0)REMAP="UN--Under"Displays information about the publishers table.sp_help "mary.marytrig"REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Name         Owner             Type             ------------ ------------------ ---------------- marytrig     mary              trigger         Data_located_on_segment When_created        ----------------------- -------------------------- not applicable          Mar 20 1992  2:03PMREMAP="UN--Under"Displays information about the trigger marytrig owned by user mary. The quotes are needed, since "." is a special character.sp_help moneyREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Type_name  Storage_type Length Prec  Scale  ---------- ------------ ------ ----- -----money      money            8  NULL  NULLREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Nulls   Default_name  Rule_name   Identity-----   ------------  ---------   --------     1   NULL          NULL               0 (return status = 0)REMAP="UN--Under"Displays information about the system datatype money. sp_help identypeREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Type_name  Storage_type Length Nulls Default_name    --------- ------------- ------ ----- ----------  identype   numeric           4     0 NULL            REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Rule_name       Identity ---------       --------NULL                   1 (return status = 0)REMAP="UN--Under"Displays information about the user-defined datatype identype. The report indicates the base type from which it was created, whether or not it allows nulls, the names of any rules and defaults bound to the datatype, and whether it has the IDENTITY property.CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_help looks for an object in the current database only.ID="IN4316742817"Database objectsfinding;Finding database objects:rules for;Rules:for finding objects
MOREINFO="NONE"sp_help follows SQL Server's rule for finding objects:MARK="DASH" REMAP="BS--BulletSub"If you don't specify an owner name, and you own an object with the specified name, MOREINFO="NONE"sp_help uses that object. If you don't specify an owner name, and don't own an object of that name, but the dbo does, MOREINFO="NONE"sp_help uses the dbo's object.  If neither you nor the dbo owns an object of that name, MOREINFO="NONE"sp_help reports an error condition, even if an object exists in the database with that object name, but different owner.If you and the dbo both own objects with the specified name, and you want to access the dbo's object, specify the name in the format dbo.objectname.Qulaify objects owned by database users other yourself and the dbo with the owner's name, as in Example 3.ID="IN4316723018"Temporary tablessp_help and
MOREINFO="NONE"sp_help works on temporary tables if you issue it from tempdb. MOREINFO="NONE"sp_help lists any indexes on a table, including indexes created by defining unique or primary key constraints in the MOREINFO="NONE"create table or MOREINFO="NONE"alter table statements. However, it does not describe any information about the integrity constraints defined for a table. Use MOREINFO="NONE"sp_helpconstraint for information about any integrity constraints.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object does not exist in this database.REMAP="UN--Under"The specified object does not exist in the current database. MOREINFO="NONE"Object must be in your current database.REMAP="UN--Under"MOREINFO="NONE"sp_help only gives information about objects in the current database. Use MOREINFO="NONE"sp_helpdb for information on the database itself. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_help.Tables UsedREMAP="BO--Body"master.dbo.spt_values, syscolumns, sysindexes, sysmessages, sysobjects, systypesSee AlsoSystem procedures     LINKEND="X80872"sp_helpconstraint
, LINKEND="X90458"sp_helpdb
, LINKEND="X87980"sp_helpindex
, LINKEND="X44026"sp_helpkey
, LINKEND="X22708"sp_helprotect
, LINKEND="X36403"sp_helpsegment
, LINKEND="X28192"sp_helpuser
ID="IN4334683423"sp_helpconstraint system procedureID="X80872"sp_helpconstraintID="IN4411683525"Constraintsinformation about
ID="IN446683526"Tablesconstraint information
Reports information about any integrity constraints specified for a table. This information includes the constraint name and the definition of the default, unique/primary key constraint, referential constraint, or check constraint. FORMAT="LINESPECIFIC"sp_helpconstraint MOREINFO="NONE"tabname [, detail]ParametersREMAP="RI--RefIndent"tabname - is the name of a table which has one or more integrity constraints defined by a MOREINFO="NONE"create table or MOREINFO="NONE"alter table statement.ID="IN4432643929"detail option, sp_helpconstraint
MOREINFO="NONE"detail - returns information about the constraint's user or error messages.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpconstraint statesREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"name                       defn------------------------   --------------------------------states_popula_1088006907   CHECK (population > 1000000)stateconstr                PRIMARY KEY INDEX (rank, abbrev): CLUSTERED,                            FOREIGN REFERENCEinfoconstr                 state_info FOREIGN KEY (rank, abbrev)                           REFERENCES states (rank, abbrev) (3 rows affected, return status = 0)REMAP="UN--Under"Displays the constraint information for the table states. states also has a foreign key to the table state_info. states and state_info are defined as follows:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"create table states(rank        smallint,abbrev       char(2),name         varchar(20) null,population   int check (population > 1000000),constraint   stateconstr primary key (rank, abbrev)) create table state_info(rank        smallint,abbrev       char(2),description  char(255),comments     char(255) default "None",constraint infoconstr foreign key (rank, abbrev)     references states (rank, abbrev))sp_helpconstraint state_info, detailREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"name            type            defn      msg-------------   -------------   --------  ---------state_info_commen_1200007306                default value   DEFAULT "None"                                          NULL infoconstr             referential constraint------------------     ----------------------------state_info FOREIGN KEY (rank, abbrev)                       REFERENCES states (rank, abbrev)                      standard system error message number: 547 (2 rows affected, return status = 0)REMAP="UN--Under"Displays more detailed information about the state_info constraints, including the constraint type and any constraint error messages.CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_helpconstraint prints the name and definition of the integrity constraint. The MOREINFO="NONE"detail option returns information about the constraint's user or error messages.You can use MOREINFO="NONE"sp_helpconstraint only for tables in the current database.MOREINFO="NONE"sp_helpconstraint reports only the integrity constraint information about a table (defined by a MOREINFO="NONE"create table or MOREINFO="NONE"alter table statement). It does not report information about rules, triggers, or indexes created using the MOREINFO="NONE"create index statement. Use MOREINFO="NONE"sp_help to see information about rules, triggers, and indexes for a table.For constraints that do not have user defined messages, SQL Server reports the system error message associated with the constraint. Query sysmessages to obtain the actual text of that error message.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object must be in current database.REMAP="UN--Under"MOREINFO="NONE"sp_helpconstraint only provides information about objects in the current database. Use MOREINFO="NONE"sp_helpdb for information about the database itself.MOREINFO="NONE"Object does not exist in this database.REMAP="UN--Under"The table you specified does not exist in the current database.MOREINFO="NONE"Object does not have any declarative constraints.REMAP="UN--Under"The specified object does not have any integrity constraints. Note that MOREINFO="NONE"sp_helpconstraint only reports information about constraints defined by the MOREINFO="NONE"create table or MOREINFO="NONE"alter table statements.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpconstraint.Tables UsedREMAP="BO--Body"syscolumns, syscomments, sysconstraints, sysindexes, sysobjects, sysreferences, sysusermessagesSee AlsoSystem procedures     LINKEND="X91431"sp_help
, LINKEND="X90458"sp_helpdb
ID="IN4426604336"sp_helpdb system procedureID="X90458"sp_helpdbID="IN4516584638"Device fragmentssp_helpdb report on
ID="IN459584639"Databaseslisting of;Information (Server):databases
ID="IN4552554940"Server information options. See Information (Server)
ID="IN4551525241"System procedures results. See Information (Server)
Reports information about a particular database or about all databases. FORMAT="LINESPECIFIC"sp_helpdb [MOREINFO="NONE"dbname] ParametersREMAP="RI--RefIndent"dbname - is the name of the database about whichto report information. Without  this optional parameter MOREINFO="NONE"sp_helpdb issues  a report about all databases. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpdb pubs2 REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"name   db_size owner dbid   created      statusREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC" ----- ------- ----- ----  ------------ ----------------------  pubs2 2.0 MB  sa    4     Mar 05, 1993 aborttranwhenlogfull  device_fragments     size      usage               free kbytes -----------------     ------   ---------            ------------- master               2.0 MB   data and log         576   device                         segment                         ------------------------------ ------------------------------  master                         default                         master                         logsegment                      master                         system                         REMAP="UN--Under"Displays information about the pubs2 database.sp_helpdb REMAP="UN--Under"Displays information about all the databases on SQL Server, but does not include the device_fragments and usage columns. CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_helpdb reports on the specified database when dbname is given, or on all databases in master.dbo.sysdatabases when no parameter is supplied. Executing MOREINFO="NONE"sp_helpdb dbname from dbname reports segment information in addition to the information shown in the examples. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"The specified database does not exist.REMAP="UN--Under"The specified database doesn't exist on SQL Server. Run MOREINFO="NONE"sp_helpdb without the dbname parameter to see a list of all the databases. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpdb.Tables UsedREMAP="BO--Body"master.dbo.spt_values, sysdatabases, sysdevices, syslogins, sysmessages, syssegments, sysusages, #spdbdesc See AlsoCommands     LINKEND="X61977"alter database
, LINKEND="X75308"create databaseSystem procedures     LINKEND="X60334"sp_configure
, LINKEND="X29657"sp_dboption
, LINKEND="X99854"sp_renamedb
ID="IN4526485650"sp_helpdb system procedure
 ID="IN4530446051"sp_helpdevice system procedureID="X11789"sp_helpdeviceID="INA4616426353"Database deviceslisting of;Database devices:sp_helpdevice system procedure
ID="INA4620426354"Information (Server)database devices
Reports information about a particular device or about all SQL Server database devices and dump devices. FORMAT="LINESPECIFIC"sp_helpdevice [MOREINFO="NONE"device_name]ParametersREMAP="RI--RefIndent"device_name - is the name of the device about which to report information. If you omit this parameter, information on all the devices appears. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpdevice REMAP="UN--Under"Displays information about all the devices on SQL Server. REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"device_name      physical_name  description------------     -------------- --------------------------diskdump         null           disk, dump device master           d_master       special, default disk, physical disk, 10 MB           status    cntrltype   device_number    low     high           ------    ----------  -------------    ----    -----           16        2           0                0       20000           3         0           0                0       5120 sp_helpdevice diskdump REMAP="UN--Under"Reports information about the dump device named diskdump.CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_helpdevice displays information on the specified device when device_name is given, or on all devices in ID="IN4616406559"sysdevices table
master.dbo.sysdevices when no argument is given. ID="IN4620406560"Information (Server)dump devices
ID="IN4612406561"Dump deviceslistingThe sysdevices table contains dump devices (tapes or disks to which you can dump databases with MOREINFO="NONE"dump database and transaction logs with MOREINFO="NONE"dump transaction) and database devices (devices on which databases are stored). REMAP="UN--Under"Database devices can be designated default devices, which means that they can be used for database storage. This can occur when a user issues MOREINFO="NONE"create database or MOREINFO="NONE"alter database and does not specify a database device name, or gives the keyword MOREINFO="NONE"defaultID="IN4616406562"Default databaseinformation
. To make a database device a default database device, execute the system procedure MOREINFO="NONE"sp_diskdefault. Add database devices to the system with MOREINFO="NONE"disk init.Add dump devices with MOREINFO="NONE"sp_addumpdevice. ID="IN4625406563"Controller number, devicedeviceThe number in the status column corresponds to the status description in the description column. REMAP="UN--Under"The cntrltype column specifies the controller number of the device. The cntrltype is 2 for disk or file dump devices, and 3 - 8 for tape dump devices. For database devices, it is almost always 0 (unless your installation has a special type of disk controller). REMAP="UN--Under"The device_number column is 0 for dump devices, 0 for the master database device, and between 1 and 255 for other database devices. REMAP="UN--Under"The low and highID="IN4620406564"Virtual page numbers
 columns represent virtual page numbers, each of which is unique among all the devices on SQL Server. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"No such i/o device exists.REMAP="UN--Under"The device name supplied for the device_name parameter doesn't exist on SQL Server. Run the procedure without the device_name parameter to see a list of all devices. PermissionsREMAP="BO--Body"Any user can executeMOREINFO="NONE" sp_helpdevice. Tables UsedREMAP="BO--Body"master.dbo.spt_values, sysdevices, sysmessages, #spdevtab See AlsoCommands     LINKEND="X64061"disk init
, LINKEND="X68345"dump database
, LINKEND="X47924"dump transaction
, LINKEND="X28090"load database
, LINKEND="X75212"load transactionSystem procedures     LINKEND="X85886"sp_addumpdevice
, LINKEND="X60334"sp_configure
, LINKEND="X92302"sp_diskdefault
, LINKEND="X57787"sp_dropdevice
, LINKEND="X90458"sp_helpdb
, LINKEND="X21496"sp_logdevice
, LINKEND="X89868"sp_who
ID="IN4630366969"sp_helpdevice system procedure
 ID="IN4629327370"sp_helpgroup system procedureID="X25329"sp_helpgroupID="IN476327472"Groupsinformation on;Information (Server):groups
Reports information about a particular group or about all groups in the current database. FORMAT="LINESPECIFIC"sp_helpgroup [MOREINFO="NONE"grpname]ParametersREMAP="RI--RefIndent"grpname - is the name of a group in the database created with MOREINFO="NONE"sp_addgroup. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpgroup hackers REMAP="UN--Under"Displays information about the group "hackers": REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Group_name   Group_id    Users_in_group    Userid -----------  ---------   --------------    ------ hackers      16384       ann               4 hackers      16384       judy              3 sp_helpgroup REMAP="UN--Under"Displays information about all the groups in the current database: REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Group_name         Group_id ---------------    -------- hackers            16384 public             0 CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_helpgroup reports on the specified group or, if no parameter is supplied, on all groups in the database. ID="IN4714307677""public" grouppublic groupsp_helpgroup report onsp_helpgroup report on
ID="IN4723277978"User groups. See Groups
ID="IN4714277979""public" grouppublic groupinformation reportinformation report
ID="IN4714248280""public" grouppublic groupSee also Groups!see also GroupsTo get a report on the default group, "public," enclose the name "public" in single or double quotes ("public" is a reserved word). MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"No group with the specified name exists.REMAP="UN--Under"The specified group does not exist in the current database. Execute the procedure without the grpname parameter to see a list of all the groups in the database. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpgroup. Tables UsedREMAP="BO--Body"syssrvroles, sysusers See AlsoCommands     LINKEND="X69087"grant
, LINKEND="X29921"revoke
 System procedures     LINKEND="X65925"sp_addgroup
, LINKEND="X18596"sp_changegroup
, LINKEND="X17416"sp_dropgroup
, LINKEND="X22708"sp_helprotect
, LINKEND="X28192"sp_helpuser
ID="IN4729208685"sp_helpgroup system procedure
 ID="IN4729169086"sp_helpindex system procedureID="X87980"sp_helpindexID="IN487169188"Indexesinformation on;Information (Server):indexes
Reports information about the indexes created on a table. FORMAT="LINESPECIFIC"sp_helpindex MOREINFO="NONE"tabname ParametersREMAP="RI--RefIndent"tabname - is the name of a table in the current database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpindex sysobjectsREMAP="UN--Under"Displays the types of indexes on the sysobjects table: REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"index_name      index_description                    index_keys ------------    -----------------------------------  ---------- titleidind      clustered, unique located on default title_id titleind        nonclustered located on default      title (2 rows affected, return status = 0)CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_helpindex lists any indexes on a table, including indexes created by defining unique or primary key constraints of the MOREINFO="NONE"create table or MOREINFO="NONE"alter table ID="IN4811139493"Keys, tableKeys, tableSee also Common keys; Indexes!see also Common keys; Indexes
ID="IN485109794"OrderOrderSee also Indexes; Precedence; Sort order!see also Indexes; Precedence; Sort order
statements. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object does not exist in this database.REMAP="UN--Under"The name you gave for the tabname parameter does not exist in the current database. MOREINFO="NONE"Object does not have any indexes.REMAP="UN--Under"The table you named has no indexes. MOREINFO="NONE"Object must be in the current database.REMAP="UN--Under"The name you gave for the tabname parameter includes a database reference. Name references must be local to the current database. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpindex.Tables UsedREMAP="BO--Body"master.dbo.spt_values, sysindexes, sysobjects, syssegments, #spindtab See AlsoCommands     LINKEND="X58868"create index
, LINKEND="X93093"drop index
, LINKEND="X42677"update statistics
 System procedures     LINKEND="X91431"sp_help
, LINKEND="X44026"sp_helpkey
ID="IN4829610199"sp_helpindex system procedure
 ID="X90336"sp_helpjoinsID="INA43209663"Information (Server)join columns;Joins:information on
ID="IN43339394"Column pairs. See Joins; Keys
Lists the columns in two tables or views that are likely join candidates. FORMAT="LINESPECIFIC"sp_helpjoins MOREINFO="NONE"lefttab, MOREINFO="NONE"righttab ParametersREMAP="RI--RefIndent"lefttab - is the first table or view. righttab - is the second table or view. The order of the parameters does not matter. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpjoins sysobjects, syscolumns ID="IN4379398"Columnsjoins andREMAP="UN--Under"Displays a list of columns that are likely join candidates in the tables sysobjects and syscolumns: REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"a1                a2        b1              b2        c1              c2        d1              d2        e1              e2        f1              f2        g1              g2        h1              h2id                id        NULL            NULL        NULL            NULL        NULL            NULL        NULL            NULL        NULL            NULL        NULL            NULL        NULL            NULLCommentsID="IN4311911110"Common keyssp_helpjoins andMARK="BULL" REMAP="BU--Bullet"The column pairs that MOREINFO="NONE"sp_helpjoins displays come from either of two sources. First, MOREINFO="NONE"sp_helpjoins checks the syskeys table in the current database to see if any foreign keys have been defined on the two tables with MOREINFO="NONE"sp_foreignkey, and then checks to see if any common keys have been defined on the two tables with MOREINFO="NONE"sp_commonkey. If it doesn't find any foreign keys or common keys there, the procedure looks for any keys that may be reasonably joined: it checks for keys with the same user-defined datatypes, and if that fails, for columns with the same name and datatype. The MOREINFO="NONE"sp_helpjoins procedure does not create any joins. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"First table doesn't exist.REMAP="UN--Under"The table specified as the lefttab parameter is not a table or view in the current database. MOREINFO="NONE"Object must be in the current database.REMAP="UN--Under"lefttab and righttab must both be local to your current database. MOREINFO="NONE"Second table doesn't exist.REMAP="UN--Under"The table specified as the righttab parameter is not a table or view in the current database. PermissionsREMAP="BO--Body"Any user can issue MOREINFO="NONE"sp_helpjoins. Tables UsedREMAP="BO--Body"#hjtab, syscolumns, syskeys, sysobjectsSee Also System procedures     LINKEND="X22659"sp_commonkey
, LINKEND="X50021"sp_foreignkey
, LINKEND="X91431"sp_help
, LINKEND="X44026"sp_helpkey
, LINKEND="X43109"sp_primarykey
ID="IN4329871515"sp_helpjoins system procedure
 Topics     LINKEND="X70715"Joins
 ID="IN4327831916"sp_helpkey system procedureID="X44026"sp_helpkeyID="IN4420832018"Information (Server)keys;Keys, table:information on
ID="IN4412812219"Primary keyssp_helpkey and
ID="IN4412792420"Foreign keyssp_helpkey and
ID="IN4411772621"Common keyssp_helpkey and
Reports information about a primary, foreign, or common key of a particular table or view, or about all keys in the current database. FORMAT="LINESPECIFIC"sp_helpkey [MOREINFO="NONE"objname]ParametersREMAP="RI--RefIndent"objname - is the name of a table or view in the current database. If you don't specify a name, the procedure reports on all keys defined in the current database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpkey REMAP="UN--Under"Displays information on the keys defined in the current database: REMAP="COW10--CompOutWide10pt" FORMAT="LINESPECIFIC"keytype   object      related_object   object_keysrelated_keys-------   -------     --------------   -------------       ---------primary   authors     -- none --       au_id,*,*,*,*,*,*,* *,*,*,*,*,*,*,*foreign   titleauthor authors          au_id,*,*,*,*,*,*,* au_id,*,*,*,*,*,*,* (2 rows affected)REMAP="UN--Under"The object_keys and related_keys columns refer to the names of the columns that make up the key. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_helpkey lists information about all the primary, foreign, or common key definitions that reference the table objname, or about all the keys in the database if the parameter is omitted. Define these keys with the MOREINFO="NONE"sp_primarykey, MOREINFO="NONE"sp_foreignkey, and MOREINFO="NONE"sp_commonkey system procedures.MOREINFO="NONE"sp_helpkey does not provide information about the MOREINFO="NONE"unique or MOREINFO="NONE"primary key integrity constraints defined by a MOREINFO="NONE"create table statement. Instead, use MOREINFO="NONE"sp_helpconstraint to determine what constraints are defined for a table.Create keys to make explicit a logical relationship that is implicit in your database design. An application program can use the information. If you specify an object name, MOREINFO="NONE"sp_helpkey follows SQL Server's rule for finding objects:MARK="DASH" REMAP="BS--BulletSub"If  you don't specify an owner name, and you own an object with the specified name, MOREINFO="NONE"sp_helpkey uses that object. If  you don't specify an owner name, and you do not own an object of that name, but the dbo does, MOREINFO="NONE"sp_helpkey uses the dbo's object. If neither you nor the dbo owns an object of that name, MOREINFO="NONE"sp_helpkey reports an error condition, even if an object exists in the database with that object name, but different owner.If you and the dbo both own objects with the specified name, and you want to access the dbo's object, specify the name in the form dbo.objectname.Qualify objects owned by database users other than yourself and the dbo with the owner's name, as in "mary.myproc".MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"No defined keys for this object.REMAP="UN--Under"No primary, foreign, or common keys are defined for the specified table or view.MOREINFO="NONE"The name supplied for the objname
 parameter is not a table or view in the current database. REMAP="UN--Under"The table or view named doesn't exist in the current database.MOREINFO="NONE"Table or view name must be in current database.REMAP="UN--Under"The name supplied for the objname parameter included a database reference. Name references must be local to the current database. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpkey. Tables UsedREMAP="BO--Body"master.dbo.spt_values, syskeys, sysobjectsSee Also Commands     LINKEND="X19955"create trigger
 System procedures     LINKEND="X22659"sp_commonkey
, LINKEND="X50021"sp_foreignkey
, LINKEND="X91431"sp_help
, LINKEND="X43109"sp_primarykey
ID="IN4427733030"sp_helpkey system procedure
  ID="IN4432693431"sp_helplanguage system procedureID="X13013"sp_helplanguageID="IN4520693533"Languages, alternateinformation on
ID="IN4520693534"Information (Server)languages;Information (Server):alternate languages
Reports information about a particular alternate language or about all languages. FORMAT="LINESPECIFIC"sp_helplanguage [MOREINFO="NONE"language]ParametersREMAP="RI--RefIndent"language - is the name of the alternate language that you want information about. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helplanguage frenchREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"langid dateformat datefirst upgrade     name       alias      months      shortmonths      days ------ ---------- --------- ----------- -----------------------      ----------------------------      -----------------------------------------------------------     -----------------------------------------------------------     -----------------------------------------------------------1 dmy              1           0 french      french      janvier,février,mars,avril,mai,juin,juillet,août,septembre,          octobre,novembre,décembre      jan,fév,mar,avr,mai,jui,juil,aoû,sep,oct,nov,déc      lundi,mardi,mercredi,jeudi,vendredi,samedi,dimanche REMAP="UN--Under"This example displays information about the alternate language french. sp_helplanguage REMAP="UN--Under"This example displays information about all installed alternate languages. CommentsID="IN4520653939"Languages, alternatesyslanguages table;syslanguages tableMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_helplanguage reports on a specified language when language is given, or on all languages in master.dbo.syslanguages when no language is supplied. MessagesMARK="BULL" REMAP="BU--Bullet"language
MOREINFO="NONE" is not an official language name from syslanguages.REMAP="UN--Under"Use MOREINFO="NONE"sp_helplanguage to see the list of official language names available on this SQL Server.MOREINFO="NONE"No alternate languages are available.REMAP="UN--Under"Use MOREINFO="NONE"sp_helplanguage to see the list of official language names available on this SQL Server.MOREINFO="NONE"us_english is always available, even though it is not in master.dbo.syslanguages.REMAP="UN--Under"This message appears at the end of each report from MOREINFO="NONE"sp_helplanguage.PermissionsREMAP="BO--Body"Any user can executeMOREINFO="NONE" sp_helplanguage. Tables UsedREMAP="BO--Body"master.dbo.syslanguages, sysobjects See Also System procedures     LINKEND="X44244"sp_addlanguage
, LINKEND="X82772"sp_droplanguage
, LINKEND="X76169"sp_setlangalias
ID="IN4532614344"sp_helplanguage system procedure
  ID="IN4627574845"sp_helplog system procedure
sp_helplogID="IN4620574847"Information (Server)first page of log;Information (Server):log device
ID="IN467574848"Devicesinformation on log;Log device:information
ID="IN4612545149"Dump devicesDump devicesSee also Database devices; Log device!see also Database devices; Log device
Reports the name of the device that contains the first page of the log. FORMAT="LINESPECIFIC"sp_helplogParametersREMAP="BO--Body"None.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helplogREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"In database `master', the log starts on device `master'.CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_helplogID="IN4610545154"First pagelog device
 displays the name of the device that contains the first page of the log in the current database. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"In database `database_name', the log starts on device `device_name'.REMAP="UN--Under"The named device contains the first page of the database's log.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helplog.Tables UsedREMAP="BO--Body"master.dbo.sysdevices, master.dbo.sysusages, sysindexes, sysobjects See Also Commands      LINKEND="X61977"alter database
,LINKEND="X75308"create database
 System procedures     LINKEND="X11789"sp_helpdevice
, LINKEND="X21496"sp_logdevice
ID="IN4627505559"sp_helplog system procedure
  ID="IN4635465960"sp_helpremotelogin system procedureID="X68669"sp_helpremoteloginID="IN475466062"Usersinformation on remote;Users:logins information
ID="IN477466063"Serversinformation on remote logins
ID="IN4713466064"Remote loginsinformation on;Remote servers:information on logins of
ID="IN4720466065"Information (Server)remote server logins;Logins:information on
ID="IN479436366"IDs, userIDs, userSee also Logins!see also Logins
ID="IN4713406667"Remote loginsRemote loginsSee also Logins; Users!see also Logins; Users
ID="IN4731376968"Remote users. See Remote logins
ID="IN4710347269"User namesUser namesSee also Database object owners; Logins!see also Database object owners; Logins
Reports information about a particular remote server's logins or about all remote servers' logins. FORMAT="LINESPECIFIC"sp_helpremotelogin [MOREINFO="NONE"remoteserver [,MOREINFO="NONE"remotename]]ParametersREMAP="RI--RefIndent"remoteserver - is the name of the server about which to report remote login information. remotename - is the name of a particular remote user on the remote server. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpremotelogin GATEWAY REMAP="UN--Under"Displays information about all the remote users of the remote server GATEWAY. sp_helpremotelogin REMAP="UN--Under"Displays information about all the remote users of all the remote servers known to the local server. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_helpremoteserver reports on the remote logins for the specified server when remoteserver is given, or on all servers when no parameter is supplied. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"There are no remote logins.MOREINFO="NONE"There are no remote logins defined.ID="IN476307675"Loginssysremotelogins table;sysremotelogins tableREMAP="UN--Under"There are no remote logins for any remote server in  master.dbo.sysremotelogins. MOREINFO="NONE"There are no remote logins for `remotename
MOREINFO="NONE"'.REMAP="UN--Under"The remote server has no entries in the master.dbo.sysremotelogins table. MOREINFO="NONE"There are no remote logins for `remotename
'MOREINFO="NONE" on remote server `remoteserver
'MOREINFO="NONE".REMAP="UN--Under"There is no remote login for the user remoteuser on the remote server remoteserver.MOREINFO="NONE"There are no remote logins for the remote server `remoteserver
'MOREINFO="NONE".ID="IN4716268076"sysservers tablesp_helpremotelogins andREMAP="UN--Under"The specified server isn't listed in master.dbo.sysservers. Run the procedure without the remoteserver parameter to see remote login information for all the servers. To get a list of all the servers, run MOREINFO="NONE"sp_helpserver. MOREINFO="NONE"There are no remote servers defined.REMAP="UN--Under"The master.dbo.sysservers table has no entries for remote servers. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpremotelogin.Tables UsedREMAP="BO--Body"master.dbo.spt_values, master.dbo.sysmessages, master.dbo.sysremotelogins, master.dbo.sysservers, sysobjectsSee Also System procedures     LINKEND="X52745"sp_addremotelogin
, LINKEND="X85991"sp_dropremotelogin
, LINKEND="X45409"sp_helpserver
ID="IN4735228480"sp_helpremotelogin system procedure
  ID="IN4730198781"sp_helprotect system procedureID="X22708"sp_helprotectID="IN4811198883"Permissionsinformation on;Users:information on permissions of
ID="IN4816198884"Database objectspermissions on;Information (Server):user permissions
Reports on permissions for database objects, users, or groups.FORMAT="LINESPECIFIC"sp_helprotect [MOREINFO="NONE"name [, MOREINFO="NONE"name_in_db [, "grant"]]]ParametersREMAP="RI--RefIndent"name - is either the name of the table, view, or stored procedure, or the name of a user or group in the current database. If you do not provide a name, MOREINFO="NONE"sp_helprotect reports on all permissions in the database.name_in_db - is a user's name in the current database.ID="IN4812159287"grant optionsp_helprotect
MOREINFO="NONE"grant - displays the privileges granted to name MOREINFO="NONE"with grant option.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"MOREINFO="NONE"grant select on titles to judy grant update on titles to judy revoke update on titles(price) from judygrant select on publishers to judywith grant optionREMAP="UN--Under"MOREINFO="NONE"After this series of MOREINFO="NONE"grant and MOREINFO="NONE"revoke statements, executing MOREINFO="NONE"sp_helprotect MOREINFO="NONE"titles results in this display: ID="IN4811159289"Permissionsgranting
ID="IN4811159290"PermissionsrevokingREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC" grantor grantee type   action   object     column      grantable  ------- ------ -----   ------   ------     ------      -------  dbo     judy   Grant   Select   titles     All         FALSE  dbo     judy   Grant   Update   titles     advance     FALSE  dbo     judy   Grant   Update   titles     notes       FALSE  dbo     judy   Grant   Update   titles     pub_id      FALSE  dbo     judy   Grant   Update   titles     pubdate     FALSE  dbo     judy   Grant   Update   titles     title       FALSE  dbo     judy   Grant   Update   titles     title_id    FALSE  dbo     judy   Grant   Update   titles     total_sales FALSE  dbo     judy   Grant   Update   titles     type        FALSE dbo     judy   Grant   Select   publishers all         TRUEgrant select, update on titles(price, advance)to marywith grant optionREMAP="UN--Under"After this MOREINFO="NONE"grant statement, MOREINFO="NONE"sp_helprotect MOREINFO="NONE"titles displays the following:REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC" grantor    grantee    type    action  object  column  grantable  -------    -------    ------  ------- ------  ------  ---------  dbo        mary       Grant   Select  titles  advance  TRUE  dbo        mary       Grant   Select  titles  price    TRUE  dbo        mary       Grant   Update  titles  advance  TRUE  dbo        mary       Grant   Update  titles  price    TRUE sp_helprotect judy REMAP="UN--Under"Displays all the permissions that "judy" has in the database. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_helprotect reports permissions on a database object. If you supply the name_in_db parameter, only those user's permissions on the database object are reported. If name is not an object, MOREINFO="NONE"sp_helprotect checks to see if it is a user or group, and if it is, MOREINFO="NONE"sp_helprotect lists the permissions for the user or group. MOREINFO="NONE"sp_helprotect looks for objects and users in the current database only. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object must be in current database.REMAP="UN--Under"The name supplied for the name parameter included a reference to a database. The name must be local to the database. MOREINFO="NONE"No user with the specified name exists in the current database.REMAP="UN--Under"The name supplied for name_in_db is not a user or group in the current database. MOREINFO="NONE"No such object or user exists in the database.REMAP="UN--Under"The name supplied for the name parameter is not an object, user, or group in the current database. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helprotect. Tables UsedREMAP="BO--Body"#sysprotects1, #sysprotects2, master.dbo.spt_values, syscolumns, sysobjects, sysprotects, sysusersSee Also Commands     LINKEND="X69087"grant
, LINKEND="X29921"revoke
 System procedures     LINKEND="X91431"sp_help
ID="IN4830129596"sp_helprotect system procedure
  REMAP="BO--Body"ID="X36403"sp_helpsegmentID="IN43209663"Information (Server)segments;Segments:information on
Reports information on a particular segment or on all of the segments in the current database. FORMAT="LINESPECIFIC"sp_helpsegment [MOREINFO="NONE"segname] ParametersREMAP="RI--RefIndent"segname - is the name of the segment about which you want information. If you omit this parameter, information on all the segments in the current database appears. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpsegment segment3 REMAP="UN--Under"Reports information about the segment named segment3, including which database tables and indexes use that segment.sp_helpsegment "default"REMAP="UN--Under"Reports information about the default segment. Notice that the keyword default must be enclosed in quotes.sp_helpsegment logsegmentREMAP="UN--Under"Reports information about the segment on which the transaction log is stored.CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_helpsegment displays information on the specified segment when segname is given, or on all segments in the current database when no argument is given. Add segments to the syssegments table in the current database with MOREINFO="NONE"sp_addsegment. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"There is no such segment as segname
MOREINFO="NONE".REMAP="UN--Under"The segment name supplied for the segname parameter doesn't exist in the syssegments table. Run MOREINFO="NONE"sp_helpsegment without the segname parameter to see a list of all segments for the current database. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpsegment. Tables UsedREMAP="BO--Body"master.dbo.sysdevices, master.dbo.sysusages, sysindexes, sysobjects, syssegmentsSee AlsoSystem procedures     LINKEND="X62957"sp_addsegment
, LINKEND="X10014"sp_dropsegment
, LINKEND="X53708"sp_extendsegment
, LINKEND="X90458"sp_helpdb
, LINKEND="X11789"sp_helpdevice
ID="IN4331921012"sp_helpsegment system procedure
 ID="IN4330881413"sp_helpserver system procedureID="X45409"sp_helpserverID="IN4414881515"Remote serversinformation on;Servers:information on remote
ID="IN4420881516"Information (Server)remote servers
ID="IN4414851817"Remote serversRemote serversSee also Servers!see also Servers
ID="IN447822118"ServersServersSee also Remote servers!see also Remote servers
ID="IN4413792419"Local serversLocal serversSee also Remote servers; Servers!see also Remote servers; Servers
Reports information about a particular remote server or about all remote servers. FORMAT="LINESPECIFIC"sp_helpserver [MOREINFO="NONE"server]ParametersREMAP="RI--RefIndent"server - is the name of the remote server that you want information about. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpserver GATEWAYREMAP="UN--Under"Displays information about the remote server GATEWAY. sp_helpserverREMAP="UN--Under"Displays information about all the remote servers known to the local server.CommentsMARK="BULL" REMAP="BU--Bullet"ID="IN4416752824"sysservers tablesp_helpserver and
MOREINFO="NONE"sp_helpserver reports on all servers in master.dbo.sysservers, or on a specified remote server when server is given. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"There are no remote servers defined.REMAP="UN--Under"This SQL Server has no remote servers defined. MOREINFO="NONE"There is not a server named server
MOREINFO="NONE".REMAP="UN--Under"The specified server isn't listed in master.dbo.sysservers. Run the procedure without the server parameter to see a list of all the servers. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpserver. Tables UsedREMAP="BO--Body"#spt_server, master.dbo.spt_values, master.dbo.sysservers, sysobjectsSee AlsoSystem procedures     LINKEND="X18765"sp_addserver
, LINKEND="X78977"sp_dropserver
, LINKEND="X68669"sp_helpremotelogin
, LINKEND="X71283"sp_serveroption
ID="IN4430713229"sp_helpserver system procedure
 ID="IN4428673630"sp_helpsort system proceduresp_helpsortID="IN4510653932"Sort ordersp_helpsort display
ID="IN457653933"Displaycharacter sets
ID="IN4534624234"Collating sequence. See Sort order
Displays SQL Server's default sort order and character set. FORMAT="LINESPECIFIC"sp_helpsort ParametersREMAP="BO--Body"None ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpsortID="IN4514604438"Character setssp_helpsort display ofREMAP="UN--Under"For Class 1 (single byte) character sets, MOREINFO="NONE"sp_helpsort ID="INA459584639"Terminals7-bit, sp_helpsort output example
ID="IN4534564840"7-bit terminal, sp_helpsort output;seven-bit terminal, sp_helpsort output
displays the name of the server's default sort order, its character set, and a table of its primary sort values.  On a 7-bit terminal it appears as follows: REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Sort Order Description ----------------------------------------------------------------- Character Set = 1, iso_1                                                ISO 8859-1 (Latin-1) - Western European 8-bit character set.    Sort Order = 50, bin_iso_1                                              Binary sort order for the ISO 8859/1 character set (iso_1).    Characters, in Order -----------------------------------------------------------------FLOAT="0"FORMAT="UNKNOWN" FILEREF="fig2_1_1.xwd"REMAP="BO--Body"ID="IN459545041"Terminals8-bit, sp_helpsort output example
ID="IN4534525242"8-bit terminal, sp_helpsort output;eight-bit terminal, sp_helpsort output
On an 8-bit terminal it appears as follows:REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Sort Order Description ----------------------------------------------------------------- Character Set = 1, iso_1     ISO 8859-1 (Latin-1) - Western European 8-bit character set.    Sort Order = 50, bin_iso_1     Binary sort order for the ISO 8859/1 character set (iso_1).Characters, in Order -----------------------------------------------------------------REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"FLOAT="0"FORMAT="UNKNOWN" FILEREF="fig2_1_2.xwd"REMAP="BO--Body"ID="IN4524505443"Multibyte character setssort order;Multibyte character sets:sp_helpsort output
ID="IN4514505444"Character setsmultibyte
For a Class 2 (multibyte) character set, the characters are not listed, but a description of the character set is included. For example: REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Sort Order Description -----------------------------------------------------------------Character Set = 140, euc_jis    Japanese. Extended Unix Code mapping for JIS-X0201    (hankaku katakana) and JIS-X0208 (double byte) roman,     kana, and kanji.    Class 2 character setSort Order = 50, bin_eucjis    Binary sort order for Japanese using the EUC JIS      character set as a basis. CommentsID="IN4517505446"Binary sort orderBinary sort orderof character setscharacter setsMARK="BULL" REMAP="BU--Bullet"Binary sort order is the default. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Unknown character set: character_setREMAP="UN--Under"MOREINFO="NONE"sp_helpsort does not recognize character_set, but displays the characters in order.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpsort.Tables UsedREMAP="BO--Body"#helpsort1, #helpsort2, #helpsort3, master.dbo.syscharsets, master.dbo.syscurconfigs, sysobjectsID="IN4528465850"sp_helpsort system procedure
 ID="IN4528426251"sp_helptext system procedureID="X25756"sp_helptextID="IN4616426353"Database objectsdisplay text of;Display:text of database objects
ID="IN4620426354"Information (Server)text
ID="IN4617426355"System proceduresdisplaying the text of
ID="IN468426356"Triggersdisplaying the text of
ID="IN465426357"Viewsdisplaying the text of
ID="IN468426358"Defaultsdisplaying the text of
ID="IN465426359"Rulesdisplaying the text of
ID="IN4611426360"Constraintsdisplaying the text of;Check constraints:displaying the text of
Prints the text of a system procedure, trigger, view, default, rule, or integrity check constraint. FORMAT="LINESPECIFIC"sp_helptext MOREINFO="NONE"objname ParametersREMAP="RI--RefIndent"objname - is the name of the object for which to display the MOREINFO="NONE"create text. It must be in the current database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helptext pub_idrule REMAP="UN--Under"Displays the text of pub_idrule. Since this rule is in the pubs2 database, this command must be issued from pubs2. REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"# Lines of Text---------------1 (1 row affected) text ------------------------------------------------------------create rule pub_idruleas @pub_id in ("1389", "0736", "0877", "1622", "1756")or @pub_id like "99[0-9][0-9]" (1 row affected, return status = 0)sp_helptext sp_helptext REMAP="UN--Under"Displays the text of MOREINFO="NONE"sp_helptext. Since system procedures are stored in sybsystemprocs, execute this command from sybsystemprocs. CommentsID="IN4617406565"syscomments tabletext storage inMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_helptext prints out the number of rows in syscomments (255 characters long each) that the object occupies, followed by the MOREINFO="NONE"create text of the object. MOREINFO="NONE"sp_helptext only looks for the text in the syscomments table of the current database. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object must be in the current database.REMAP="UN--Under"The objname parameter included a database name reference. The objname must be in the current database. MOREINFO="NONE"There is no text for object object_name
MOREINFO="NONE".REMAP="UN--Under"objname is an object in the current database that does not have text in syscomments (a table or index, for example).PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helptext.Tables UsedREMAP="BO--Body"syscomments, sysobjects See AlsoCommands     LINKEND="X81463"create default
, LINKEND="X52197"create procedure
,LINKEND="X43186"create rule
, LINKEND="X19955"create trigger
, LINKEND="X30101"create view
 System procedures     LINKEND="X91431"sp_help
 ID="IN4633366970"sp_helpthreshold system procedureID="X52248"sp_helpthresholdID="IN4720367072"Information (Server)thresholds
ID="IN4710347273"Thresholdssp_helpthreshold information on
ID="IN478327474"Segmentssp_helpthreshold report on
Reports the segment, free-space value, status, and stored procedure associated with all thresholds in the current database or all thresholds for a particular segment.FORMAT="LINESPECIFIC"sp_helpthreshold [segment_name]ParametersREMAP="RI--RefIndent"segment_name - is the name of a segment in the current database.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpthreshold logsegmentREMAP="UN--Under"Shows all thresholds on the log segment.sp_helpthresholdREMAP="UN--Under"Shows all thresholds on all of the segments of the current database.sp_helpthreshold "default"REMAP="UN--Under"Shows all thresholds on the default segment. Note the use of quotes around the reserved word "default".CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_helpthreshold displays threshold information for all the segments in the current database. If you provide the name of a segment, MOREINFO="NONE"sp_helpthreshold lists all of the thresholds on that segment.ID="IN4711307679"Log segmentsp_threshold report onThe status column is 1 for the last-chance threshold and 0 for all other thresholds. Databases that do not store their transaction logs on a separate segment have no last-chance threshold.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Database 'dbname
'MOREINFO="NONE" has no thresholds--table 'systhresholds
'MOREINFO="NONE" does not exist.ID="IN4719287881"systhresholds tableREMAP="UN--Under"The systhresholds table is missing. This table is created when the database is created (or an upgrade to Release 10 is performed), and must not be removed.MOREINFO="NONE"Segment 'segment_name
'MOREINFO="NONE" does not exist.REMAP="UN--Under"Use MOREINFO="NONE"sp_helpsegment to see the names of segments in a database.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpthreshold. Tables UsedREMAP="BO--Body"sysobjects, syssegments, systhresholdsSee AlsoSystem procedures     LINKEND="X96491"sp_addthreshold
, LINKEND="X39966"sp_dropthreshold
, LINKEND="X36403"sp_helpsegment
, LINKEND="X90993"sp_modifythreshold
, LINKEND="X67172"sp_thresholdaction
ID="IN4728248285"sp_helpuser system procedure
ID="IN475238386"Usersinformation on
ID="IN4715228487"Database Ownersinformation onID="X28192"sp_helpuserID="IN4820198889"Information (Server)Database Owners;Information (Server):groups;Information (Server):users, database
ID="IN4852169190"Identity of user. See Aliases; Logins; Users
ID="IN486139491"LoginsLoginsSee also Remote logins; Users!see also Remote logins; Users
Reports information about a particular user or about all users in the current database.FORMAT="LINESPECIFIC"sp_helpuser [MOREINFO="NONE"name_in_db]ParametersREMAP="RI--RefIndent"name_in_db - is the user's name in the current database.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_helpuserREMAP="UN--Under"Displays information about all users in the current database: REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Users_name ID_in_db    Group_name  Login_name  Default_db ---------  --------    ----------  ----------  ---------- ann        4           hackers     ann         master dbo        1           public      sa          master guest      2           public      NULL        NULL judy       3           hackers     judy        master sp_helpuser dbo REMAP="UN--Under"Displays information about the Database Owner (user name "dbo"): REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Users_name     ID_in_db    Group_name  Login_name  Default_db ----------     --------    ----------  ----------  ---------- dbo            1           public      sa          master  Users aliased to user. Login_name                      ------------------------------- andy                            christa                         howard                          linda                          CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_helpuser reports information on all users of the current database. If you specify a name_in_db, MOREINFO="NONE"sp_helpuser reports information only on the specified user.ID="IN487119696"Aliasessp_helpuser andIf the specified user is not listed in the current database's sysusers table, MOREINFO="NONE"sp_helpuser checks to see if the user is aliased to another user or is a group name. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"The name supplied is a group name.REMAP="UN--Under"The name specified for the name_in_db parameter is a group name. MOREINFO="NONE"The name supplied is aliased to another user.REMAP="UN--Under"The name supplied is not a user in the database, but is aliased to a user in the database. MOREINFO="NONE"The name supplied is not a user, group, or aliased.REMAP="UN--Under"The name supplied is unknown in the database as a login, user, or group. MOREINFO="NONE"Users aliased to user.REMAP="UN--Under"If the user has other users aliased to him or her, the names of the other users are listed. (See Example 2.) PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_helpuser. Tables UsedREMAP="BO--Body"master.dbo.syslogins, sysalternates, sysobjects, sysusers See AlsoCommands     LINKEND="X69087"grant
, LINKEND="X29921"revoke
, LINKEND="X39034"use
 System procedures     LINKEND="X68639"sp_adduser
, LINKEND="X46789"sp_dropuser
, LINKEND="X91431"sp_help
, LINKEND="X25329"sp_helpgroup
ID="IN4817998101"System procedureshelp reports;Help reports:system procedures
ID="IN48285102102"sp_helpuser system procedure
ID="IN4854103103"Usersinformation on
ID="IN48153104104"Database Ownersinformation on
ID="IN48200107105"Information (Server)Database Owners;Information (Server):groups;Information (Server):users, database
 REMAP="BO--Body"sp_indsuspectID="IN43339483"Referential integrity constraintssp_indsuspect system procedure
ID="INA43792104"Indexessuspect;Information (Server):suspect indexes
ID="IN43692105"TablesTableswith suspect indexessuspect indexes
Checks user tables for indexes marked as suspect during recovery following a sort order change. FORMAT="LINESPECIFIC"sp_indsuspect [MOREINFO="NONE"table_name]ParametersREMAP="RI--RefIndent"table_name - is the name of the user table to check. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_indsuspect newacctsREMAP="UN--Under"Checks the table newaccts for indexes marked as suspect. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_indsuspect with no parameter creates a list of all tables in the current database with indexes that need to be rebuilt as a result of a sort order change. With a table_name parameter, MOREINFO="NONE"sp_indsuspect checks the indicated user table for indexes marked as suspect during recovery following a sort order change. ID="IN4320861610"reindex option, dbccafter sp_indsuspectUse MOREINFO="NONE"sp_indsuspect to list all suspect indexes. The table owner or a System Administrator can use MOREINFO="NONE"dbcc reindex to check the integrity of the listed indexes and to rebuild them if necessary. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Suspect indexes in database database_name
MOREINFO="NONE": Own.Tab.Ind (Obj_ID, Ind_ID) = owner.table.index_name(object_id, index_id)REMAP="UN--Under"The listed indexes are suspect and should be reindexed using MOREINFO="NONE"dbcc reindex. MOREINFO="NONE"There are no suspect indexes in database database_name
MOREINFO="NONE".REMAP="UN--Under"No tables in the current database contain suspect indexes.MOREINFO="NONE"Table must be in the current database.REMAP="UN--Under"MOREINFO="NONE"sp_indsuspect only checks the current database for suspect indexes. You cannot use a fully qualified table name to check tables in another database. To check for suspect indexes in another database, use the use command to access the database.MOREINFO="NONE"There is no table named table_name
MOREINFO="NONE" in the current database.REMAP="UN--Under"The current database does not contain the table name you specified. Check the table name and rerun MOREINFO="NONE"sp_indsuspect.MOREINFO="NONE"Suspect indexes on table table_name
MOREINFO="NONE": Own.Tab.Ind (Obj_ID, Ind_ID) = owner.table.index_name(object_id, index_id
MOREINFO="NONE") REMAP="UN--Under"The listed indexes are suspect and should be reindexed using MOREINFO="NONE"dbcc reindex. MOREINFO="NONE"There are no suspect indexes on table  table_name
MOREINFO="NONE".REMAP="UN--Under"The specified table does not contain suspect indexes.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_indsuspect.Tables UsedREMAP="BO--Body"sysindexes, sysobjects, sysusers See AlsoCommands      LINKEND="X60179"dbcc
ID="IN4330822015"sp_indsuspect system procedure
ID="IN437802216"Indexessuspect;Information (Server):suspect indexes
 ID="IN4324762617"sp_lock system procedureID="X34217"sp_lockID="IN4439742919"Current locks, sp_lock system procedure
ID="IN4424733020"Processes (Server tasks)checking locks on
ID="IN447723121"Lockingcontrol over
ID="IN445693422"Lockssp_lock system procedure
ID="IN4420693423"Information (Server)current locks
Reports information about processes that currently hold locks. FORMAT="LINESPECIFIC"sp_lock [MOREINFO="NONE"spid1 [, MOREINFO="NONE"spid2]]ParametersREMAP="RI--RefIndent"spid1 - is the SQL Server process ID number from the master.dbo.sysprocesses table. Run MOREINFO="NONE"sp_who to get the spid of the lock. spid2 - is another SQL Server process ID number to check for locks. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_lockREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"The class column will display the cursor name for locks associated with a cursor for the current user and the cursor id for other users.spid locktype      table_id    page    dbname  class---- ------------  ----------  ----    ------  ---------------1    Ex_intent     1308531695  0       master  Non cursor lock1    Ex_page       1308531695  761     master  Non cursor lock1    Sh_intent     380528389   0       master  Cursor Id 3276811    Update_page   380528389   3752    master  Cursor Id 3276815    Ex_intent     144003544   0       userdb  Non cursor lock5    Ex_page       144003544   509     userdb  Non cursor lock5    Ex_page       144003544   1419    userdb  Non cursor lock5    Ex_page       144003544   1420    userdb  Non cursor lock5    Ex_page       144003544   1440    userdb  Non cursor lock5    Sh_page       144003544   1440    userdb  Non cursor lock5    Sh_table      144003544   0       userdb  Non cursor lock5    Update_page   144003544   1440    userdb  Non cursor lock5    Sh_intent     380528389   0       master  objects_crsr4    Ex_table      240003886   0       pubs2   Non cursor lock4    Sh_intent     112003436   0       pubs2   Non cursor lock4    Ex_intent-blk 112003436   0       pubs2   Non cursor lockREMAP="UN--Under"Displays information on all locks currently held in SQL Server. sp_lock 1 REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"The class column will dispaly the cursor name for locks associated with a cursor for the current user and the cursor id for other users.spid locktype      table_id    page    dbname  class---- -----------   ----------  ----    ------  ---------------1    Ex_intent     1308531695  0       master  Non cursor lock1    Ex_page       1308531695  761     master  Non cursor lockREMAP="UN--Under"Displays information on locks currently held on MOREINFO="NONE"spid1. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_lock with no parameters reports information on all processes that currently hold locks. ID="IN4416653828"holdlock keywordselectThe only user control over locking is through the use of the MOREINFO="NONE"holdlock keyword in the MOREINFO="NONE"select statement. ID="IN4427634029"object_name system functionUse the MOREINFO="NONE"object_name() function to derive a table's name from its ID number. ID="IN4410634030"Page lockstypes of;Pages (data):locks held on
ID="IN4411634031"Table lockstypes of;Locks:types ofThe locktypeID="IN4412634032"Shared lockssharedID="IN4428614233"Prefix, locktype informationID="IN4415614234"Exclusive locksexclusiveID="IN446614235"Tableslocks held onID="IN4418614236"Intent table locksintent table column indicates not only whether the lock is a shared lock ("Sh" prefix), an exclusive lock ("Ex" prefix) or an update lock, but also whether it is held on a table ("table" or "intent") or on a page.ID="IN4412594437"Suffix nameslocktype informationREMAP="UN--Under"The "blk" suffix in the locktype column indicates that this process is blocking another process which needs to acquire a lock. As soon as this process completes, the other process(es) move forward. The "demand" suffix indicates when the process is attmepting to acquire an exclusive lock.In general, read operations acquire shared locks, while write operations acquire exclusive locks. ID="IN4412594438"Update locks
Update locks are created at the page level. Update locks are acquired during the initial portion of an update operation when the pages are being read. The update locks are compatible with shared locks. Later, if the pages are changed, the update locks are promoted to exclusive locks. REMAP="UN--Under"An intent lock indicates the intention to acquire a shared or exclusive lock on a data page. An intent lock prevents another transaction from acquiring an exclusive lock on the table that contains that page. REMAP="UN--Under"A ID="IN4412594439"Demand locks
demand lock prevents any more shared locks from being set. It indicates that a transaction is next in line to lock a table or page. Demand locks are necessary because shared locks can overlap, so that read transactions keep monopolizing a table or page, forcing a write transaction to wait indefinitely. After waiting on four different read transactions, a write transaction is given a demand lock. As soon as the existing read transactions finish, the write transaction is allowed to proceed. Any new read transactions then have to wait for the write transaction to finish.The class column indicates whether a lock is associated with a cursor. It displays one of the following:MARK="DASH" REMAP="BS--BulletSub""Non Cursor Lock" indicates the lock is not associated with a cursor."Cursor Id number"  indicates the lock is associated with cursor ID number for that SQL Server process ID."cursor_name" indicates the lock is associated with cursor cursor_name owned by the current user executing MOREINFO="NONE"sp_lock.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"The class column will display the cursor name for locks associated with a cursor for the current user and the cursor id for other users.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_lock.Tables UsedREMAP="BO--Body"master.dbo.spt_values, master.dbo.syslocks, sysobjectsSee AlsoCommands     LINKEND="X67442"kill
, LINKEND="X35229"selectSystem procedures     LINKEND="X89868"sp_who
 ID="IN4424554844"sp_lock system procedure
ID="IN447544945"Lockingcontrol over
ID="IN4424535046"Processes (Server tasks)checking locks on
ID="IN445505347"Lockssp_lock system procedure
ID="IN4429465748"sp_locklogin system procedureID="X98458"sp_lockloginID="IN457465850"Lockinglogin accounts;Unlocking login accounts
ID="IN456465851"Loginslocking and unlocking accounts;Accounts, locking and unlocking
Locks a SQL Server account so that the user cannot log in, or displays a list of all locked accounts.FORMAT="LINESPECIFIC"sp_locklogin [login_name, "{lock | unlock}"]ParametersREMAP="RI--RefIndent"login_name - is the name of the account to lock or unlock.ID="IN4534426254"lock | unlock option, sp_locklogin
MOREINFO="NONE"lock | MOREINFO="NONE"unlock - specifies whether to lock or unlock login_name.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_locklogin charles, "lock"REMAP="UN--Under"Locks the login account for the user "charles." sp_lockloginREMAP="UN--Under"Displays a list of all locked accounts.CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_locklogin with no parameters returns a list of all the locked accounts.login_name must be the name of an existing valid account.You can lock an account that is currently logged in. The user receives a warning that his or her account has been locked, but is not locked out of the account until he or she logs out.A locked account can be specified as a Database Owner and can own objects in any database.Locking an account that is already locked or unlocking an unlocked account has no effect.When locking a System Security Officer's login account, MOREINFO="NONE"sp_locklogin verifies that at least one other unlocked System Security Officer's account exists. Similarly, MOREINFO="NONE"sp_locklogin verifies that there is always an unlocked System Administrator's account. An attempt to lock the last remaining unlocked System Administrator or System Security Officer account causes MOREINFO="NONE"sp_locklogin to return an error message and fail.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_locklogin from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_locklogin modifies system tables, so it cannot be run from within a transaction.MOREINFO="NONE"No such account -- nothing changed.REMAP="UN--Under"You have specified an invalid login_name.MOREINFO="NONE"Locked account(s):REMAP="UN--Under"Lists all locked accounts.MOREINFO="NONE"Account unlocked.REMAP="UN--Under"You have successfully unlocked the account. MOREINFO="NONE"Account locked.REMAP="UN--Under"You have successfully locked the account.MOREINFO="NONE"Warning: the specified account is currently active.REMAP="UN--Under"The account you've specified is currently logged in; it will be locked when the user next tries to log in.MOREINFO="NONE"Cannot lock the last remaining unlocked SSO|SA account.REMAP="UN--Under"An active System Administrator and System Security Officer account must always exist.PermissionsREMAP="BO--Body"System Administrators and System Security Officers can use MOREINFO="NONE"sp_locklogin to lock logins and to display locked logins. Tables Used REMAP="BO--Body"master.dbo.sysloginroles, master.dbo.syslogins, master.dbo.sysprocesses, sysobjectsSee AlsoSystem procedures     LINKEND="X25636"sp_addlogin
, LINKEND="X24535"sp_modifylogin
, LINKEND="X96621"sp_passwordTopics     LINKEND="X16582"Login Management
 ID="IN4529386661"sp_logdevice system procedureID="X21496"sp_logdeviceID="IN4616376863"Transaction logsTransaction logson a separate deviceseparate device
Puts the system table syslogs, which contains the transaction log, on a separate database device. FORMAT="LINESPECIFIC"sp_logdevice MOREINFO="NONE"dbname, MOREINFO="NONE"device_nameParametersREMAP="RI--RefIndent"dbname - is the name of the database whose syslogs table you want to put on a specific logical device. ID="IN4619337266"Logical device namefor syslogs table;syslogs table
device_name - is the logical name of the device on which you want to put the syslogs table. This device must be a database device associated with the database (named in MOREINFO="NONE"create database or MOREINFO="NONE"alter database). Run MOREINFO="NONE"sp_helpdb for a report on the database's devices. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create database products on default = 10, logs = 2 sp_logdevice products, logs REMAP="UN--Under"Creates the database products and puts the table products.syslogs on the database device logs.CommentsID="IN4629277869"sp_logdevice system procedurelog on extension to create database and
ID="IN4613218470"log on option create database, and sp_logdevice
ID="IN4623159071"create database commandlog on option compared to sp_logdeviceThe MOREINFO="NONE"sp_logdevice procedure affects only future allocations of space forID="IN4613139272"syslogs tableput on a separate device
 syslogs. This creates a window of vulnerability during which the first pages of your log remain on the same device as your data. Therefore, the preferred method of placing a transaction log on a separate device is with the MOREINFO="NONE"log on option to MOREINFO="NONE"create database, which immediately places the entire transaction log on a separate device. MARK="BULL" REMAP="BU--Bullet"Place transaction logs on separate database devices, for both recovery and performance reasons. ID="IN462499673"dump transaction commandsp_logdevice andREMAP="UN--Under"A very small, non-critical database could keep its log together with the rest of the database. Such databases use MOREINFO="NONE"dump database to backup the database and log and MOREINFO="NONE"dump transaction with truncate_only to truncate the log. MOREINFO="NONE"dbcc MOREINFO="NONE"checkalloc and MOREINFO="NONE"sp_helplog show some pages for syslogs still allocated on the database device until after the next MOREINFO="NONE"dump transaction. After that, the transaction log is completely transferred to the device named when you executed MOREINFO="NONE"sp_logdevice. ID="IN46499674"Sizelog device;Space allocation:log deviceThe size of the device required for the transaction log varies according to the amount of update activity and the frequency of transaction log dumps. As a rule of thumb, allocate to the log device 10% to 25% of the space you allocate to the database itself. To increase the amount of storage allocated to the transaction log use MOREINFO="NONE"alter database. If you used the MOREINFO="NONE"log MOREINFO="NONE"on option to MOREINFO="NONE"create database to place a transaction log on a separate device, use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_extendsegment MOREINFO="NONE"segname, MOREINFO="NONE"device_name REMAP="UN--Under"to increase the size of the log segment. If you did not use MOREINFO="NONE"log MOREINFO="NONE"on, execute MOREINFO="NONE"sp_logdevice. REMAP="UN--Under"The device or segment on which you put syslogs is used only for the syslogs table. If you want to increase the amount of storage space allocated for the rest of the database, specify any device other than the log device when you issue the MOREINFO="NONE"alter database command. Use the MOREINFO="NONE"disk init command to format a new database device for databases or transaction logs. See the System Administration Guide for details. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"No such database -- run sp_helpdb to list databases.REMAP="UN--Under"No database with the supplied name exists. Run MOREINFO="NONE"sp_helpdb to get a list of databases. MOREINFO="NONE"No such device exists -- run sp_helpdevice to list the SQL Server devices.REMAP="UN--Under"The device_name device doesn't exist on SQL Server. MOREINFO="NONE"syslogs moved.REMAP="UN--Under"The procedure was successful and the syslogs table is now located on the device_name device. MOREINFO="NONE"The last-chance threshold for database dbname
MOREINFO="NONE" is nownMOREINFO="NONE"pages.REMAP="UN--Under"SQL Server created a last-chance threshold for the log segment of the database. When the amount of free space on the log segment falls below n pages, SQL Server automatically executes MOREINFO="NONE"sp_thresholdaction. Use MOREINFO="NONE"sp_modifythreshold to change the procedure associated with the last-chance threshold.MOREINFO="NONE"Could not update the last-chance threshold for database dbname
.REMAP="UN--Under"SQL Server was unsuccessful in creating a last-chance threshold for the log segment. Your systhresholds table may be corrupt.MOREINFO="NONE"The specified device is not used by the database.REMAP="UN--Under"The database dbname has no space allocated on the device device_name. MOREINFO="NONE"This command has been ignored. The device specified is the only non-log device available for the database and cannot be made log-only.REMAP="UN--Under"The device_name you specified is the only, or the last, database device with space available for dbname. Making it a log device would leave no space for creating any more objects in the database.PermissionsREMAP="BO--Body"Only the Database Owner or System Administrator can execute MOREINFO="NONE"sp_logdevice. Tables UsedREMAP="BO--Body"master.dbo.sysdatabases, master.dbo.sysdevices, master.dbo.sysusages, sysobjects See AlsoCommands     LINKEND="X61977"alter database
, LINKEND="X75308"create database
, LINKEND="X60179"dbcc
, LINKEND="X64061"disk init
, LINKEND="X68345"dump database
,LINKEND="X47924"dump transaction
, LINKEND="X35229"select
 System procedures     LINKEND="X53708"sp_extendsegment
, LINKEND="X11789"sp_helpdevice
ID="IN4629510079"sp_logdevice system procedure
ID="IN4616410180"Transaction logsTransaction logson a separate deviceseparate device
 ID="IN4620410181"Full name, modifying
ID="IN468410182"Defaultsmodifying language
ID="IN4616410183"Default databasemodifying
ID="IN4631010584"sp_modifylogin system procedureID="X24535"sp_modifyloginID="IN475-310986"Userschanging account names with sp_modifylogin
ID="IN476-411087"Loginsmodifying accounts
Modifies the default database, default language, or full name for a SQL Server login account.FORMAT="LINESPECIFIC"sp_modifylogin login_name, option, valueParametersREMAP="RI--RefIndent"login_name - is the login account to modify.option - specifies the name of the option to change. The options are:TOCENTRY="1"LBL="Table 4-13:"Options for sp_modifyloginCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="4*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OptionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DefinitionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"defdb COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The "home" database to which the user is connected when he 
or she logs in.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"deflanguage COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The official name of the user's default language.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"fullname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The user's full name. value - is the new value for the specified option.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_modifylogin sarah, defdb, "pubs2"REMAP="UN--Under"Changes the default database for "sarah" to pubs2.sp_modifylogin claire, deflanguage, "french"REMAP="UN--Under"Sets the default language for "claire" to French.sp_modifylogin clemens, fullname, "Samuel Clemens"REMAP="UN--Under"Changes user "clemens" full name to "Samuel Clemens."CommentsMARK="BULL" REMAP="BU--Bullet"Set a default database, language, or full name either with MOREINFO="NONE"sp_modifylogin or with MOREINFO="NONE"sp_addlogin when first adding the user's login to SQL Server.MARK="DASH" REMAP="BS--BulletSub"If you do not specify a default database, the user's default is master.If you do not specify a language, the user's default language is set to the server's default language.If you do not specify a full name, that column in syslogins remains blank.ID="IN4711-411092"Permissionsnew database userAfter MOREINFO="NONE"sp_modifylogin is executed, the user is connected to the new defdb the next time he or she logs in. The user, however, cannot access the database until the Database Owner gives the user access through MOREINFO="NONE"sp_adduser or MOREINFO="NONE"sp_addalias, or if there is a "guest" user in the database's sysusers table. If the user does not have access to the database by any of these means, she or he is connected to master and an error message appears. If a user's default database is dropped, or if the user is dropped from the database, the user is connected to master on his or her next login, and an error message appears. If a user's default language is dropped from the server, the server-wide default language is used as the initial language setting, and a message appears. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_modifylogin from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_modifylogin modifies system tables so it cannot be run from within a transaction.MOREINFO="NONE"No such account -- nothing changed.REMAP="UN--Under"You specified a nonexistent account name.MOREINFO="NONE"ColumnMOREINFO="NONE" changed.REMAP="UN--Under"MOREINFO="NONE"sp_modifylogin executed successfully.MOREINFO="NONE"Column name invalid -- nothing changed.REMAP="UN--Under"You specified an invalid name for the option parameter.PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_modifylogin.Tables UsedREMAP="BO--Body"ID="IN4715-811496"syslogins tablesp_modifylogin and
master..syslogins, sysobjects See AlsoSystem procedures     LINKEND="X25636"sp_addlogin
, LINKEND="X96621"sp_passwordTopics     LINKEND="X16582"Login Management
 ID="IN4735-1211898"sp_modifythreshold system procedureID="X90993"sp_modifythresholdID="IN488-1312099"Segmentsmonitoring remaining space
ID="IN4810-14121101"Thresholdschanging
ID="IN485-17124103"Spacemonitoring remaining with sp_modifythreshold
Modifies a threshold by associating it with a different threshold procedure, level of free space, or segment. You cannot use MOREINFO="NONE"sp_modifythreshold to change the amount of free space or the segment name for the last-chance threshold.FORMAT="LINESPECIFIC"sp_modifythreshold database, segment, free_pages[, new_procedure] [, new_free_pages] [, new_segment]ParametersREMAP="RI--RefIndent"database - is the database for which to change the threshold. This must be the name of the current database.segment - is the segment for which to monitor free space. Use quotes when specifying the "default" segment.free_pages - is the number of free pages at which the threshold is crossed. When free space in the segment falls below this level, SQL Server executes the associated stored procedure.new_procedure - is the new stored procedure to execute when the threshold is crossed. The procedure can be located in any database on the current SQL Server or on an Open Server. Thresholds cannot execute procedures on remote SQL Servers.new_free_pages - is the new number of free pages to associate with the thrshold. When free space in the segment falls below this level, SQL Server executes the associated stored procedure.new_segment - is the new segment for which to monitor free space. Use quotes when specifying the "default" segment.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_modifythreshold mydb, "default", 200, NULL, 175REMAP="UN--Under"Modifies a threshold on the default segment of the mydb database. The threshold procedure now executes when free space on the segment falls below 175 pages, rather than 200 pages. The NULL is a place holder indicating that the procedure name is not being changed.sp_modifythreshold mydb, data_seg, 250, new_procREMAP="UN--Under"Modifies a threshold on the data_seg segment of mydb so that it executes the new_proc procedure. CommentsMARK="BULL" REMAP="BU--Bullet"See the System Administration Guide for more information about using thresholds.Crossing a ThresholdMARK="BULL" REMAP="BU--Bullet"When a threshold is crossed, SQL Server executes the associated stored procedure. SQL Server uses the following search path for the threshold procedure:MARK="DASH" REMAP="BS--BulletSub"If the procedure name does not specify a database, SQL Server looks in the database in which the threshold was crossed.If the procedure is not found in this database and the procedure name begins with sp_, SQL Server looks in the sybsystemprocs database.REMAP="UN--Under"If the procedure is not found in either database, SQL Server sends an error message to the error log. SQL Server uses a hysteresis value, the global variable @@thresh_hysteresis, to determine how sensitive thresholds are to variations in free space. Once a threshold executes its procedure, it is deactivated. The threshold remains inactive until the amount of free space in the segment rises to @@thresh_hysteresis pages above the threshold. This prevents thresholds from executing their procedures repeatedly in response to minor fluctuations in free space.The Last-Chance ThresholdMARK="BULL" REMAP="BU--Bullet"By default, SQL Server monitors the free space on the segment where the log resides and executes MOREINFO="NONE"sp_thresholdactionID="IN4810-17124109"Thresholdslast-chance;Last-chance thresholds;Monitoring:space remaining
ID="IN4835-19126110"sp_thresholdaction system procedurethreshold procedure
ID="IN4810-19126111"Thresholdsprocedures executed by
when the amount of free space is less than that required to permit a successful dump of the transaction log. This amount of free space, the "last-chance threshold", is calculated by SQL Server and cannot be changed by users.If the last-chance threshold is crossed before a transaction is logged, SQL Server suspends the transaction until log space is freed. Use MOREINFO="NONE"sp_dboption to change this behavior for a particular database. Setting the MOREINFO="NONE"abort tran on log full option to MOREINFO="NONE"true causes SQL Server to roll back all transactions that have not yet been logged when the last-chance threshold is crossed.You cannot use MOREINFO="NONE"sp_modifythreshold to change the free-space value or segment name associated with the last-chance threshold.Other ThresholdsID="IN4810-19126112"Thresholdsmaximum numberMARK="BULL" REMAP="BU--Bullet"Each database can have up to 256 thresholds, including the last-chance threshold. Each threshold must be at least 2 times @@thresh_hysteresis pages from the next closest threshold.UseMOREINFO="NONE" sp_helpthreshold for information about existing thresholds.Use MOREINFO="NONE"sp_dropthreshold to drop a threshold from a segment.Creating Threshold ProceduresID="IN4815-21128113"master databasethresholds andMARK="BULL" REMAP="BU--Bullet"Any user with MOREINFO="NONE"create procedure permission can create a threshold procedure in a database. Usually, a System Administrator creates MOREINFO="NONE"sp_thresholdaction in the master database, and Database Owners create threshold procedures in user databases.MOREINFO="NONE"sp_modifythreshold does not verify that the specified procedure exists. It is possible to associate a threshold with a procedure that does not yet exist.ID="IN4820-21128114"Threshold proceduresparameters passed toSQL Server passes four parameters to a threshold procedure:MARK="DASH" REMAP="BS--BulletSub"@dbname, varchar(30), which identifies the database@segmentname, varchar(30), which identifies the segment@space_left, int, which indicates the number of free pages associated with the threshold@status, int, which has a value of 1 for last-chance thresholds and 0 for other thresholdsREMAP="UN--Under"These parameters are passed by position rather than by name; your threshold procedure can use other names for them, but must declare them in the order shown and with the correct datatypes.It is not necessary to create a different procedure for each threshold. To minimize maintenance, create a single threshold procedure in the sybsystemprocs database that all thresholds on the SQL Server execute.Include MOREINFO="NONE"print and MOREINFO="NONE"raiserror statements in the threshold procedure to send output to the error log. ID="IN4820-22129115"Threshold proceduresexecutingExecuting Threshold ProceduresMARK="BULL" REMAP="BU--Bullet"Tasks initiated when a threshold is crossed execute as background tasks. These tasks do not have an associated terminal or user session. If you execute MOREINFO="NONE"sp_who while these tasks are running, the status column shows "background".SQL Server executes the threshold procedure with the permissions of the user who modified the threshold, at the time he or she executed MOREINFO="NONE"sp_modifythreshold, minus any permissions that have since been revoked.ID="IN4820-23130116"Threshold proceduresexecutingEach threshold procedure uses one user connection, for as long as it takes to execute the procedure.ID="IN4810-23130117"ThresholdsdisablingDisabling Free-Space AccountingMARK="BULL" REMAP="BU--Bullet"Use the MOREINFO="NONE"no free space acctg option of MOREINFO="NONE"sp_dboption to disable free-space accounting on non-log segments. You cannot disable free-space accounting on log segments.System procedures cannot provide accurate information about space allocation when free-space accounting is disabled.ID="IN4810-23130118"Thresholdslast-chance;Last-chance thresholdsCreating Last-Chance Thresholds for Pre-Release 10.0 DatabasesMARK="BULL" REMAP="BU--Bullet"When you upgrade an existing database to Release 10.0, it does not automatically acquire a last-chance threshold.Use the MOREINFO="NONE"lct_admin system function to create a last-chance threshold in an existing database.Only databases that store their logs on a separate segment can have a last-chance threshold. Use MOREINFO="NONE"sp_logdevice to move the transaction log to a separate device.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"This procedure can only affect thresholds in the current database. Say "USE database_name",then run this procedure again.REMAP="UN--Under"MOREINFO="NONE"sp_modifythreshold can modify thresholds only in the database you are currently using. Issue the MOREINFO="NONE"use command to open the database in which you want to modify a threshold. Then run MOREINFO="NONE"sp_modifythreshold again.MOREINFO="NONE"You may not alter the free space or segment name of the log's last-chance threshold.REMAP="UN--Under"MOREINFO="NONE"sp_modifythreshold cannot change the free-space value or segment name associated with the last-chance threshold.PermissionsREMAP="BO--Body"Only the Database Owner or a System Administrator can execute MOREINFO="NONE"sp_modifythreshold.Tables UsedREMAP="BO--Body"master..sysusages, sysobjects, syssegments, systhresholds See AlsoCommands     LINKEND="X52197"create procedure
, LINKEND="X47924"dump transaction
 System procedures     LINKEND="X96491"sp_addthreshold
, LINKEND="X29657"sp_dboption
, LINKEND="X39966"sp_dropthreshold
, LINKEND="X52248"sp_helpthreshold
, LINKEND="X67172"sp_thresholdaction
ID="IN4827-27134123"sp_monitor system procedureID="X58701"sp_monitorID="IN4943-30138125"Statistical data summary, sp_monitor report
ID="IN497-32140126"Serverssp_monitor statistics
ID="IN4922-34142127"Monitor SQL statisticssp_monitor
ID="IN4910-34142128"Statisticsreturned by global variables
ID="IN4910-36144129"Statisticssp_monitor
ID="IN4920-36144130"Information (Server)monitor statistics
Displays statistics about SQL Server. FORMAT="LINESPECIFIC"sp_monitorParametersREMAP="BO--Body"None.ExamplesREMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_monitor REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"last_run               current_run          seconds -------------------    -------------------  --------- Jan 29 1987 10:11AM    Jan 29 1987 10:17AM  314 cpu_busy           io_busy     idle ---------------    ---------   -------------- 4250(215)-68%      67(1)-0%    109(100)-31%  packets_received       packets_sent    packet_errors ----------------       ------------    ------------ 781(15)                10110(9596)     0(0)  total_read     total_write total_errors    connections -----------    -------------------------   ----------- 394(67)        5392(53)    0(0)            15(1) REMAP="UN--Under"Reports information about how busy SQL Server has been.CommentsID="IN4916-38146135"Global variablessp_monitor report on
ID="IN4916-41149136"Global variablesGlobal variablesSee also individual variable names!see also individual variable namesMARK="BULL" REMAP="BU--Bullet"SQL Server keeps track of how much work it has done in a series of global variables. MOREINFO="NONE"sp_monitor displays the current values of these global variables, and how much they have changed since the last time the procedure executed. ID="IN4913-43151137"Time intervalsince sp_monitor last runFor each column, the statistic appears in the form number(number)-number% or number(number). The first number refers to the number of seconds (for cpu_busy, io_busy, and idle) or the total number (for the other variables) since SQL Server restarted. The number in parentheses refers to the number of seconds or total number since the last time MOREINFO="NONE"sp_monitor ran. The percentage is the percent of time since MOREINFO="NONE"sp_monitor last ran. REMAP="UN--Under"For example, if the report showed cpu_busy as 4250(215)-68%, this would mean that the CPU was busy 4250 seconds since SQL Server last started up, 215 seconds since MOREINFO="NONE"sp_monitor last ran, and 68% of the total time since MOREINFO="NONE"sp_monitor last ran. REMAP="UN--Under"For the MOREINFO="NONE"total_read variable, the value 394(67) means there have been 394 disk reads since  SQL Server was restarted, 67 of them since the last time MOREINFO="NONE"sp_monitor was run. LINKEND="X55822"Table 4-14
 describes the columns in the MOREINFO="NONE"sp_monitor report, the equivalent global variables, if any, and their meanings. With the exception of MOREINFO="NONE"last_run, MOREINFO="NONE"current_run and MOREINFO="NONE"seconds, these column headings are also the names of global variables-except that all global variables are preceded by @@ID="IN497-43151138"Numbersglobal variable unit
ID="IN4913-43151139"Machine ticks
. There is also a difference in the units of the numbers reported by the global variables-the numbers reported by the global variables are not milliseconds of CPU time, but machine ticks. PGWIDE=1 TOCENTRY="1"LBL="Table 4-14:" ID="X55822"Columns in the sp_monitor ReportCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="11*"COLNAME="C3" COLWIDTH="31*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"VariableCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"last_run COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The clock time at which the MOREINFO="NONE"sp_monitor procedure last ran. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"current_run COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The current clock time. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"seconds COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of seconds since MOREINFO="NONE"sp_monitor last ran. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cpu_busy COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@cpu_busy COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of seconds in CPU time that SQL Server's CPU 
was doing SQL Server work. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"io_busy COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@io_busy COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of seconds in CPU time that SQL Server's has 
spent doing input and output operations. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"idle COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@idle COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of seconds in CPU time that SQL Server has 
been idle. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pack_received COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@pack_received COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of input packets read by SQL Server. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pack_sent COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@pack_sent COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of output packets written by SQL Server. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"packet_errors COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@packet_errors COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of errors detected by SQL Server while reading 
and writing packets. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"total_read COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@total_read COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of disk reads by SQL Server. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"total_write COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@total_write COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of disk writes by SQL Server. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"total_errors COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@total_errors COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of errors detected by SQL Server while reading 
and writing. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"connections COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@connections COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of logins or attempted logins to SQL Server. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_monitor from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_monitor modifies system tables, so it cannot be run within a transaction.PermissionsREMAP="BO--Body"Only a System Administrator can execute MOREINFO="NONE"sp_monitor.Tables UsedREMAP="BO--Body"master.dbo.sysengines, master.dbo.spt_monitor, sysobjects See AlsoSystem procedures     LINKEND="X89868"sp_who
ID="IN4927-47155144"sp_monitor system procedure
ID="IN4943-50158145"Statistical data summary, sp_monitor report
 Topics     LINKEND="X44102"Variables (Local and Global)
 REMAP="BO--Body"ID="X96621"sp_passwordID="IN4389393"Changinguser's password;Logins:password change;Users:password change
ID="INB43990124"Passwordssp_password
Adds or changes a password for a SQL Server login account. FORMAT="LINESPECIFIC"sp_password MOREINFO="NONE"caller_passwd, new_passwd [, MOREINFO="NONE"login_name]ParametersREMAP="RI--RefIndent"caller_passwd - is your password. When you are changing your own password, this is your old password. When a System Security Officer is using MOREINFO="NONE"sp_password to change another user's password, caller_passwd is the System Security Officer's password.new_passwd - is the new password for the user, or for login_name. It must be at least 6 bytes long.  Enclose passwords that include characters besides A-Z, a-z, or 0-9 in quotation marks. Also enclose passwords that begin with 0-9 in quotes.login_name - the login name of the user whose account password the System Security Officer is changing.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_password "3blindmice, "2mediumhot"REMAP="UN--Under"Changes your password from password from "3blindmice" to "2mediumhot." (Enclose the passwords in quotes because they begin with numerals.)sp_password "2tomato", sesame1, victoriaREMAP="UN--Under"A System Security Officer whose password is "2tomato" has changed Victoria's password to "sesame1." sp_password null, "16tons"REMAP="UN--Under"Changes your password from NULL to "16tons." Notice that NULL is not enclosed in quotes. (NULL is not a permissible new password.)PRODUCTION...sp_password figaro, lilacsREMAP="UN--Under"Changes your password on the PRODUCTION server from "figaro" to "lilacs."CommentsMARK="BULL" REMAP="BU--Bullet"Any user can change his or her password with MOREINFO="NONE"sp_password.Only a System Security Officer can use the login_name parameter to change another user's password. New passwords must be at least 6 bytes long. They cannot be NULL.The encrypted text of caller_passwd must match the existing encrypted password of the caller. If it does not, MOREINFO="NONE"sp_password returns an error message and fails. master.dbo.syslogins lists passwords in encrypted form. ID="IN432288149"Remote procedure callssp_password;Remote servers:passwords onIf a client program requires users to have the same password on remote servers as on the local server, users must change their passwords on all the remote servers before changing their local passwords. Execute MOREINFO="NONE"sp_password as a remote procedure call on each remote server. See Example 4
.You can set the MOREINFO="NONE"passwordexp configuration variable to establish a password expiration interval that forces all SQL Server login accounts to change passwords on a regular basis. See the System Administration Guide for information.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_password from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_password modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"Error: Unable to set the Password.REMAP="UN--Under"Check your syntax carefully and try again to set the password.MOREINFO="NONE"No such login -- no password changed.REMAP="UN--Under"The name supplied for the login_name parameter does not exist on SQL Server. MOREINFO="NONE"Invalid caller's password specified, password left unchanged.REMAP="UN--Under"The caller_passwd parameter is not the current password of the caller. MOREINFO="NONE"New password specified is too short. Minimum length of acceptable passwords is 6 characters.REMAP="UN--Under"You specified a password that is too short.MOREINFO="NONE"New password supplied is the same as previous password. Please supply a different password.REMAP="UN--Under"If new_passwd is at least six bytes long, it is encrypted and compared with the encrypted value of login_name's existing encrypted password. If they differ, the encrypted text of new_passwd is saved; otherwise MOREINFO="NONE"sp_password fails and returns this message.MOREINFO="NONE"Password correctly set.REMAP="UN--Under"The password was successfully changed. Use the new password the next time you log in to SQL Server. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_password to change his or her own password. Only a System Security Officer can use MOREINFO="NONE"sp_password to change other users' passwords. Tables UsedREMAP="BO--Body"master.dbo.syslogins, sysobjects See AlsoSystem procedures     LINKEND="X25636"sp_addlogin
, LINKEND="X68639"sp_adduser
ID="IN4328841815"sp_password system procedure
ID="IN439812116"Passwordssp_password
ID="IN438782417"Changinguser's password;Logins:password change;Users:password change
 Topics     LINKEND="X96191"Roles
,LINKEND="X16582"Login Management
ID="IN4331742818"sp_placeobject system procedureID="X20401"sp_placeobjectID="IN4416703320"Space allocationfuture;Space allocation:sp_placeobject procedure
ID="IN4482653821"Future space allocation. See sp_placeobject system procedure; Space allocation
ID="IN446624122"Tablessp_placeobject space allocation for
ID="IN447594423"Indexessp_placeobject space allocation for
ID="IN448564724"SegmentsSegmentsSee also Database devices; Log segment; Space allocation!see also Database devices; Log segment; Space allocation
ID="IN445535025"SpaceSpaceSee also Size; Space allocation!see also Size; Space allocation
ID="IN4416505326"Space allocationSpace allocationSee also Database devices; Segments!see also Database devices; Segments
Puts future space allocations for a table or index on a particular segment. FORMAT="LINESPECIFIC"sp_placeobject segname, objnameParametersREMAP="RI--RefIndent"segname - is the name of the segment on which to locate the table or index. objname - is the name of the table or index for which to place subsequent space allocation on the segment segname. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_placeobject indexes, 'employee.employee_nc' REMAP="UN--Under"This command places all subsequent space allocation for the index named employee_nc on table employee on the segment named indexes. CommentsID="IN4413505331"System tablesspace allocationMARK="BULL" REMAP="BU--Bullet"You cannot change the location of future space allocations for system tables. Placing a table or index on a particular segment does not affect the location of any existing table or index data. It only affects future space allocation. Changing the segment used by a table or index can spread the data among multiple segments. You can specify a segment if you create a table or index with MOREINFO="NONE"create table or MOREINFO="NONE"create index. If you do not specify a segment, the data goes on the default segment. ID="IN447505332"Indexessplitting;Splitting:table or index;Tables:splitting
ID="IN4423485533"Fragments, device spacesp_placeobject andWhen MOREINFO="NONE"sp_placeobjectID="IN4435465734"dbcc (Database Consistency Checker)space allocation and
 splits a table or index across more than one disk fragment, the diagnostic command MOREINFO="NONE"dbcc displays messages about the data that resides on fragments that were in use for storage before MOREINFO="NONE"sp_placeobject executed. Ignore these messages. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"`objname' is now on segment `segname'.REMAP="UN--Under"The command was successful. Data for the objname is now put onto the segment segname. MOREINFO="NONE"There is no index named `indexname' for table `tablename'.REMAP="UN--Under"The index referenced in the objname parameter does not exist. Use the system procedure MOREINFO="NONE"sp_helpindex to list a table's indexes. MOREINFO="NONE"There is no such segment as segname.REMAP="UN--Under"The segname you have referenced is not a segment. All segments for a database are listed in the syssegments table. Use MOREINFO="NONE"sp_helpsegment to get a report on all segments. MOREINFO="NONE"There is no table named `tablename'.REMAP="UN--Under"The table referenced in the objname parameter does not exist. Use the system procedure MOREINFO="NONE"sp_help for a list of existing tables. MOREINFO="NONE"You do not own table `tablename'.REMAP="UN--Under"Only the table owner, the Database Owner, or a System Administrator can place a table or its index on a segment. MOREINFO="NONE"Use sp_logdevice to move syslogs table.MOREINFO="NONE"You can't move system tables.REMAP="UN--Under"System tables must remain on the system segment.PermissionsREMAP="BO--Body"Only the table owner, Database Owner, or a System Administrator can execute MOREINFO="NONE"sp_placeobject.Tables UsedREMAP="BO--Body"sysindexes, sysobjects, syssegments See AlsoCommands     LINKEND="X60179"dbcc
 System procedures     LINKEND="X62957"sp_addsegment
, LINKEND="X10014"sp_dropsegment
, LINKEND="X53708"sp_extendsegment
, LINKEND="X91431"sp_help
, LINKEND="X87980"sp_helpindex
, LINKEND="X36403"sp_helpsegment
ID="IN4431426139"sp_placeobject system procedure
ID="IN4416386540"Space allocationfuture;Space allocation:sp_placeobject procedure
ID="IN447356841"Indexessp_placeobject space allocation for
ID="IN446327142"Tablessp_placeobject space allocation for
 ID="IN4430287543"sp_primarykey system procedureID="X43109"sp_primarykeyID="IN4512267845"Primary keyssp_primarykey definition of
ID="IN456267846"Tablesprimary keys on
ID="IN455267847"Viewsprimary keys on
Defines a primary key on a table or view. FORMAT="LINESPECIFIC"sp_primarykey tabname, col1 [, col2, col3, ..., col8] ParametersREMAP="RI--RefIndent"tabname - is the name of the table or view on which to define the primary key. ID="IN457267850"Columnsprimary key
col1 - is the name of the first column that makes up the primary key. The primary key can consist of one to eight columns. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_primarykey authors, au_id REMAP="UN--Under"Defines the au_id field as the primary key of the table authors. sp_primarykey employees, lastname, firstname REMAP="UN--Under"Defines the combination of the fields lastname and firstname as the primary key of the table employees. CommentsID="IN4511208453"Keys, tablesyskeys table;syskeys table:sp_primarykey andMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_primarykey adds the key to the syskeys table. Only the owner of a table or view can define its primary key. Create keys to make explicit a logical relationship that is implicit in your database design. An application program can use the information. A table or view can have only one primary key. To display a report on the keys that have been defined, execute MOREINFO="NONE"sp_helpkey. The installation process runs MOREINFO="NONE"sp_primarykey on the appropriate columns of the system tables. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"New primary key added. REMAP="UN--Under"You successfully defined a new primary key.MOREINFO="NONE"The table or view named doesn't exist in the current database.REMAP="UN--Under"The table or view supplied as the tabname parameter doesn't exist in the current database. MOREINFO="NONE"Only the owner of the table may define a primary key.REMAP="UN--Under"You aren't the owner of the table or view and, therefore, cannot define its primary key. MOREINFO="NONE"Primary key already exists on table -- drop key first.REMAP="UN--Under"A table or view can have only have one primary key; one already exists on the table or view supplied as the tabname parameter. MOREINFO="NONE"Table or view name must be in the current database.REMAP="UN--Under"You can only define a primary key for a table in the current database.MOREINFO="NONE"The table has no such nthMOREINFO="NONE" column.REMAP="UN--Under"The column name supplied as one of the column names isn't a column in tabname. PermissionsREMAP="BO--Body" Only the owner of a table or view can execute MOREINFO="NONE"sp_primarykey.Tables UsedREMAP="BO--Body"syscolumns, syskeys, sysobjects See AlsoCommands     LINKEND="X19955"create trigger
 System procedures     LINKEND="X22659"sp_commonkey
, LINKEND="X18196"sp_dropkey
, LINKEND="X50021"sp_foreignkey
, LINKEND="X90336"sp_helpjoins
, LINKEND="X44026"sp_helpkey
ID="IN4530168858"sp_primarykey system procedure
 ID="IN4529129259"sp_procxmode system proceduresp_procxmodeID="IN461299661"Transactionsmodes, sp_procxmode
ID="IN461769962"Stored procedureschanging transaction modes with sp_procxmode
Displays or changes the transaction modes associated with stored procedures. FORMAT="LINESPECIFIC"sp_procxmode [procedure_name [, transaction_mode]]ParametersREMAP="RI--RefIndent"procedure_name - is the name of the stored procedure whose transaction mode you are examining or changing.transaction_mode - is the new transaction mode for the stored procedure. The valid values are "chained", "unchained", and "anymode".ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_procxmodeREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"procedure name      user name   transaction mode------------------  ---------   ----------------byroyalty           dbo         Unchaineddiscount_proc       dbo         Unchainedhistory_proc        dbo         Unchainedinsert_sales_proc   dbo         Unchainedinsert_detail_proc  dbo         Unchainedstoreid_proc        dbo         Unchainedstorename_proc      dbo         Unchainedtitle_proc          dbo         Unchainedtitleid_proc        dbo         UnchainedREMAP="UN--Under"Displays the transaction mode for all stored procedures in the current database.sp_procxmode byroyaltyREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"procedure name                   transaction mode ------------------------------   ---------------- byroyalty                        Unchained REMAP="UN--Under"Displays the transaction mode of the stored procedure byroyalty.sp_procxmode byroyalty, "chained"REMAP="UN--Under"Changes the transaction mode for the stored procedure byroyalty in the pubs2 database from "unchained" to "chained".CommentsMARK="BULL" REMAP="BU--Bullet"You must be the owner of the stored procedure, the owner of the database which contains the stored procedure, or the System Administrator in order to change the transaction mode of a stored procedure. The Database Owner or System Administrator can change the mode of another user's stored procedure by qualifying it with the database and user name. For example:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_procxmode "otherdb.otheruser.newproc", "chained"ID="IN4624410167"Chained transaction modesp_procxmode andTo use MOREINFO="NONE"sp_procxmode, turn off chained transaction mode using the MOREINFO="NONE"chained option of the MOREINFO="NONE"set command. By default, this option is turned off.When you useMOREINFO="NONE" sp_procxmode with no parameters, it reports the transaction modes of every stored procedure in the current database.To examine a stored procedure's transaction mode (without changing it), enter:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_procxmode procedure_nameTo change a stored procedure's transaction mode, enter:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_procxmode procedure_name, transaction_modeWhen you create a stored procedure, SQL Server tags it with the current session's transaction mode. This means:MARK="DASH" REMAP="BS--BulletSub"You can execute "chained" stored procedures only in sessions using chained transaction modes.You can execute "unchained" stored procedures only in sessions using unchained transaction mode.REMAP="UN--Under"To execute a particular stored procedure in either chained or unchained sessions, set its transaction mode to "anymode".If you attempt to run a stored procedure under the wrong transaction mode, SQL Server returns a warning message, but the current transaction, if any, is not affected.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"The new transaction-mode must be unchained, chained, or anymodeMOREINFO="NONE".REMAP="UN--Under"You specified and invalid mode.MOREINFO="NONE"The specified object is not a stored procedure in the current database.REMAP="UN--Under"You specified an invalid object name.MOREINFO="NONE"You must be either the system administrator (SA), the database administrator (dbo), or the owner of this stored procedure to change its transaction mode.REMAP="UN--Under"You do not have the correct permissions.MOREINFO="NONE"You cannot change the mode of a remote stored procedure.PermissionsREMAP="BO--Body"Only a System Administrator, the Database Owner, or the owner of the procedure can change its transaction mode.Tables UsedREMAP="BO--Body"#tranmode, sysobjects See AlsoCommands     LINKEND="X53982"begin transaction
,MOREINFO="NONE"commit transaction
,MOREINFO="NONE"transaction
,LINKEND="X91510"rollback
, LINKEND="X64136"set
 Topics     LINKEND="X19352"Transactions
, LINKEND="X44102"Variables (Local and Global)
 REMAP="BO--Body"sp_recompileID="IN43179393"Stored proceduressp_recompile and
ID="IN43990124"Compilingsp_recompile and
ID="IN43887155"Triggerssp_recompile and
ID="IN43684186"Tablessp_recompile and
ID="IN431383197"Recompilationstored procedures
Causes each stored procedure and trigger that uses the named table to be recompiled the next time it runs. FORMAT="LINESPECIFIC"sp_recompile MOREINFO="NONE"tabnameParametersREMAP="RI--RefIndent"tabname - is the name of a table in the current database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_recompile titlesREMAP="UN--Under"Recompiles each trigger and stored procedure that uses the table titles the next time the trigger or stored procedure runs. CommentsID="IN437822012"Queriescompilation and optimization;Optimization of queries, sp_recompileMARK="BULL" REMAP="BU--Bullet"The queries used by stored procedures and triggers are optimized only once, when they are compiled. As you add indexes or make other changes to your database that affect its statistics, your compiled stored procedures and triggers may lose efficiency. By recompiling the stored procedures and triggers that act on a table, you can optimize the queries for greatest efficiency. MOREINFO="NONE"sp_recompile looks for tabname in the current database only. You cannot use MOREINFO="NONE"sp_recompile on system tables. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object `objname' is not a table.REMAP="UN--Under"The specified table does not exist in the current database. MOREINFO="NONE"Table or view name must be in current database.REMAP="UN--Under"You can only useMOREINFO="NONE" sp_recompile on objects in the current database. MOREINFO="NONE"`tabname'is a system table. Cannot use sp_recompile on system tables.REMAP="UN--Under"MOREINFO="NONE"sp_recompile is only allowed on user tables. MOREINFO="NONE"You do not own table tabname.REMAP="UN--Under"You can only useMOREINFO="NONE" sp_recompile on tables that you own. If you are a System Administrator, you can run MOREINFO="NONE"sp_recompile on any table. MOREINFO="NONE"Each stored procedure and trigger that uses table `tabname' will be recompiled the next time it is executed.REMAP="UN--Under"MOREINFO="NONE"sp_recompile ran successfully. All stored procedures and triggers that use the named table recompile the next time they run. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_recompile.Tables UsedREMAP="BO--Body"sysobjectsID="IN4329782416"sp_recompile system procedure
ID="IN439752717"Compilingsp_recompile and
ID="IN4317723018"Stored proceduressp_recompile and
ID="IN436693319"Tablessp_recompile and
ID="IN438663620"Triggerssp_recompile and
 See AlsoCommands     LINKEND="X58868"create index
ID="INA4313653722"Recompilationstored procedures
 ID="IN4325624023"sp_remap system proceduresp_remapID="IN448614225"Triggersremapping
ID="IN4426594426"Remapping database objectsremapping
ID="IN4417584527"Stored proceduresremapping
ID="IN445574628"Rulesremapping
ID="IN448554829"Defaultsremapping;Views:remapping
Remaps a Release 4.8 or later stored procedure, trigger, rule, default, or view to be compatible with Release 10.0. UseMOREINFO="NONE" sp_remap on objects that the Release 10.0 upgrade procedure failed to remap.FORMAT="LINESPECIFIC"sp_remap object_nameParametersREMAP="RI--RefIndent"object_name - is the name of a stored procedure, trigger, rule, default, or view in the current database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_remap myprocREMAP="UN--Under"Remaps a stored procedure called myproc.sp_remap "my_db..default_date"REMAP="UN--Under"Remaps a rule called default_date. Execute a MOREINFO="NONE"use statement to open the correct database before running MOREINFO="NONE"sp_remap.CommentsMARK="BULL" REMAP="BU--Bullet"If MOREINFO="NONE"sp_remap fails to remap an object, drop the object from the database and recreate it. Before running MOREINFO="NONE"sp_remap on an object, it is a good idea to copy its definition into an operating system file with the MOREINFO="NONE"defncopy utility. For more information about MOREINFO="NONE"defncopy, see the SQL Server Utility Programs for your operating system.MOREINFO="NONE"sp_remap can cause your transaction log to fill rapidly. Before running MOREINFO="NONE"sp_remap, use the MOREINFO="NONE"dump transaction command to dump the transaction log, as needed.Only a System Administrator or the owner of an object or can remap the object withMOREINFO="NONE" sp_remap.You can use MOREINFO="NONE"sp_remap only on objects in the current database.MOREINFO="NONE"sp_remap makes no changes to objects that have already been upgraded to Release 10.0.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object does not exist in this database.REMAP="UN--Under"The object you tried to remap does not exist in the current database. Issue a MOREINFO="NONE"use database statement to open the correct database, then re-execute MOREINFO="NONE"sp_remap.MOREINFO="NONE"DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) authorization.REMAP="UN--Under"MOREINFO="NONE"sp_remap executed the MOREINFO="NONE"remap option of the MOREINFO="NONE"dbcc command.MOREINFO="NONE"You do not own object object_name
MOREINFO="NONE".REMAP="UN--Under"Only the owner of an object can remap it.MOREINFO="NONE"Remapping utility - procedure is corrupted in Sysprocedures. Recreate this procedure.REMAP="UN--Under"MOREINFO="NONE"sp_remap cannot remap this object. Drop the object from the database and recreate it.MOREINFO="NONE"Remapping utility - a pointer exists in a tree when it should not.REMAP="UN--Under"MOREINFO="NONE"sp_remap cannot remap this object. Drop the object from the database and recreate it.MOREINFO="NONE"Remapping utility - unable to locate the given procedure procedure_name
MOREINFO="NONE" in Sysprocedures.REMAP="UN--Under"MOREINFO="NONE"sp_remap cannot remap this object. Drop the object from the database and recreate it.MOREINFO="NONE"Remapping utility -- Procedure needs to be recreated for this port.REMAP="UN--Under"MOREINFO="NONE"sp_remap cannot remap this object. Drop the object from the database and recreate it.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_remap.Tables UsedREMAP="BO--Body"master.dbo.sysdatabases, sysobjectsSee AlsoCommands     LINKEND="X81463"create default
, LINKEND="X52197"create procedure
,LINKEND="X43186"create rule
, LINKEND="X19955"create trigger
,LINKEND="X30101"create view
, LINKEND="X97463"drop default
,LINKEND="X21497"drop procedure
, LINKEND="X62555"drop rule
, LINKEND="X48835"drop trigger
, LINKEND="X31140"drop view
, LINKEND="X47924"dump transaction
 Utility Programs     MOREINFO="NONE"defncopy
ID="IN4432515238"sp_remoteoption system procedureID="X26974"sp_remoteoptionID="IN4513485640"Remote loginssp_remoteoption for
ID="IN4514455941"Remote serverssp_remoteoption and
ID="IN456455942"Loginsoptions for remote
Displays or changes remote login options. FORMAT="LINESPECIFIC"sp_remoteoption [MOREINFO="NONE"remote_server, MOREINFO="NONE"login_name,MOREINFO="NONE"remote_name, MOREINFO="NONE"opt_name, {true | false}]ParametersREMAP="RI--RefIndent"remote_server - is the name of the remote server that has the remote login to which to apply the option. login_name - is the login name that identifies the remote login for the remote_server, login_name, remote_name combination. remote_name - is the remote user name that identifies the remote login for the remote_server, login_name, remote_name combination. ID="IN4531416345"trusted option, sp_remoteoption
opt_name ID="IN4513416346"Remote loginstrusted or untrusted mode
ID="IN459416347"Passwordstrusted logins or verifying
ID="IN459396548"Passwordssp_remoteoption and
- is the name of the option you want to turn on or off. Currently there is only one option, MOREINFO="NONE"trustedID="IN4571347049"Checking passwords. See Passwords; sp_remoteoption system procedure
, which means that the local server accepts remote logins from other servers without user-access verification for the particular remote login. The default is to use password verification. SQL Server understands any unique string that is part of the option name. Use quotes around the option name if it includes embedded blanks. ID="IN4520317350"true | false clausessp_remoteoption
MOREINFO="NONE"true | MOREINFO="NONE"false - MOREINFO="NONE"true turns the option on, MOREINFO="NONE"false turns it off. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_remoteoption REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Settable remote login options.  remotelogin_option ------------------------ trustedREMAP="UN--Under"Displays a list of the remote login options.sp_remoteoption GATEWAY, churchy, pogo, trusted, trueREMAP="UN--Under"Defines the remote login from the remote server GATEWAY to be MOREINFO="NONE"trusted (that is, the password is not checked). sp_remoteoption GATEWAY, churchy, pogo, trusted, false REMAP="UN--Under"Defines the remote login from the remote server GATEWAY to be untrusted (that is, the password is checked). CommentsMARK="BULL" REMAP="BU--Bullet"To display a list of the remote login options, execute MOREINFO="NONE"sp_remoteoption with no parameters. See the System Administration Guide for additional details on remote login options. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Option `opt_name
MOREINFO="NONE"' turned off.REMAP="UN--Under"The procedure was successful.MOREINFO="NONE"Option `opt_name
MOREINFO="NONE"' turned on.REMAP="UN--Under"The procedure was successful.MOREINFO="NONE"Remote login option doesn't exist or can't be set by user.Run sp_remoteoption with no parameters to see options. REMAP="UN--Under"Either the option doesn't exist, or the user does not have permission to turn it on or off. MOREINFO="NONE"Remote login option is not unique.REMAP="UN--Under"The name supplied as the opt_name parameter is not unique. No remote login option value was changed. The complete names that match the string supplied appear, so you can see how to make opt_name more specific. MOREINFO="NONE"Settable remote login options.REMAP="UN--Under"Executing MOREINFO="NONE"sp_remoteoption with no parameters displays a list of options the user can set. (See Example 1.) MOREINFO="NONE"There is no remote user `remote_name
MOREINFO="NONE"' mapped to local user `login_name
' from the remote server `remote_server'.REMAP="UN--Under"You incorrectly identified the remote login or the remote server name. Run MOREINFO="NONE"sp_helpremotelogin to list the remote logins. Run MOREINFO="NONE"sp_helpserver to list the remote servers.MOREINFO="NONE"Usage: sp_remoteoption [remoteserver, loginame, remotename, optname, {true | false}]REMAP="UN--Under"Either the opt_name parameter was omitted or the opt_value parameter not MOREINFO="NONE"true or MOREINFO="NONE"false. PermissionsREMAP="BO--Body"Only System Security Officers can execute MOREINFO="NONE"sp_remoteoption. Tables UsedREMAP="BO--Body"master.dbo.spt_values, master.dbo.sysmessages, master.dbo.sysremotelogins, master.dbo.sysservers, sysobjects See AlsoSystem procedures     LINKEND="X68669"sp_helpremotelogin
ID="IN4532277757"sp_remoteoption system procedure
ID="IN4514248058"Remote serverssp_remoteoption and
ID="IN4513218359"Remote loginssp_remoteoption for
 ID="IN4526178760"sp_rename system procedure
ID="IN458129261"RenamingRenamingSee also sp_rename system procedure!see alsoID="X37949"sp_renameID="IN46779863"Indexesrenaming;Columns:renaming;Tables:renaming;Triggers:renaming;Views:renaming
ID="IN468510064"Renaming
ID="IN465410165"Nameschanging database object
Changes the name of a user-created object in the current database. FORMAT="LINESPECIFIC"sp_rename MOREINFO="NONE"objname, MOREINFO="NONE"newname ParametersREMAP="RI--RefIndent"ID="IN4616210368"Database objectsrenaming;Defaults:renaming
objname ID="IN465010569"Rulesrenaming;Stored procedures:renaming
ID="IN4617-310870"Check constraintsrenaming;Referential integrity constraints:renaming;Constraints:renaming
- is the original name of the user-created object (table, view, column, stored procedure, index, trigger, default, rule, check constraint, or referential constraint) or datatype. If the object to rename is a column in a table, objname must be in the form "table.column". REMAP="UN--Under"You can only rename an object in the current database, and only if you own it. This rule holds for the Database Owner and System Administrator as well as for other users. newname - is the new name of the object or datatype. Names of objects and datatypes must conform to the rules for identifiers and be unique to the current database. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_rename titles, booksREMAP="UN--Under"Renames the titles table to books. sp_rename "books.title", bookname REMAP="UN--Under"Renames the title column in the books table to bookname. sp_rename tid, bookid REMAP="UN--Under"Renames the user-defined datatype tid to bookid. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_rename changes the name of a user-created object or datatype. You can only change the name of an object or datatype in the current database. When you are renaming a column, you must leave off the table name prefix from the new column name or SQL Server does not accept the new name. See Example 2. You cannot change the names of system objects and system datatypes. ID="IN4629-310873"Dependencies, database objectrecompilation and
ID="IN4616-310874"Database objectsdependencies of, and recompilation
ID="IN468-310875"Renamingwarnings about
ID="IN4613-310876"Recompilationdependent objects definition and;Recompilation:without noticeProcedures, triggers, and views that depend on an object whose name has been changed work until they are recompiled. Recompilation takes place for many reasons, and without notification to the user. Also, the old object name appears in query results until the user changes and recompiles the procedure, trigger, or view. Change the definitions of any dependent objects when you execute MOREINFO="NONE"sp_rename. Find dependent objects with MOREINFO="NONE"sp_depends. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Column name has been changed.REMAP="UN--Under"The specified column name was renamed to newname. MOREINFO="NONE"Index name has been changed.REMAP="UN--Under"The specified index name was renamed to newname. MOREINFO="NONE"Name of user-defined type name changed.REMAP="UN--Under"The specified user-defined datatype was renamed to newname. MOREINFO="NONE"Newname already exists in sysobjects.REMAP="UN--Under"The object named in newname already exists. Object names must be unique to the database. MOREINFO="NONE"Newname already exists in systypes.REMAP="UN--Under"The datatype named in newname already exists. Datatype names must be unique to the database. MOREINFO="NONE"newname is not a valid name.REMAP="UN--Under"newname does not conform to the rules for identifiers. MOREINFO="NONE"Object must be in the current database.REMAP="UN--Under"The name supplied for the objname parameter included a reference to a database. The object must be in the current database. MOREINFO="NONE"Object name cannot be changed either because it does not exist in this database, or you don't own it, or it is a system name.REMAP="UN--Under"No object of the specified name exists, or you don't own the object. MOREINFO="NONE"Object name has been changed.REMAP="UN--Under"The specified object was renamed to newname. MOREINFO="NONE"There is already a column named `newname
MOREINFO="NONE"' in table `tablename
MOREINFO="NONE"'.REMAP="UN--Under"Column names must be unique within a table. The table already contains a column with the name you chose.MOREINFO="NONE"Table or view names beginning with `#' are not allowed.REMAP="UN--Under"You cannot begin the name of a table or view with "#". MOREINFO="NONE"There is already an index named `newname
MOREINFO="NONE"' for table `tablename
MOREINFO="NONE"'.REMAP="UN--Under"Index names for a table must be unique. The table already has an index with the name you chose.MOREINFO="NONE"You do not own a table, column or index of that name in the current database.REMAP="UN--Under"No column of the specified name exists in the specified table, or you don't own the table. PermissionsREMAP="BO--Body"Users can execute MOREINFO="NONE"sp_rename for their own objects. Only the Database Owner and a System Administrator can execute MOREINFO="NONE"sp_rename for all objects. Tables UsedREMAP="BO--Body"syscolumns, sysindexes, sysobjects, systypes See AlsoCommands     LINKEND="X68185"alter table
, LINKEND="X81463"create default
, LINKEND="X52197"create procedure
, LINKEND="X43186"create rule
, LINKEND="X80969"create table
, LINKEND="X19955"create trigger
,LINKEND="X30101"create viewSystem procedures     LINKEND="X32817"sp_addtype
, LINKEND="X60474"sp_checkreswords
, LINKEND="X55445"sp_depends
, LINKEND="X99854"sp_renamedbTopics     LINKEND="X84316"Datatypes
ID="IN4626-711281"sp_rename system procedure
ID="IN468-911482"Renaming
ID="IN467-1411983"Indexesrenaming;Columns:renaming;Tables:renaming;Triggers:renaming;Views:renaming
ID="IN4617-1712284"Check constraintsrenaming;Referential integrity constraints:renaming;Constraints:renaming
ID="IN465-1812385"Nameschanging database object
ID="IN465-2012586"Rulesrenaming;Stored procedures:renaming
ID="IN4616-2212787"Database objectsrenaming;Defaults:renaming
 ID="IN4628-2613188"sp_renamedb system procedureID="X99854"sp_renamedbID="IN479-2813490"Databasesrenaming;Renaming:a database
Changes the name of a database. You cannot rename system databases or databases with external referential integrity constraints.FORMAT="LINESPECIFIC"sp_renamedb MOREINFO="NONE"dbname, MOREINFO="NONE"newname ParametersREMAP="RI--RefIndent"dbname - is the original name of the database. newname - is the new name of the database. Database names must conform to the rules for identifiers and must be unique. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_renamedb accounting, financialREMAP="UN--Under"Renames the accounting database to financial. CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_renamedb changes the name of a database. ID="IN4716-3013695"Single-user modesp_renamedb andThe System Administrator must place a database in single-user mode with MOREINFO="NONE"sp_dboption before renaming it, and restore it to multi-user mode afterwards. MOREINFO="NONE"sp_renamedb fails if any table in the database references, or is referenced by, a table in another database. Use the following query to determine which tables and external databases have foreign key constraints on primary key tables in the current database:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select object_name(tableid), db_name(frgndbname)from sysreferenceswhere frgndbname is not nullREMAP="UN--Under"Use the following query to determine which tables and external  databases have primary key constraints for foreign key tables in the current  database:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select object_name(reftabid), db_name(pmrydbname) from sysreferenceswhere pmrydbname is not nullREMAP="UN--Under"UseMOREINFO="NONE" alter table to drop the cross-database constraints in these tables, then rerun MOREINFO="NONE"sp_renamedb. ID="IN478-3013696"Renamingwarnings about
ID="IN4717-3013697"Stored proceduresrenamed database and
ID="IN478-3013698"Triggersrenamed database and
ID="IN475-3013699"Viewsrenamed database andProcedures, triggers, and views that depend on a database whose name has been changed work until they are recompiled. Recompilation takes place for many reasons, and without notification to the user. When SQL Server recompiles the procedure, trigger, or view, it no longer works. Change the definitions of any dependent objects when you execute MOREINFO="NONE"sp_renamedb. Find dependent objects withMOREINFO="NONE" sp_depends. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"A database with the new name already exists.REMAP="UN--Under"The database you specified for the MOREINFO="NONE"newname parameter is already a database. Database names must be unique. MOREINFO="NONE"Can't run sp_renamedb from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_renamedb modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"Database 'database_name
MOREINFO="NONE"' has references to other databases. Drop those references and try again.REMAP="UN--Under"You cannot rename a database if any of its tables references-or is referenced by-a table in another database. Before renaming the database, you must useMOREINFO="NONE" alter table to drop any external referential integrity constraints.MOREINFO="NONE"Database is renamed and in single-user mode. System Administrator (SA) must reset it to multi-user mode with sp_dboption. REMAP="UN--Under"MOREINFO="NONE"sp_renamedb succeeded.newname
MOREINFO="NONE" is not a valid name.REMAP="UN--Under"The value for newname does not conform to the rules for identifiers. MOREINFO="NONE"The databases `master', `model', and `tempdb' cannot be renamed.REMAP="UN--Under"You cannot rename system databases.MOREINFO="NONE"The specified database does not exist.REMAP="UN--Under"The database you specified with the dbname parameter doesn't exist. MOREINFO="NONE"System Administrator (SA) must set database 'dbname
MOREINFO="NONE"' to single-user mode with sp_dboption before using sp_renamedb.REMAP="UN--Under"You can't rename a database while someone is using it, and you must make sure that no one tries to use the database while it is being renamed.PermissionsREMAP="BO--Body"Only System Administrators can execute MOREINFO="NONE"sp_renamedb. Tables UsedREMAP="BO--Body"master.dbo.spt_values, master.dbo.sysdatabases, sysobjects See AlsoCommands     LINKEND="X75308"create database
 System procedures     LINKEND="X78355"sp_changedbowner
, LINKEND="X29657"sp_dboption
, LINKEND="X55445"sp_depends
, LINKEND="X90458"sp_helpdb
, LINKEND="X37949"sp_rename
ID="IN4728-34140104"sp_renamedb system procedure
ID="IN479-36142105"Databasesrenaming;Renaming:a database
 ID="IN4731-40146106"sp_reportstats system procedureID="X30761"sp_reportstats ID="IN4821-43150108"Chargeback accountingsp_reportstats procedure
ID="IN4810-46153109"Statisticssp_reportstats
ID="IN4810-49156110"Accountingsp_reportstats procedure
Reports statistics on system usage. FORMAT="LINESPECIFIC"sp_reportstats [MOREINFO="NONE"user_name]ParametersREMAP="BO--Body"user_name - is the login name of a user to show accounting totals for.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_reportstatsREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Name    Since         CPU     Percent CPU  I/O     Percent I/O ------  -----------   -----   ------------ -----   ------------- probe   jun 19 1993   0       0%           0       0% julie   jun 19 1993   10000   24.9962%     5000    24.325% jason   jun 19 1993   10002   25.0013%     5321    25.8866% ken     jun 19 1993   10001   24.9987%     5123    24.9234% kathy   jun 19 1993   10003   25.0038%     5111    24.865%  (5 rows affected)               Total CPU   Total I/O               ---------   ---------               40006       20555                (1 row affected, return status = 0)REMAP="UN--Under"Displays a report of current accounting totals for all SQL Server users. sp_reportstats kathy REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Name    Since         CPU     Percent CPU   I/O     Percent I/O ------  -----------   -----   ------------  -----   ------------- kathy   Jul 24 1993   498     49.8998%      48392   9.1829%  (1 row affected) REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Total CPU   Total I/O ---------   ---------- 998         98392  (1 row affected, return status = 0)REMAP="UN--Under"Displays a report of current accounting totals for user "kathy." CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_reportstats prints out the current accounting totals for all logins, as well as each login's individual statistics and percentage of the overall statistics. Statistics for any process with an suid of 1-sa, checkpoint, network, and mirror handlers-are not recorded. ID="IN486-49156115"Loginsaccounting statistics;Users:accounting statistics
MOREINFO="NONE"sp_reportstats accepts one parameter, the login name of the account to report. With no parameters, MOREINFO="NONE"sp_reportstats reports on all accounts. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"No login with the specified name exists.REMAP="UN--Under"Check the spelling of the user's name.PermissionsREMAP="BO--Body"Only System Administrators can execute MOREINFO="NONE"sp_reportstats. Tables UsedREMAP="BO--Body"master.dbo.syslogins, sysobjects See AlsoSystem procedures     LINKEND="X43748"sp_clearstats
, LINKEND="X60334"sp_configure
ID="IN4824-53160120"sp_role system procedureID="X39296"sp_roleID="IN495-54162122"Rolesgranting
ID="IN495-55163123"Rolesrevoking
ID="IN4927-58166124"Revoking roles with sp_role
ID="IN4927-61169125"Granting roles with sp_role
Grants or revokes roles to a SQL Server login account. FORMAT="LINESPECIFIC"sp_role {"grant" | "revoke"}, {sa_role | sso_role | oper_role}, login_nameParametersREMAP="RI--RefIndent"ID="IN4912-65173129"grant optionsp_role
MOREINFO="NONE"grant | MOREINFO="NONE"revoke - specifies whether to grant the role to or revoke the role from login_name.ID="IN4920-65173130"System Administratorassigning role
MOREINFO="NONE"sa_role |ID="IN4923-65173131"System Security Officerassigning role
MOREINFO="NONE" sso_roleID="IN498-65173132"Operatorassigning role
 | MOREINFO="NONE"oper_role - is the level of role to grant or revoke.login_name - is the login account to which to grant or revoke the role.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_role "grant", sa_role, alexanderREMAP="UN--Under"Grants the System Administrator role to the login account named "alexander".CommentsMARK="BULL" REMAP="BU--Bullet"You cannot revoke the System Security Officer role from the server's last remaining System Security Officer account. Similarly, you cannot revoke the System Administrator role from the last remaining System Administrator account.When you grant a role to a user, it takes effect the next time the user logs into SQL Server. However, the user can immediately enable the role by using the MOREINFO="NONE"set role command. For example, the following command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set role "sa_role" onREMAP="UN--Under"enables the System Administrator role for the user.You cannot revoke a role from a user while the user is logged in.When users log in, all roles that have been granted to them are automatically active. To turn off a role, use the MOREINFO="NONE"set command. For example, to deactivate the System Administrator role, use the following command:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"set role "sa_role" offMessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_role from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_role modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"No such account -- nothing changed.REMAP="UN--Under"The login name you specified does not exist.MOREINFO="NONE"Invalid role -- nothing changed.REMAP="UN--Under"You specified a role that does not exist.MOREINFO="NONE"Cannot revoke SSO or SA role from the last remaining unlocked SSO or SA login.REMAP="UN--Under"There must always be at least one unlocked System Security Officer and System Administrator account.MOREINFO="NONE"Neither `grant' nor `revoke' is specified -- nothing changed.REMAP="UN--Under"Specify either MOREINFO="NONE"grant or MOREINFO="NONE"revoke.MOREINFO="NONE"Role updated.REMAP="UN--Under"MOREINFO="NONE"sp_role successfully executed.MOREINFO="NONE"Warning: the specified account is active.REMAP="UN--Under"You cannot revoke a role from a user who is currently logged in.PermissionsREMAP="BO--Body"Only a System Administrator can grant the System Administrator role to other users. Only a System Security Officer can grant the System Security Officer or Operator role to other users.Tables UsedREMAP="BO--Body"master.dbo.sysloginroles, master.dbo.syslogins, master.dbo.sysprocesses, master.dbo.syssrvroles, sysobjects See AlsoCommands      LINKEND="X69087"grant
, LINKEND="X29921"revoke
, LINKEND="X64136"setSystem procedures     LINKEND="X68664"sp_displayloginTopics     LINKEND="X96191"Roles
, LINKEND="X80972"System Functions
 REMAP="BO--Body"ID="X71283"sp_serveroptionID="IN4379393"Serversoptions, changing with sp_serveroption
Displays or changes remote server options. FORMAT="LINESPECIFIC"sp_serveroption [MOREINFO="NONE"server, MOREINFO="NONE"optname, {true | false}] ParametersREMAP="RI--RefIndent"server - is the name of the remote server for which to set the option. optname - is the name of the option to set or unset. Currently there are two options: MOREINFO="NONE"net password encryption and MOREINFO="NONE"timeouts.TOCENTRY="1"LBL="Table 4-15:"sp_serveroption OptionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="13*"COLNAME="C2" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OptionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeaningVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"net password encryption COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Specifies whether to initiate connections with a 
remote server with the client side password 
encryption handshake or with the normal 
(unencrypted password) handshake sequence. The 
default is "false", no network encryption.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"timeoutsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"When unset ("false"), disables the normal timeout 
code used by the local server, so the site connection 
handler does not automatically drop the physical 
connection after one minute with no logical 
connection. The default is "true".REMAP="UN--Under"SQL Server understands any unique string that is part of the option name. Use quotes around the option name if it includes embedded blanks. ID="IN432089136"true | false clausessp_serveroption
MOREINFO="NONE"true | MOREINFO="NONE"false - MOREINFO="NONE"true sets the option, MOREINFO="NONE"false unsets the option. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_serveroption REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"Settable server options.server_option      ------------------------ timeouts net password encryptionREMAP="UN--Under"Displays a list of the server options.sp_serveroption GATEWAY, "timeouts", falseREMAP="UN--Under"Tells the server not to time out inactive physical connections with the remote server MOREINFO="NONE"GATEWAY. sp_serveroption GATEWAY,         "net password encryption", true REMAP="UN--Under"Specifies that when making connections to the remote server GATEWAY, GATEWAY sends back an encryption key to encrypt the password to send to it. CommentsMARK="BULL" REMAP="BU--Bullet"To display a list of the user-settable server options, execute MOREINFO="NONE"sp_serveroption with no parameters. Once MOREINFO="NONE"timeouts is set to "false," the site handlers continue to run until one of the two servers is shut down. ID="IN43989139"Passwordsencryption
ID="IN439871510"Passwordssp_serveroption andThe MOREINFO="NONE"net password encryption option allows clients to specify whether to send passwords in plain text or encrypted form over the network when a initiating a remote procedure call. If MOREINFO="NONE"net password encryption is set to "true," the initial login packet is sent without passwords, and the client indicates to the remote server that encryption is desired. The remote server sends back an encryption key, which the client uses to encrypt its passwords. The client then encrypts its passwords, and the remote server uses the key to authenticate them when they arrive.To set network password encryption for a particular MOREINFO="NONE"isql session, you can use the UNIX MOREINFO="NONE"-X or OpenVMS MOREINFO="NONE"/encrypt option to MOREINFO="NONE"isql. See the SQL Server Utility Programs manual for more information.The MOREINFO="NONE"net password encryption option works only between SQL Servers of release 10.0 and later.See the System Administration Guide for additional details on server options. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_serveroption from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_serveroption modifies system tables, so it cannot be run within a transaction.MOREINFO="NONE"No such server -- run sp_helpserver to list servers.REMAP="UN--Under"You specified an incorrect server name. Run MOREINFO="NONE"sp_helpserver to get a list of servers. MOREINFO="NONE"Option can be set for remote servers only -- not the local server.REMAP="UN--Under"You tried to set an option on the local server. MOREINFO="NONE"Server option doesn't exist or can't be set by user.Run sp_serveroption with no parameters to see options.REMAP="UN--Under"Either the option doesn't exist, or you do not have permission to set or unset it. Run MOREINFO="NONE"sp_serveroption with no parameters to display a list of settable options.MOREINFO="NONE"Server option is not unique.REMAP="UN--Under"The name supplied as the optname parameter is not unique. No server option value was changed. MOREINFO="NONE"Usage: sp_serveroption [server, optname, {true | false}]REMAP="UN--Under"Either the optname parameter was omitted or the third parameter was not MOREINFO="NONE"true or MOREINFO="NONE"false. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_serveroption with no parameters to generate a list of the options. Only System Administrators can use the MOREINFO="NONE"timeouts option. Only System Security Officers can use the MOREINFO="NONE"net password encryption option.Tables UsedREMAP="BO--Body"master.dbo.sysservers, sysobjects See AlsoSystem procedures     LINKEND="X45409"sp_helpserver
, LINKEND="X96621"sp_passwordTopics     LINKEND="X16582"Login Management
 ID="IN4332831915"sp_setlangalias system procedureID="X76169"sp_setlangaliasID="IN447812217"Aliasesalternate language;Aliases:language name
ID="IN448812218"Changingalternate language alias
ID="IN4420812219"Languages, alternatealias for
Assigns or changes the alias for an alternate language. FORMAT="LINESPECIFIC"sp_setlangalias MOREINFO="NONE"language, MOREINFO="NONE"aliasParametersREMAP="RI--RefIndent"ID="IN4422812222"Official language nameofficial name
language - is the official language name of the alternate language. ID="IN4421812223"Local alias, language
alias - is the new local alias for the alternate language. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_setlangalias french, francaisREMAP="UN--Under"This command assigns the alias name "francais" for the official language name french. CommentsMARK="BULL" REMAP="BU--Bullet"alias replaces the current value of syslanguages.alias for official name language. ID="IN4411752826"set commandsp_setlangalias and  language optionThe MOREINFO="NONE"set MOREINFO="NONE"language command can use the new alias in place of the official language name. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"language is not an official language name from syslanguages.REMAP="UN--Under"Use MOREINFO="NONE"sp_helplanguage to see a list of official names of alternate languages on this SQL Server. MOREINFO="NONE"alias alias already exists in syslanguages.REMAP="UN--Under"The new alias must be unique. Use MOREINFO="NONE"sp_helplanguage to see a list of official names and aliases available on this SQL Server. MOREINFO="NONE"Language alias not changed.REMAP="UN--Under"An error occurred while updating master.dbo.syslanguages, so the alias was not added. The SQL Server message that appeared before this message provides more information. MOREINFO="NONE"Language alias reset.REMAP="UN--Under"The alias for this alternate language name was changed. PermissionsREMAP="BO--Body"System Administrators can execute MOREINFO="NONE"sp_setlangalias, and can grant permission to others. Tables UsedREMAP="BO--Body"master.dbo.syslanguages, sysobjectsSee AlsoCommands     LINKEND="X64136"set
 System procedures     LINKEND="X44244"sp_addlanguage
, LINKEND="X82772"sp_droplanguage
, LINKEND="X13013"sp_helplanguage
ID="IN4432713231"sp_setlangalias system procedure
ID="IN447693432"Aliasesalternate language;Aliases:language name
 ID="IN4429653833"sp_spaceused system procedureID="X50477"sp_spaceusedID="IN4520653935"Information (Server)space usage
ID="IN455624236"Spacesp_spaceused procedure
ID="IN4516614337"Database objectsspace used by
ID="IN4516604438"Current databasespace used by
Displays the number of rows, the number of data pages, and the space used by one table or by all tables in the current database. FORMAT="LINESPECIFIC"sp_spaceused [MOREINFO="NONE"tablename]ParametersREMAP="RI--RefIndent"tablename - is the name of the table on which to report. If omitted, a summary of space used in the current database appears. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_spaceused titlesREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"name       rowtotal   reserved   data    index_size   unused---------- ---------  ---------  ------- ----------   ----------titles     18         46 KB      6 KB    4 KB         36 KBREMAP="UN--Under"Reports on the amount of space allocated (reserved) for the titles table, the amount used for data, the amount used for index(es), and the available (unused) space.sp_spaceused REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"database_name   database_size --------------- --------------------------- master          5 MB  reserved    data        index_size  unused ---------   ---------   ----------- --------2176 KB     1374 KB     72 KB       730 KBREMAP="UN--Under"Prints a summary of space used in the current database. CommentsID="IN4512584643"Pages (data)computing number of, with sp_spaceusedMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_spaceusedID="IN4511564844"Rows, tablecomputing number of, with sp_spaceused
 computes the number of data pages, and the space used by an object or by each object in the current database. The number of rows, reported as rowtotal, is an estimate. MOREINFO="NONE"sp_spaceusedID="IN456564845"Tablesspace used by
ID="IN457564846"Indexesspace used by
 reports only on the amount of space affected by tables, clustered indexes, and nonclustered indexes. MOREINFO="NONE"sp_spaceused computes the rowtotal value using the MOREINFO="NONE"rowcnt built-in function. This function uses a value for the average number of rows per data page based on a value in the allocation pages for the object. This method is very fast, but the results are estimates, and update and insert activity change actual values. The MOREINFO="NONE"update statistics command, MOREINFO="NONE"dbcc checktable, and MOREINFO="NONE"dbcc checkdb update the rows-per-page estimate, so rowtotal is most accurate after running one of these commands. Always use MOREINFO="NONE"select count(*) if you need exact row counts.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object does not exist in this database.REMAP="UN--Under"The object specified does not exist in the current database. MOREINFO="NONE"Object is stored in `sysprocedures' and has no space allocated directly.REMAP="UN--Under"The object is a trigger, stored procedure, rule, or default.MOREINFO="NONE"Object must be in the current database.REMAP="UN--Under"The object specified is not in the current database. MOREINFO="NONE"Views don't have space allocated.REMAP="UN--Under"MOREINFO="NONE"sp_spaceused reports only on the amount of space taken up by tables, clustered indexes, and nonclustered indexes. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_spaceused.Tables UsedREMAP="BO--Body"#pgcounts, master.dbo.spt_values, master.dbo.sysusages, sysindexes, sysobjects See AlsoCommands     LINKEND="X58868"create index
, LINKEND="X80969"create table
, LINKEND="X93093"drop index
, LINKEND="X58548"drop table
 System procedures     LINKEND="X91431"sp_help
, LINKEND="X87980"sp_helpindex
ID="IN4529525251"sp_spaceused system procedure
ID="IN455495552"Spacesp_spaceused procedure
ID="IN4516485653"Current databasespace used by
ID="IN4516475754"Database objectsspace used by
 ID="IN4526436155"sp_syntax system proceduresp_syntaxID="IN464416457"Helpsp_syntax display
ID="IN4617396658"System proceduresdisplaying syntax of;Utility commands:display syntax
ID="IN466366959"Syntaxdisplay procedure (sp_syntax)
ID="IN468357060"Commandsdisplay syntax of
Displays the syntax of Transact-SQL statements, system procedures, utilities, and other routines (depending on which products and corresponding MOREINFO="NONE"sp_syntaxID="IN4638327361"PC DB-Library. See DB-Library programs
 scripts exist on your server). FORMAT="LINESPECIFIC"sp_syntax {command | fragment} [, module_name][, MOREINFO="NONE"language]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"command - is the full name of a command or routine. To include spaces or Transact-SQL reserved words, enclosed the command in quotes. MOREINFO="NONE"fragment - is any fragment or portion of a command or routine name, such as "help" to list all system procedures providing help.ID="IN467327364"Displaysyntax of modules;Modules, display syntax of
MOREINFO="NONE"module - is the name or partial name of one of the modules, such as "Transact-SQL" or "Utility". Each MOREINFO="NONE"sp_syntax installation script adds different modules. Use MOREINFO="NONE"sp_syntax without any parameters to see which modules exist on your server.language - is the language of the syntax description to retrieve. language must be a valid language name in the syslanguages table. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_syntaxREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"sp_syntax provides syntax help for Sybase products.These modules are installed on this Server:  Module                --------------------  OpenVMS               Transact-SQL          UNIX Utility          System Procedure      Usage: sp_syntax command [, module [, language]]REMAP="UN--Under"Displays all MOREINFO="NONE"sp_syntax modules available on your server.sp_syntax "disk"REMAP="UN--Under"Displays the syntax and functional description of all routines containing the word or word fragment "disk". Since "disk" is a Transact-SQL reserved word, enclose it in quotes.CommentsMARK="BULL" REMAP="BU--Bullet"The text for MOREINFO="NONE"sp_syntaxID="IN4618307567"sybsyntax database
 is in the database sybsyntax. LoadMOREINFO="NONE" sp_syntax and the sybsyntax database onto a server with the installation script described in the System Administration Guide Supplement for your platform. If you cannot access MOREINFO="NONE"sp_syntax, see your System Administrator for information about installing it on your server. You can use wildcards within the command name you are searching for. If you are looking for commands or functions that contain the literal "_", you may get unexpected results, since the wildcard "_" stands for "any single character".MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Can't run sp_syntax from within a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_syntax creates temporary tables, so it cannot be run within a transaction.MOREINFO="NONE"No command or routine has a name like '%command%'REMAP="UN--Under"The command name you used is not in the sybsyntax database.MOREINFO="NONE"No module has a name like '%module%'REMAP="UN--Under"The module name you used is not in the sybsyntax database.MOREINFO="NONE"No command or routine has a name like '%command%' and a module like '%module%'REMAP="UN--Under"The combination of command name and module name is not in the sybsyntax database.MOREINFO="NONE"sp_syntax provides syntax help for Sybase products. MOREINFO="NONE"These modules are installed on this Server:MOREINFO="NONE"Module MOREINFO="NONE" -------------------- MOREINFO="NONE"module_name
MOREINFO="NONE"Usage: sp_syntax command [, module [, language]]REMAP="UN--Under"These help message appear when you use MOREINFO="NONE"sp_syntax with no arguments.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_syntax.Tables UsedREMAP="BO--Body"sybsyntax..sybsyntax, #tempsyntax1, #tempsyntax2ID="IN4626267971"sp_syntax system procedure
ID="IN468258072"Commandsdisplay syntax of
ID="IN466228373"Syntaxdisplay procedure (sp_syntax)
ID="IN4617208574"System proceduresdisplaying syntax of;Utility commands:display syntax
ID="IN4635168975"sp_thresholdaction system procedureID="X67172"sp_thresholdactionID="IN4710169077"Thresholdsdefining default procedure
Executes automatically when the number of free pages on the log segment falls below the last-chance threshold (unless the threshold has been associated with a different procedure). Sybase does not provide this procedure.FORMAT="LINESPECIFIC"REMAP="BO--Body"When a threshold is crossed, SQL Server passes the following parameters to the threshold procedure by position:FORMAT="LINESPECIFIC"sp_thresholdaction @dbname,    @segment_name,    @space_left,    @statusParametersREMAP="RI--RefIndent"@dbname - is the name of a database where the threshold was reached. @segment_name - is the name of the segment where the threshold was reached.@space_left - is the threshold size, in 2K pages.@status - is 1 for the last-chance threshold; 0 for all other thresholds.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"create procedure
sp_thresholdaction   @dbname varchar(30),  @segmentname varchar(30),  @space_left int,  @status intas  dump transaction @dbname to tapedump1REMAP="UN--Under"Creates a threshold procedure for the last-chance threshold that dumps the transaction log to a tape device.CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_thresholdaction must be created by the Database Owner (in a user database) or a System Administrator (in the sybsystemprocs database), or by a user with MOREINFO="NONE"create procedure permission.You can add thresholds and create threshold procedures for any segment in a database. When the last-chance threshold is crossed, SQL Server searches for the MOREINFO="NONE"sp_thresholdaction procedure in the database where the threshold event occurs. If it doesn't exist in that database, SQL Server searches for it in sybsystemprocs. If SQL Server does not find the procedure, it sends an error message to the error log.MOREINFO="NONE"sp_thresholdaction should contain a MOREINFO="NONE"dump transaction command to truncate the transaction log.By design, the last-chance threshold allows enough free space to record a MOREINFO="NONE"dump transaction command. There may not be enough space to record additional user transactions against the database. Only commands that are not recorded in the transaction log (MOREINFO="NONE"select, fast MOREINFO="NONE"bcp, MOREINFO="NONE"readtext, and MOREINFO="NONE"writetext) and commands that might be necessary to free additional log space (MOREINFO="NONE"dump transaction, MOREINFO="NONE"dump database, and MOREINFO="NONE"alter database) can be executed. By default, other commands are suspended and a message sent to the error log. To abort these commands rather than suspending them, use the "MOREINFO="NONE"abort tran on log full" option of MOREINFO="NONE"sp_dboption followed by the MOREINFO="NONE"checkpoint command.Waking Suspended ProcessesMARK="BULL" REMAP="BU--Bullet"Once the MOREINFO="NONE"dump transaction command frees sufficient log space, suspended process automatically awaken and complete.If fast MOREINFO="NONE"bcp, MOREINFO="NONE"writetext, or MOREINFO="NONE"select into has resulted in unlogged changes to the database since the last backup, the last-chance threshold procedure cannot execute a MOREINFO="NONE"dump transaction command. When this occurs, use MOREINFO="NONE"dump database to make a copy of the database, then truncate the transaction log with MOREINFO="NONE"dump transaction.If this does not free enough space to awaken the suspended processes, it may be necessary to increase the size of the transaction log. Use the MOREINFO="NONE"log on option of the MOREINFO="NONE"alter database command to allocate additional log space.As a last resort, System Administrators can use MOREINFO="NONE"sp_who to determine which processes are suspended and the following command to awaken them:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"select lct_admin("unsuspend", db_id)See AlsoCommands     LINKEND="X52197"create procedure
,LINKEND="X47924"dump transaction
 System procedures     LINKEND="X96491"sp_addthreshold
, LINKEND="X29657"sp_dboption
, LINKEND="X39966"sp_dropthreshold
, LINKEND="X36403"sp_helpsegment
, LINKEND="X52248"sp_helpthreshold
, LINKEND="X90993"sp_modifythresholdID="X87638"sp_unbindefaultID="IN4389483"Defaultsunbinding;Unbinding:defaults
ID="IN43229394"User-defined datatypesunbinding defaults from
ID="IN43792105"Columnsunbinding defaults from
ID="IN43991116"Datatypesunbinding defaults from
Unbinds a created default value from a column or from a user-defined datatype. FORMAT="LINESPECIFIC"sp_unbindefault MOREINFO="NONE"objname [, futureonly]ParametersREMAP="RI--RefIndent"MOREINFO="NONE"objname - is the name of either the table and column or the user-defined datatype from which to unbind the default. If the parameter is not of the form "table.column" then objname is taken to be a user-defined datatype. When unbinding a default from a user-defined datatype, any columns of that type that have the same default as the user-defined datatype had are also unbound. Columns of that type whose default has already been changed are unaffected. ID="IN431787159"futureonly optionsp_unbindefault
MOREINFO="NONE"futureonly - prevents existing columns of the specified user-defined datatype from losing their defaults. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_unbindefault "employees.startdate" REMAP="UN--Under"Unbinds the default from the startdate column of the employees table. sp_unbindefault ssn REMAP="UN--Under"Unbinds the default from the user-defined datatype named ssn, and all columns of that type. sp_unbindefault ssn, futureonly REMAP="UN--Under"Unbinds defaults from the user-defined datatype ssn, but does not affect existing columns of type ssn. CommentsID="IN437871512"Bindingunbinding andMARK="BULL" REMAP="BU--Bullet"Use MOREINFO="NONE"sp_unbindefault to remove defaults created with MOREINFO="NONE"sp_bindefault. Use MOREINFO="NONE"alter table to drop defaults declared using the MOREINFO="NONE"create table or MOREINFO="NONE"alter table statements.ID="IN4317831913"futureonly optionsp_unbindefaultColumns of a user-defined datatype lose their current default unless their default had previously been changed, or the value of the optional second parameter is MOREINFO="NONE"futureonly. To display the text of a default, execute MOREINFO="NONE"sp_helptext with the default name as the parameter. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Column or usertype must be in current database.REMAP="UN--Under"The objname parameter cannot include a database reference. MOREINFO="NONE"Columns of the user datatype specified had their defaults unbound.REMAP="UN--Under"Defaults on other columns of the user-defined datatype specified were unbound, unless their defaults were changed previously. MOREINFO="NONE"Default unbound from datatype.REMAP="UN--Under"The user-defined datatype supplied for the objname parameter no longer has any default. MOREINFO="NONE"Default unbound from table column.REMAP="UN--Under"The table column supplied for the objname parameter no longer has any default. MOREINFO="NONE"The specified column has no default.REMAP="UN--Under"No default is bound to the column name supplied for the objname parameter. MOREINFO="NONE"The specified user datatype has no default.REMAP="UN--Under"No default is bound to the datatype name supplied for the objname parameter. MOREINFO="NONE"You do not own a table with a column of that name.REMAP="UN--Under"The table name supplied for the objname parameter either doesn't exist in the database or you don't own it. You can only bind or unbind defaults from columns in tables that you own. MOREINFO="NONE"You do not own a user datatype of that name.REMAP="UN--Under"The user-defined datatype supplied for the objname parameter either doesn't exist in the database or you don't own it. You can only bind or unbind defaults from datatypes that you own. PermissionsREMAP="BO--Body"Only the object owner can execute MOREINFO="NONE"sp_unbindefault. Tables UsedREMAP="BO--Body"syscolumns, sysobjects, sysprocedures, systypes See AlsoCommands     LINKEND="X81463"create default
, LINKEND="X97463"drop default
 System procedures     LINKEND="X84736"sp_bindefault
, LINKEND="X25756"sp_helptext
ID="IN4332792318"sp_unbindefault system procedure
ID="IN4322782419"User-defined datatypesunbinding defaults from
ID="IN438762620"Defaultsunbinding;Unbinding:defaults
ID="IN437752721"Columnsunbinding defaults from
ID="IN439742822"Datatypesunbinding defaults from
 ID="IN4329703223"sp_unbindmsg system procedureID="X39400"sp_unbindmsgID="IN4421673625"User-defined messagesunbinding with sp_unbindmsg
ID="IN448643926"Messagesunbinding with sp_unbindmsg
Unbinds a user-defined message from a constraint.FORMAT="LINESPECIFIC"sp_unbindmsg constraint_nameParametersREMAP="RI--RefIndent"ID="IN4411614229"Constraintsunbinding messages with sp_unbindmsg
constraint_name - is the name of the constraint from which you are unbinding a message.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_unbindmsg positive_balanceREMAP="UN--Under"Unbinds a user-defined message from the constraint positive_balance.CommentsMARK="BULL" REMAP="BU--Bullet"You can bind only one message to a constraint. To change the message bound to a constraint, use MOREINFO="NONE"sp_bindmsg; the new message number replaces any existing bound message. It is not necessary to use MOREINFO="NONE"sp_unbindmsg first. To retrieve message text from the sysusermessages table, execute MOREINFO="NONE"sp_getmessage.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Constraint name must be in `currentMOREINFO="NONE"' database. REMAP="UN--Under"You can only unbind messages from constraints that are defined in the current database.MOREINFO="NONE"Constraint name must belong to the current user. REMAP="UN--Under"You cannot unbind a message from a constraint created by another user.MOREINFO="NONE"No such referential or check constraint exists. Please check whether the constraint name is correct.REMAP="UN--Under"Use MOREINFO="NONE"sp_help tablename to see a list of all existing constraints on a table.MOREINFO="NONE"Constraint is not bound to any message.REMAP="UN--Under"No message is currently bound to constraint_name.MOREINFO="NONE"Unbinding message failed unexpectedly. Please try again.REMAP="UN--Under"An error occurred. Reissue the command. MOREINFO="NONE"Message unbound from constraint.REMAP="UN--Under"You have successfully unbound the user-defined message from constraint_name.PermissionsREMAP="BO--Body"Only the object owner can execute MOREINFO="NONE"sp_unbindmsg.Tables UsedREMAP="BO--Body"sysconstraints, sysobjectsSee AlsoSystem procedures      LINKEND="X36529"sp_addmessage
, LINKEND="X87441"sp_bindmsg
, LINKEND="X61947"sp_getmessage
ID="IN4429574636"sp_unbindmsg system procedure
ID="IN448544937"Messagesunbinding with sp_unbindmsg
ID="IN4421515238"User-defined messagesunbinding with sp_unbindmsg
ID="IN4411485539"Constraintsunbinding messages with sp_unbindmsg
 ID="INA4430445940"sp_unbindrule system procedureID="X37191"sp_unbindruleID="IN455416342"Rulesunbinding with sp_unbindrule
ID="IN457386643"Columnsunbinding rules with sp_unbindrule
ID="IN4522356944"User-defined datatypesunbinding rules with sp_unbindrule
ID="IN459327245"Datatypesunbinding rules with sp_unbindrule
Unbinds a rule from a column or from a user-defined datatype. FORMAT="LINESPECIFIC"sp_unbindrule MOREINFO="NONE"objname [, futureonly]ParametersREMAP="RI--RefIndent"objname - is the name of the table and column or of the user-defined datatype from which the rule is to be unbound. If the parameter is not of the form "table.column", then objname is taken to be a user-defined datatype. Unbinding a rule from a user-defined datatype also unbinds it from columns of that type. This has no effect on columns that are already bound to a different rule.ID="IN4517287648"futureonly optionsp_unbindrule
MOREINFO="NONE"futureonly - prevents existing columns of the specified user-defined datatype from losing their rules. ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_unbindrule "employees.startdate" REMAP="UN--Under"Unbinds the rule from the startdate column of the employees table. sp_unbindrule def_ssn REMAP="UN--Under"Unbinds the rule from the user-defined datatype named def_ssn and all columns of that type. sp_unbindrule ssn, futureonly REMAP="UN--Under"The user-defined datatype MOREINFO="NONE"ssn no longer has a rule, but no existing MOREINFO="NONE"ssn columns are affected. CommentsMARK="BULL" REMAP="BU--Bullet"Executing MOREINFO="NONE"sp_unbindrule removes a rule from a column or from a user-defined datatype in the current database. If you don't want to unbind the rule from existing MOREINFO="NONE"objname columns, use the string MOREINFO="NONE"futureonly as the second parameter. You cannot useMOREINFO="NONE" sp_unbindrule to unbind a check constraint. Use MOREINFO="NONE"alter table to drop the constraint.To unbind a rule from a table column, specify the objname argument in the format "table.column." The rule is unbound from all existing columns of the user-defined datatype unless their rule had previously been changed, or you specify MOREINFO="NONE"futureonly. To display the text of a rule, execute MOREINFO="NONE"sp_helptext with the rule name as the parameter. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Column or usertype must be in current database.REMAP="UN--Under"The objname parameter may not include a database reference. MOREINFO="NONE"Columns of the user datatype specified had their rules unbound.REMAP="UN--Under"Rules on other columns of the user-defined datatype specified were unbound, unless their rules had previously been changed. MOREINFO="NONE"Rule unbound from datatype.REMAP="UN--Under"The user-defined datatype supplied for the objname parameter no longer has any rule. MOREINFO="NONE"Rule unbound from table column.REMAP="UN--Under"The table column supplied for the objname parameter no longer has any rule. MOREINFO="NONE"The specified column has no rule.REMAP="UN--Under"There is no rule bound to the table column supplied for the objname parameter.  Nothing changed.MOREINFO="NONE"The specified user datatype has no rule.REMAP="UN--Under"There is no rule bound to the user-defined datatype supplied for the objname parameter. Nothing changed.MOREINFO="NONE"You do not own a table with a column of that name.REMAP="UN--Under"The table name supplied for the objname parameter either doesn't exist in the database or you don't own it. You can only bind or unbind rules on tables that you own. MOREINFO="NONE"You do not own a user datatype of that name.REMAP="UN--Under"The user-defined datatype supplied for the objname parameter either doesn't exist in the database or you don't own it. You can only bind or unbind rules from datatypes that you own. PermissionsREMAP="BO--Body"Only the object owner can execute MOREINFO="NONE"sp_unbindrule.Tables UsedREMAP="BO--Body"syscolumns, sysconstraints, sysobjects, sysprocedures, systypes See AlsoCommands     LINKEND="X43186"create rule
,LINKEND="X62555"drop rule
 System procedures     LINKEND="X38718"sp_bindrule
, LINKEND="X25756"sp_helptext
ID="IN455257955"Rulesunbinding with sp_unbindrule
ID="IN4530218356"sp_unbindrule system procedure
ID="IN4522188657"User-defined datatypesunbinding rules with sp_unbindrule
ID="IN457158958"Columnsunbinding rules with sp_unbindrule
ID="IN459129259"Datatypesunbinding rules with sp_unbindrule
 ID="IN453089660"sp_volchanged system procedureID="X94792"sp_volchangedID="IN461369962"Backup Serversp_volchanged
ID="IN461569963"Volume handling
Notifies the Backup Server that the operator performed the requested volume handling during a dump or load.FORMAT="LINESPECIFIC"sp_volchanged session_id, device_name, action[, filename [, volume_name]]ParametersREMAP="RI--RefIndent"session_id - identifies the Backup Server session that requested the volume change. Use the @session_id parameter specified in the Backup Server's volume change request.device_name - is the device on which a new volume was mounted. Use the @devname parameter specified in the Backup Server's volume change request. If the Backup Server is not located on the same machine as the SQL Server, use the form:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"device at backup_server_nameaction - indicates whether the Backup Server should MOREINFO="NONE"abort, MOREINFO="NONE"proceed with, or MOREINFO="NONE"retry the dump or load. filename - is the file to load. If you do not specify a file name withMOREINFO="NONE" sp_volchanged, the Backup Server loads the MOREINFO="NONE"file = filename parameter of the load command. If neither MOREINFO="NONE"sp_volchanged nor the load command specifies which file to load, the Backup Server loads the first file on the tape.volume_name - ID="IN4617210367"dumpvolume optiondump database
is the volume name that appears in the ANSI tape label. The Backup Server writes the volume name in the ANSI tape label when overwriting an existing dump, dumping to a brand new tape, or dumping to a tape whose contents are not recognizable. If you do not specify a volume_name with MOREINFO="NONE"sp_volchanged, the Backup Server uses the MOREINFO="NONE"dumpvolume value specified in the dump command. If neither MOREINFO="NONE"sp_volchanged nor the dump command specifies a volume name, the Backup Server leaves the name field of the ANSI tape label blank.REMAP="UN--Under"During loads, the Backup Server uses the volume_name to confirm that the correct tape has been mounted. If you do not specify a volume_name with MOREINFO="NONE"sp_volchanged, the Backup Server uses the MOREINFO="NONE"dumpvolume specified in the load command. If neither MOREINFO="NONE"sp_volchanged nor the load command specifies a volume name, the Backup Server does not check the name field of the ANSI tape label before loading the dump.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_volchanged 8, "/dev/nrmt4", RETRYREMAP="UN--Under"This message from Backup Server indicates that a mounted tape's expiration date has not been reached:REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"Backup Server: 4.49.1.1: OPERATOR: Volume to be overwritten on'/dev/rmt4' has not expired: creation date on this volume is Sunday, Nov. 15, 1992, expiration date is Wednesday, Nov. 25, 1992.Backup Server: 4.78.1.1: EXECUTE sp_volchanged       @session_id = 8,       @devname = '/auto/remote/pubs3/SERV/Masters/testdump',       @action = { 'PROCEED' | 'RETRY' | 'ABORT' }REMAP="UN--Under"The operator changes the tape, then issues the command in Example LINKEND="X38643"1
.ID="X38643"CommentsRoles of Operator, SQL Server, and Backup Server in Volume ChangesMARK="BULL" REMAP="BU--Bullet"If the Backup Server detects a problem with the currently mounted volume, it  requests a volume change:MARK="DASH" REMAP="BS--BulletSub"On OpenVMS systems, the Backup Server sends volume change messages to the operator terminal on the machine on which it is running. Use theMOREINFO="NONE" with notify = client option of the dump or load command to route other Backup Server messages to the terminal session on which the MOREINFO="NONE"dump or MOREINFO="NONE"load request initiated.On UNIX systems, the Backup Server sends messages to the client that initiated the dump or load request. Use thMOREINFO="NONE"e with notify = operator_console option of the dump or load command to route messages to the terminal where the Backup Server was started.After mounting another volume, the operator executes MOREINFO="NONE"sp_volchanged from any SQL Server that can communicate with the Backup Server performing the dump or load. The operator does not have to log into the SQL Server on which the dump or load originated.On OpenVMS systems, the operating system-not the Backup Server-requests a volume change when it detects the end of a volume or when the specified drive is offline. The operator uses the OpenVMS REPLY command to reply to these messages.On UNIX systems, the Backup Server requests a volume change when the tape capacity has been reached. The operator mounts another tape, then executes MOREINFO="NONE"sp_volchanged. LINKEND="X57983"Figure 4-1: Changing Tape Volumes on a UNIX System
 illustrates this process. FLOAT="0"FORMAT="UNKNOWN" FILEREF="fig2_1_4.xwd"LBL="Figure 4-1:" ID="X57983"Changing Tape Volumes on a UNIX SystemMessagesID="IN4630-110671"sp_volchanged system proceduremessagesID="IN4622-410972"Prompts, sp_volchanged
ID="IN468-711273"Messagessp_volchanged list
Volume Change Prompts for LoadsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Dumpfile 'file_nameMOREINFO="NONE"' section volume_nameMOREINFO="NONE" found instead of 'file_nameMOREINFO="NONE"' section volume_nameMOREINFO="NONE".REMAP="UN--Under"The Backup Server issues this message if it cannot find the specified file on a single-file medium.COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="117*"COLNAME="C2" COLWIDTH="342*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"The operator canCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"By replyingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort the loadCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"abortCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mount another volume 
and try to load itCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"retry 
[, file_name [, volume_name]]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Load the file on the 
currently mounted 
volume, even though it 
is not the specified file 
(not recommended)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"proceed[, file_name [, volume_name]] MOREINFO="NONE"Mount the next volume to read.REMAP="UN--Under"The Backup Server issues this message when it is ready to read the next section of the dump file from a multi-volume dump.COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="117*"COLNAME="C2" COLWIDTH="342*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The operator canCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"By replyingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort the loadCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"abortCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mount the next 
volume and proceed 
with the loadCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"proceed 
[, file_name [, volume_name]]MOREINFO="NONE"Mount the next volume to search.REMAP="UN--Under"The Backup Server issues this message if it cannot find the specified file on multi-file medium.COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="117*"COLNAME="C2" COLWIDTH="342*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The operator canCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"By replyingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort the loadCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"abortCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mount another volume 
and proceed with the 
loadCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"proceed[, file_name [, volume_name]] ID="IN4617-911474"Tape dump devicessp_volchanged messages and
ID="IN4614-911475"Error messagesBackup ServerVolume Change Prompts for DumpsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Mount the next volume to search.REMAP="UN--Under"When appending a dump to an existing volume, the Backup Server issues this message if it cannot find the end-of-file mark.COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="117*"COLNAME="C2" COLWIDTH="342*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The operator canCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"By replyingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"abortCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mount a new volume 
and proceed with the 
dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"proceed[, file_name [, volume_name]] MOREINFO="NONE"Mount the next volume to write.REMAP="UN--Under"The Backup Server issues this message when it reaches the end of the tape. This occurs when it detects the end-of-tape mark, or dumps the number of kilobytes specified by the MOREINFO="NONE"capacity parameter of the dump command, or the device's high value from the sysdevices system table.COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="117*"COLNAME="C2" COLWIDTH="342*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The operator canCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"By replyingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"abortCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mount the next 
volume and proceed 
with the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"proceed[, file_name [, volume_name]]MOREINFO="NONE"Volume on device device_nameMOREINFO="NONE" has restricted access (code access_codeMOREINFO="NONE").REMAP="UN--Under"Dumps that specify the MOREINFO="NONE"init option overwrite any existing contents of the tape. Backup Server issues this message if you try to dump to a tape with ANSI access restrictions without specifying the MOREINFO="NONE"init option.COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="117*"COLNAME="C2" COLWIDTH="342*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The operator canCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"By replyingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"abortCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mount another volume 
and retry the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"retry 
[, file_name [, volume_name]]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Proceed with the 
dump, overwriting 
any existing contentsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"proceed[, file_name [, volume_name]] MOREINFO="NONE"Volume on device device_nameMOREINFO="NONE" is expired and will be overwritten.REMAP="UN--Under"Dumps that specify the MOREINFO="NONE"init option overwrite any existing contents of the tape. During dumps to single-file media, Backup Server issues this message if you have not specified the init option and the tape contains a dump whose expiration date has passed.COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="117*"COLNAME="C2" COLWIDTH="342*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The operator canCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"By replyingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"abortCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mount another volume 
and retry the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"retry 
[, file_name [, volume_name]]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Proceed with the 
dump, overwriting 
any existing contentsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"proceed[, file_name [, volume_name]] MOREINFO="NONE"Volume to be overwritten on 'device_nameMOREINFO="NONE"' has not expired: creation date on this volume is creation_dateMOREINFO="NONE", expiration date is expiration_dateMOREINFO="NONE".REMAP="UN--Under"On single-file media, the Backup Server checks the expiration date of any existing dump unless you specify the MOREINFO="NONE"init option. The Backup Server issues this message if the dump has not yet expired.COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="117*"COLNAME="C2" COLWIDTH="342*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The operator canCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"By replyingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"abortCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mount another volume 
and retry the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"retry 
[, file_name [, volume_name]]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Proceed with the 
dump, overwriting 
any existing contentsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"proceed[, file_name [, volume_name]] MOREINFO="NONE"Volume to be overwritten on `device_nameMOREINFO="NONE"' has unrecognized label data.REMAP="UN--Under"Dumps that specify the MOREINFO="NONE"init option overwrite any existing contents of the tape. Backup Server issues this message if you try to dump to a new tape or a tape with non-Sybase data without specifying the MOREINFO="NONE"init option.COLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="117*"COLNAME="C2" COLWIDTH="342*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The operator canCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"By replyingVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"abortCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mount another volume 
and retry the dumpCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"retry 
[, file_name [, volume_name]]COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Proceed with the 
dump, overwriting 
any existing contents of 
the volumeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_volchanged session_id, device_name, MOREINFO="NONE"proceed[, file_name [, volume_name]] ID="IN4622-1211776"Prompts, sp_volchanged
ID="IN468-1512077"Messagessp_volchanged list
ID="IN4630-1812378"sp_volchanged system proceduremessagesPermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_volchanged to respond to a volume change request. This need not be the same user who started the dump or load.Tables UsedREMAP="BO--Body"master..sysdevices, sysobjectsSee AlsoCommands     LINKEND="X68345"dump database
, LINKEND="X47924"dump transaction
, LINKEND="X28090"load database
, LINKEND="X75212"load transactionTopics     LINKEND="X96191"Roles
ID="IN4630-2212782"sp_volchanged system procedure
 ID="IN4623-2613183"sp_who system procedureID="X89868"sp_whoID="IN477-2913585"Reportssp_who
ID="IN4720-3113786"Information (Server)logins;Information (Server):server logins
ID="IN4724-3414087"Processes (Server tasks)sp_who report on
ID="IN475-3714388"Userssp_who report on
ID="IN477-4014689"ServersServersSee also Processes (Server tasks); Remote servers!see also
ID="IN4754-4314990"Server process ID number. See Processes (Server tasks)
Reports information  about all current SQL Server users and processes, or about  a particular user or process. FORMAT="LINESPECIFIC"sp_who [MOREINFO="NONE"login_name | MOREINFO="NONE""spid"] ParametersREMAP="RI--RefIndent"login_name - is the SQL Server  login name of a user to report on. ID="IN4724-4314993"Processes (Server tasks)ID number
spid - is the number of a specific process to report on. Enclose process numbers in quotes (SQL Server expects  a char type).ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"MOREINFO="NONE"sp_whoREMAP="UN--Under"Reports on the processes running on SQL Server: REMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"  spid  status    loginame hostname blk dbname cmd ---- --------   -------- -------- --- ------ -------------- 1  recv sleep  bird     jazzy    0   master AWAITING COMMAND 2  sleeping    NULL              0   master NETWORK HANDLER 3  sleeping    NULL              0   master MIRROR HANDLER 4  sleeping    NULL              0   master AUDIT PROCESS 5  sleeping    NULL              0   master CHECKPOINT SLEEP 6  recv sleep  rose     petal    0   master AWAITING COMMAND 7  running     sa       helos    0   master SELECT 8  send sleep  daisy    chain    0   pubs2  SELECT 9  alarm sleep lily     pond     0   master WAITFOR10  lock sleep  viola    cello    7   pubs2  SELECTID="IN4741-4815495"spid number. See Processes (Server tasks)REMAP="UN--Under"The spidID="IN4712-5215896"kill commandsp_who and
 column contains the process identification numbers that are used in the Transact-SQL MOREINFO="NONE"kill command. The blkID="IN4716-5215897"Blocking process
 column contains the process ID's of the blocking process, if there is one. A blocking process (which may be infected or have an exclusive lock) is one that is holding resources that another process needs. In the previous example, process 10 (a MOREINFO="NONE"select on a table) is blocked by process 7 (a MOREINFO="NONE"begin transaction followed by an MOREINFO="NONE"insert on the same table). ID="IN4729-5516198"Mirroring. See Disk mirroring
ID="IN4714-5716399"Disk mirroringsp_who report onREMAP="UN--Under"If you enable mirrored disks or remote procedure calls, the mirror handler and the site handler also appear in the report from MOREINFO="NONE"sp_who. sp_who victoria REMAP="UN--Under"Reports on the processes the user "victoria" is running. sp_who "17" REMAP="UN--Under"Reports what SQL Server process number 17 is doing. CommentsMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_who reports information about a specified user or SQL Server process. Without parameters, MOREINFO="NONE"sp_who reports which users are running what processes in all databases. Running MOREINFO="NONE"sp_who on a single-engine server shows the MOREINFO="NONE"sp_who process "running" and all other processes "runnable" or in one of the sleep states. In multi-engine servers, there can be a "running" process for each engine. MOREINFO="NONE"sp_who reports NULL in the loginame column for all system processes.ID="IN4724-57163101"Processes (Server tasks)infected
ID="IN4718-63169102"Infected processesremoval with kill;kill command:sp_who andSystem Administrators can remove many processes with the MOREINFO="NONE"kill command. See MOREINFO="NONE"kill in the SQL Server Reference Manual, Volume 1.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"No login with the specified name exists.REMAP="UN--Under"The name supplied for the login_name parameter does not exist on SQL Server. PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_who. Tables UsedREMAP="BO--Body"master..sysprocesses See AlsoCommands     LINKEND="X67442"kill
 System procedures     LINKEND="X34217"sp_lock
ID="IN4723-67173107"sp_who system procedure
ID="IN4724-70176108"Processes (Server tasks)sp_who report on
ID="IN4720-72178109"Information (Server)logins;Information (Server):server logins
ID="IN477-75181110"Reportssp_who
ID="IN475-78184111"Userssp_who report on
 REMAP="BO--Body"NUMBER="5" ID="XK43361"Catalog Stored ProceduresID="IN52110011"Reference informationcatalog stored procedures
ID="IN5259742"Catalog stored procedurescatalog;System procedures:catalog storedREMAP="BO--Body"This chapter describes the catalog stored procedures. Catalog stored procedures retrieve information from the system tables in tabular form. ID="IN5259563"Catalog stored procedureslist of;List:catalog stored proceduresREMAP="BO--Body"The following table lists the catalog stored procedures that are covered in this chapter.TOCENTRY="1"LBL="Table 5-1:"Catalog Stored ProceduresCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="12*"COLNAME="C2" COLWIDTH="33*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ProcedureCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_column_privilegesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns permissions information for one or more 
columns in a table or view.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_columnsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns information about the type of data that can be 
stored in one or more columns.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_databases COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a list of databases on a server.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_datatype_info COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns information about a particular datatype or 
about all supported datatypes.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_fkeys COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns logical foreign key information for the current 
database. Foreign keys must have been declared 
through the ANSI integrity constraint mechanism.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_pkeys COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns primary key information for a single table. 
Primary keys must have been declared through the 
ANSI integrity constraint mechanism.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_server_info COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a list of attribute names and matching values for 
a server.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_special_columns COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns the optimal set of columns that uniquely 
identify a row in a table or view; can also return a list of 
the columns that are automatically updated when any 
value in the row is updated by a transaction.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_sproc_columns COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns information about a stored procedure's input 
and return parameters.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_statistics COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a list of indexes on a single table.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_stored_procedures COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns information about one or more stored 
procedures.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_table_privileges COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns privilege information for all columns in a table 
or view.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"sp_tables COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Returns a list of objects that can appear in a MOREINFO="NONE"from clause.ID="IN5259564"Catalog stored proceduressyntax;Syntax:catalog stored proceduresRENDERAS="SECT1"Syntax and Optional ParametersREMAP="BO--Body"In many cases it is more convenient to supply parameters to the catalog stored procedures in the form:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"@parametername = valueREMAP="BO--Body"than to supply all of the parameters. The parameter names in the syntax statements match the parameter names defined by the procedures.REMAP="BO--Body"For example, the syntax for MOREINFO="NONE"sp_columns is:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_columns table_name [, table_owner] [, table_qualifier] [, column_name]REMAP="BO--Body"To use MOREINFO="NONE"sp_columns to find information about a particular column, you can use:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_columns publishers, @column_name = "pub_id"REMAP="BO--Body"This provides the same information as the command with all of the parameters specified:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_columns publishers, "dbo", "pubs2", "pub_id"REMAP="BO--Body"You can also use "null" as a placeholder:REMAP="UI--UserInput" FORMAT="LINESPECIFIC"sp_columns publishers, null, null, "pub_id"RENDERAS="SECT1"System Procedure Tables   REMAP="BO--Body"The catalog stored procedures MOREINFO="NONE"sp_columns, MOREINFO="NONE"sp_datatype_info, MOREINFO="NONE"sp_special_columns, and MOREINFO="NONE"sp_sproc_columnsID="IN5169565"Temporary tablescatalog stored procedures and
 use the catalog stored procedure tables ID="IN5239386"spt_datatype_info table
spt_datatype_infoID="IN52791107"spt_datatype_info_ext table
, spt_datatype_info_extID="IN52189128"spt_server_info table
, and spt_server_info the sybsystemprocs database to convert internal system values (for example, status bits) into human-readable format. REMAP="BO--Body"In addition, MOREINFO="NONE"sp_column_privileges and MOREINFO="NONE"sp_table_privileges create and then drop the temporary tables #column_privileges, #distinct_grantors, #results_table, #sysprotects, #useful_groups. ID="IN51689129"Pattern matchingwildcard;Wildcard characters:ANSI SQL pattern matching ($ and _)RENDERAS="SECT1"Pattern MatchingID="IN525891210"ANSI SQL pattern matchingREMAP="BO--Body"SQL Server offers a wide range of pattern matching through regular expressions. However, for maximum interoperability, assume only ANSI SQL pattern matching (the MOREINFO="NONE"% and MOREINFO="NONE"_ wildcards).ID="IN547861511"ODBC. See Open Database Connectivity (ODBC) API
ID="IN547851612"Open Database Connectivity (ODBC) API datatypes
ID="IN59851613"DatatypesODBC;Datatypes:codes
ID="IN526821914"Column data. See DatatypesRENDERAS="SECT1"ODBC DatatypesREMAP="BO--Body"LINKEND="X70260"Table 5-2
 and LINKEND="X81538"Table 5-3
ID="IN527821915"Code numbers, ODBC datatypedatatype;Numbers:datatype code
ID="IN57792216"NumbersNumbersSee also Code numbers; IDs, user!see also Code numbers; IDs, user
ID="IN57792217"NumbersODBC datatype code
 list the datatype code numbers and matching datatype names that ID="IN535772418"sp_columns catalog stored proceduredatatype code numbers
MOREINFO="NONE"sp_columns andID="IN541752619"sp_sproc_columns catalog stored proceduredatatype code numbers
 MOREINFO="NONE"sp_sproc_columns return in the DATA_TYPE column. The source for the description is the Open Database Connectivity API.RENDERAS="SECT2"DatatypesTOCENTRY="1"LBL="Table 5-2:" ID="X70260"DatatypesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="4*"COLNAME="C2" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TypeVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimal COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"double precision COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"float COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"integer COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numeric COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"real COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12ID="IN59752620"Datatypesextended;Extended datatypes, ODBCRENDERAS="SECT2"Extended DatatypesTOCENTRY="1"ID="X81538" LBL="Table 5-3:"Extended DatatypesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="4*"COLNAME="C2" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TypeVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bigintCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-5COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binary (bit datatype)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-2COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-7COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"date COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0" 9COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"long varbinary COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-4COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"long varchar COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"time COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"timestamp COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"11COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-6COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinary (bit varying datatype)COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"-3ID="IN547742721"Open Database Connectivity (ODBC) API datatypesREMAP="BO--Body"ID="X20577"sp_column_privilegesID="IN431192104"Permissionssp_column_privileges information on
Returns permissions information for one or more columns in a table or view.FORMAT="LINESPECIFIC"sp_column_privileges table_name [, table_owner[, table_qualifier [, column_name]]]ParametersREMAP="RI--RefIndent"table_name - is the name of the table. No wildcard pattern matching is supported.table_owner - is the name of the table owner. No wildcard pattern matching is supported. If you do not specify the table's owner, MOREINFO="NONE"sp_column_privileges looks first for a table owned by the current user and then for a table owned by the Database Owner.table_qualifier - is the name of the database. Acceptable values are the name of the current database and NULL.column_name - is the name of the column whose permissions you want to display. Use wildcards to request information for more than one column. If you do not specify a column name, MOREINFO="NONE"sp_column_privileges returns permissions information for all columns in the specified table.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_column_privileges discounts, null, null, discounttypeREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"table_qualifier table_owner  
table_name column_name  
grantor grantee  
privilege is_grantable ---------------------- --------------------------  
----------------------- ---------------------  
----------------------- ---------------------- 
 -------------------------------- ------------ pubs2 dbo  discounts discounttype  dbo guest  INSERT NO pubs2 dbo  discounts discounttype  dbo guest  SELECT NO pubs2 dbo  discounts discounttype  dbo guest  UPDATE NO pubs2 dbo  discounts discounttype  dbo guest  REFERENCE NO pubs2 dbo  discounts discounttype  dbo dbo  INSERT YES pubs2 dbo  discounts discounttype  dbo dbo  SELECT YES pubs2 dbo  discounts discounttype  dbo dbo  UPDATE YES pubs2 dbo  discounts discounttype  dbo dbo  REFERENCE YES CommentsMARK="BULL" REMAP="BU--Bullet"The following table describes the results set:TOCENTRY="1"LBL="Table 5-4:" ID="X36034"Results Set for sp_column_privilegesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_qualifier COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The database name. This field can be NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_owner COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULLCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"grantor COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULLCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"granteeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULLCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"privilege COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Identifies the column privilege. May be one of 
the following:

SELECT - The grantee is permitted to retrieve 
data for the column.

INSERT - The grantee is permitted to provide 
data for the column in new rows that are 
inserted into the associated table.

UPDATE - The grantee is permitted to update 
data in the column.

REFERENCE - The grantee is permitted to 
refer to the column within a constraint (for 
example, a unique, referential, or table check 
constraint).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"is_grantable COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(3)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Indicates whether the grantee is permitted to 
grant the privilege to other users. The values 
are YES, NO, or NULL.ID="IN43689139"Tablescolumn permission information from sp_column_privilegesMessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Catalog procedure sp_column_privileges can not be run in a transaction.REMAP="UN--Under"This procedure updates system tables, so it cannot be run from within a transaction.MOREINFO="NONE"Object name must be qualified with the owner name.MOREINFO="NONE"Object name can only be qualified with owner name.MOREINFO="NONE"This may be a temporary object. Please execute procedure from tempdb.REMAP="UN--Under"You invoked MOREINFO="NONE"sp_column_priviliges for a table beginning with "#". Execute the MOREINFO="NONE"use command to switch to tempdb, then rerun MOREINFO="NONE"sp_column_privileges.MOREINFO="NONE"The table or view named doesn't exist in the current database.REMAP="UN--Under"The specified table or view does not exist. Check the spelling of the table_name.MOREINFO="NONE"The table does not have a column named column_name
MOREINFO="NONE".REMAP="UN--Under"The specified column does not belong to the table.MOREINFO="NONE"Table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_column_privileges cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_column_privileges.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_column_privileges.Tables UsedREMAP="BO--Body"syscolumns, sysobjects, sysusersID="IN437881413"Columnspermissions on
ID="IN4345841814"sp_column_privileges catalog stored procedure
ID="IN4311812115"Permissionssp_column_privileges information on
ID="IN4335772516"sp_columns catalog stored proceduresp_columnsID="IN447742918"Columnsinformation from sp_columns
Returns information about the type of data that can be stored in one or more columns.FORMAT="LINESPECIFIC"sp_columns table_name [, table_owner ][, table_qualifier] [, column_name]ParametersREMAP="RI--RefIndent"table_name ID="IN446733021"Tablescolumn information
ID="IN445723122"Viewscolumns
- is the name of the table or view. Use wildcards to request information about more than one table.table_owner - is the owner of the table or view. Use wildcards to request information about tables owned by more than one user. If you do not specify a table owner, MOREINFO="NONE"sp_columns looks first for tables owned by the current user and then for tables owned by the Database Owner.table_qualifier - is the name of the database. This can be either the current database or NULL.column_name - is the name of the column for which you want information. Use wildcards to request information about more than one column.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_columns "publishers", null, null, "p%"REMAP="UN--Under"Displays information about all columns in the publishers table that begin with "p".sp_columns "s%", null, null, "st%"REMAP="UN--Under"Displays information about all columns beginning with "st" in tables that begin with "s".CommentsMARK="BULL" REMAP="BU--Bullet"The following table shows the results set:TOCENTRY="1"LBL="Table 5-5:"Results Set for sp_columnsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_qualifier COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The database name. This field can be NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_ownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"data_typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Integer code for ODBC datatype. If this is a 
datatype that cannot be mapped into an 
ODBC type, it is NULL. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"String representing a datatype. The 
underlying DBMS presents this datatype 
name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"precisionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of significant digits.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lengthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Length in bytes of a datatype.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"scaleCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of digits to the right of the decimal 
point.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"radixCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Base for numeric types.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nullableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The value 1 means NULL is possible; 0 means 
NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remarksCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(254)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ss_data_typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A SQL Server datatype.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"colidCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A column appended to the result set. MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_columns cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_columns.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_columns.Tables UsedREMAP="BO--Body"syscolumns, sysobjects, systypes, sybsystemprocs..spt_datatype_infoID="IN4435683528"sp_columns catalog stored procedure
ID="IN447653829"Columnsinformation from sp_columns
ID="IN446643930"Tablescolumn information
ID="IN445634031"Viewscolumns
ID="IN4437604332"sp_databases catalog stored proceduresp_databasesID="IN459584634"Databaseslisting with sp_databases
Returns a list of databases on a SQL ServerID="IN4518564835"sysdatabases table
.FORMAT="LINESPECIFIC"sp_databasesParametersREMAP="BO--Body"None.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_databasesREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"database_name                    database_size         remarks  -------------------------------- -------------         -------------------------------------------  master                                    3072         NULL  model                                     2048         NULL  mydb                                      2048         NULL  pubs2                                     2048         NULL  sybsecurity                               5120         NULL  sybsystemprocs                           10240         NULL  tempdb                                    2048         NULLCommentsMARK="BULL" REMAP="BU--Bullet"LINKEND="X36035"Table 5-6
 shows the result set:TOCENTRY="1"ID="X36035" LBL="Table 5-6:"Results Set for sp_databasesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="5*"COLNAME="C3" COLWIDTH="10*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"database_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL database name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"database_sizeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Size of database in kilobytes.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remarksCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(254)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL Server always returns NULL.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_databases.Tables UsedREMAP="BO--Body"#databases, master..sysdatabases, master..sysusages, sysobjects ID="IN4541525242"sp_datatype_info catalog stored proceduresp_datatype_infoID="IN469495644"Datatypessp_datatype_info information on
Returns information about a particular datatype or about all supported datatypes.FORMAT="LINESPECIFIC"sp_datatype_info [data_type]ParametersREMAP="RI--RefIndent"ID="IN465495647"Codesdatatype;Datatypes:codes
data_type - is the code number for the specified datatype about which information is returned. Datatype codes are listed in LINKEND="X70260"Table 5-2: Datatypes
 and LINKEND="X81538"Table 5-3: Extended Datatypes
.CommentsMARK="BULL" REMAP="BU--Bullet"The following table describes the results set:TOCENTRY="1"LBL="Table 5-7:"Results Set for sp_datatype_infoCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="4*"COLNAME="C3" COLWIDTH="13*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A DBMS-dependent datatype name (the same as 
the type name column in the MOREINFO="NONE"sp_columns results 
set).COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"data_typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A code for the ODBC type to which all columns of 
this type are mapped.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"precisionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The maximum precision for the datatype on the 
data source. Zero is returned for datatypes where 
precision is not applicable.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"literal_prefixCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Character(s) used to prefix a literal. For example, a 
single quotation mark (') for character types and 
0x for binary.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"literal_suffixCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Character(s) used to terminate a literal. For 
example, a single quotation mark (') for character 
types and nothing for binary.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"create_paramsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A description of the creation parameters for this 
datatype.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nullableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The value 1 means this datatype can be created 
allowing null values; 0 means it cannot.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"case_sensitiveCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The value 1 means all columns of this type are 
case sensitive (for collations); 0 means they are 
not.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"searchableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The value 1 means columns of this type can be 
used in a MOREINFO="NONE"where clause.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"unsigned_attributeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The value 1 means the datatype is unsigned; 0 
means the datatype is signed.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"moneyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The value 1 means it is a money datatype; 0 means 
it is not.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"auto_incrementCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The value 1 means the datatype is automatically 
incremented; 0 means it is not.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"local_type_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(128)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Localized version of the data source dependent 
name of the datatype.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_datatype_info.Tables UsedREMAP="BO--Body"sybsystemprocs..spt_datatype_info, systypes, sysdatabases, sysmessages, sysprocesses ID="IN4641456051"sp_datatype_info catalog stored procedure
ID="IN469426352"Datatypessp_datatype_info information onREMAP="BO--Body"sp_fkeysID="IN43129393"Foreign keyssp_fkeys information on
Returns logical foreign key information for the current database.  Foreign keys must have been declared through the ANSI  integrity constraint mechanism. FORMAT="LINESPECIFIC"sp_fkeys pktable_name [, pktable_owner][, pktable_qualifier] [, fktable_name] [, fktable_owner] [, fktable_qualifier]ParametersREMAP="RI--RefIndent"pktable_name - is the name of the primary key table. No wildcard pattern matching is supported. You must specify either this parameter or the fktable_name parameter, or both.pktable_owner - is the name of the primary key table owner. No wildcard pattern matching is supported. If you do not specify the table owner,MOREINFO="NONE" sp_fkeys looks first for a table owned by the current user and then for a table owned by the Database Owner.pktable_qualifier - is the name of the database that contains the primary key table. This can be either the current database or NULL.fktable_name - is the name of the foreign key table. No wildcard pattern matching is supported. Either this parameter or the pktable_name parameter, or both, must be given.fktable_owner - is the name of the foreign key table owner. No wildcard pattern matching is supported. If the parameter is not specified, MOREINFO="NONE"sp_fkeys looks first for a table owned by the current user and then for a table owned by the Database Owner.fktable_qualifier - is the name of the database that contains the foreign key table. This can be either the current database or NULL.CommentsMARK="BULL" REMAP="BU--Bullet"LINKEND="X30705"Table 5-8
 describes the results set:TOCENTRY="1"LBL="Table 5-8:" ID="X30705"Results Set for sp_fkeysCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="4*"COLNAME="C3" COLWIDTH="11*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pktable_qualifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The database that contains the primary 
key table.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pktable_ownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The owner of the primary key table.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pktable_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pkcolumn_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fktable_qualifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The database that contains the foreign key 
table.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fktable_ownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The owner of the foreign key table.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fktable_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fkcolumn_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key_seqCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. The sequence number of the 
column in a multi-column primary key.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"update_ruleCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Action to be applied to the foreign key 
when the SQL operation is UPDATE. Zero 
is returned for this column.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"delete_ruleCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Action to be applied to the foreign key 
when the SQL operation is DELETE. Zero 
is returned for this column.Both the primary key and foreign key must have been declared through the ANSI integrity constraint mechanism. See LINKEND="X80969"create table
 in the SQL Server Reference Manual, Volume 1 for more information.If the primary key table name is supplied but the foreign key table name is NULL, this procedure returns all tables that include a foreign key to the given table. If the foreign key table name is supplied, but the primary key table name is NULL, the procedure returns all tables related by a primary key/foreign key relationship to foreign keys in the foreign key table. This procedure does not support the MOREINFO="NONE"common key type as specified in the SQL Server MOREINFO="NONE"syskeys catalog.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Catalog procedure sp_fkeys can not be run in a transaction.REMAP="UN--Under"This procedure updates system tables, so it cannot be run from within a transaction.MOREINFO="NONE"Foreign key table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_fkeys cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_fkeys.MOREINFO="NONE"Primary key table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_fkeys cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_fkeys.MOREINFO="NONE"Object does not exist in this database.REMAP="UN--Under"The primary key table or foreign key table does not exist in the current database as specified. Check the spelling of the table name.MOREINFO="NONE"Primary key table name or foreign key table name or both must be given.REMAP="UN--Under"You must specify the name of the primary key table, the foreign key table, or both.PermissionsREMAP="RI--RefIndent"Any user can execute MOREINFO="NONE"sp_fkeys.Tables UsedREMAP="BO--Body"#fid, #fkey_res, #fkeys, #pid, #pkeys, sysobjects, sysreferencesSee AlsoCommands     LINKEND="X80969"create table
ID="IN4333891311"sp_fkeys catalog stored procedure
ID="IN4312861612"Foreign keyssp_fkeys information on
 ID="IN4333822013"sp_pkeys catalog stored proceduresp_pkeysID="IN4412792415"Primary keyssp_pkeys information on
ID="IN447772616"Columnsprimary key;Tables:primary keys on
Returns primary key information for a single table. Primary keys must have been declared through the ANSI integrity constraint mechanism. FORMAT="LINESPECIFIC"sp_pkeys table_name [, table_owner] [, table_qualifier]Parameters REMAP="RI--RefIndent"table_name - is the name of the table. No wildcard pattern matching is supported.table_owner - is the name of the table owner. No wildcard pattern matching is supported. If the parameter is not specified, MOREINFO="NONE"sp_pkeys looks first for a table owned by the current user and then for a table owned by the Database Owner.table_qualifier - is the name of the database that contains the table. This can be either the current database or NULL.CommentsMARK="BULL" REMAP="BU--Bullet"LINKEND="X94797"Table 5-9
 shows the results set:TOCENTRY="1"LBL="Table 5-9:" ID="X94797"Results Set for sp_pkeysCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="4*"COLNAME="C3" COLWIDTH="11*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_qualifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The database name. This field can be 
NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_ownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key_seqCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. The sequence number of the 
column in a multi-column primary key.Primary keys must have been declared through the ANSI integrity constraint mechanism in the MOREINFO="NONE"create table statement.The term primary key refers to a logical primary key for a table. SQL Server expects that every logical primary key has a unique index defined on it, and that this unique index is also returned in MOREINFO="NONE"sp_statistics.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Object does not exist in this database.REMAP="UN--Under"The primary key table or foreign key table does not exist in the current database as specified. Check the spelling of the table name.MOREINFO="NONE"Table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_pkeys cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_pkeys.MOREINFO="NONE"Catalog procedure sp_pkeys can not be run in a transaction.REMAP="UN--Under"This procedure updates system tables, so it cannot be run from within a transaction.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_pkeys.Tables UsedREMAP="BO--Body"#pkeys, sysindexes, sysobjects See AlsoCommands     LINKEND="X80969"create table
ID="IN4433733024"sp_pkeys catalog stored procedure
ID="IN4412703325"Primary keyssp_pkeys information on
ID="IN447683526"Columnsprimary key;Tables:primary keys on
 sp_server_infoID="IN43429393"Attributes, displaying with sp_server_info
ID="IN4359394"Namesserver attribute
ID="IN43690125"Valuesdisplaying with sp_server_info
ID="IN43789136"Serversattribute names
ID="IN43786167"Serverssp_server_info information on
Returns a list of attribute names and matching values for SQL Server.FORMAT="LINESPECIFIC"sp_server_info [attribute_id]Parameters REMAP="RI--RefIndent"attribute_id - is the integer ID of the attribute.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_server_info 109REMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"attribute_id attribute_name         attribute_value   ------------ -------------------------------------        -------------------------------------------            12 MAX_OWNER_NAME_LENGTH         30sp_server_infoREMAP="UN--Under"Returns the list atributes described by the mandatory rows, and their values.CommentsMARK="BULL" REMAP="BU--Bullet"LINKEND="X68419"Table 5-10
 describes the results set:TOCENTRY="1"LBL="Table 5-10:" ID="X68419"Results Set for sp_server_infoCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"attribute_idCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"attribute_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(60)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"attribute_valueCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"LINKEND="X52418"Table 5-11
 shows the mandatory rows in this results set:PGWIDE=1 TOCENTRY="1"LBL="Table 5-11:" ID="X52418"Mandatory Results Returned by sp_server_infoCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="17*"COLNAME="C3" COLWIDTH="22*"COLNAME="C4" COLWIDTH="8*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"IDCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0" NameCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0" ValueVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DBMS_NAME COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of the DBMS.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL SERVER COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DBMS_VER COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Version of the DBMS.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"@@version COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DBE_NAME COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OWNER_TERM COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL Server's term for a table owner (the 
second part of a three-part name).COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ownerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"11COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TABLE_TERM COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL Server's term for a table (the third part of 
a three-part name).COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tableCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MAX_OWNER_NAME_LENGTH COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum length of the name for a table 
owner (the second part of a three-part name).COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"30COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"16COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0" IDENTIFIER_CASE COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The case sensitivity of user-defined names 
(table names, column names, stored 
procedure names) in the database (the case in 
which these objects are presented in the 
system catalogs).COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MIXED COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"15COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLUMN_LENGTH COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The maximum number of characters for a 
column name.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"30COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TABLE_LENGTH COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The maximum number of characters for a 
table name.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"30COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"100COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USERID_LENGTH COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The maximum number of characters for a 
user name.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"30COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"17COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TX_ISOLATION COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The initial transaction isolation level the 
server assumes, corresponding to an isolation 
level defined in ANSI SQL2.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"18COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLLATION_SEQ COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The assumed ordering of the character set for 
this server.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"14COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MAX_QUAL_LENGTH COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum length of the name for a table 
qualifier (the first part of a three-part table 
name).COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"30COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"101COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"QUALIFIER_TERM COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQL Server's term for a table qualifier (the 
first part of a three-part name).COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"19COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SAVEPOINT_SUPPORT COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Does the underlying DBMS support named 
savepoints?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"20COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MULTI_RESULT_SETS COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Does the underlying DBMS or the gateway 
itself support multiple results sets (can 
multiple statements be sent through the 
gateway, with multiple results sets returned 
to the client)?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"102COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NAMED_TRANSACTIONS COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Does the underlying DBMS support named 
transactions?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"103COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SPROC_AS_LANGUAGE COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can stored procedures be executed as 
language events?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"103COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"REMOTE_SPROC COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can stored procedures be executed through 
the remote stored procedure APIs in DB-
Library?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ACCESSIBLE_TABLES COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"In the MOREINFO="NONE"sp_tables stored procedure, does the 
gateway return only tables, views, and so on, 
that are accessible by the current user (that is, 
the user who has at least MOREINFO="NONE"select privileges for 
the table)?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"104COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ACCESSIBLE_SPROC COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"In the MOREINFO="NONE"sp_stored_procedures stored procedure, 
does the gateway return only stored 
procedures that are executable by the current 
user?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"105COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MAX_INDEX_COLS COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum number of columns in an index for 
the DBMS.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"106COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RENAME_TABLE COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can tables be renamed?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"107COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RENAME_COLUMN COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can columns be renamed?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"108COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DROP_COLUMN COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can columns be dropped?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"109COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"INCREASE_COLUMN_LENGTH COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can column size be increased?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"110COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DDL_IN_TRANSACTION COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can DDL statements appear in transactions?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"111COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DESCENDING_INDEXES COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Are descending indexes supported?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"112COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SP_RENAME COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Can a stored procedure be renamed?COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"500COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SYS_SPROC_VERSION COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The version of the catalog stored procedures 
currently implemented.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"01.01.2822MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Attribute id attribute_id
MOREINFO="NONE" is not supported.REMAP="UN--Under"Check the spelling of the attribute.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_server_info.Tables UsedREMAP="BO--Body"sybsystemprocs..spt_server_info, sysobjects ID="IN4339822015"sp_server_info catalog stored procedure
ID="IN4342792316"Attributes, displaying with sp_server_info
ID="IN436762617"Valuesdisplaying with sp_server_info
ID="IN437752718"Serversattribute names
ID="IN437723019"Serverssp_server_info information on
ID="IN4343683420"sp_special_columns catalog stored proceduresp_special_columns
Returns the optimal set of columns that uniquely identify a row in a table or view; can also return a list of the columns that are automatically updated when any value in the row is updated by a transaction.FORMAT="LINESPECIFIC"sp_special_columns table_name [, table_owner] [, table_qualifier] [, col_type]ParametersREMAP="RI--RefIndent"table_name - is the name of the table or view. No wildcard pattern matching is supported.table_owner - is the name of the table or view owner. No wildcard pattern matching is supported. If you do not specify the table owner, MOREINFO="NONE"sp_special_columns looks first for a table owned by the current user and then for a table owned by the Database Owner.table_qualifier - is the name of the database. This can be either the current database or NULL.col_type - is "R" to return information about columns whose values uniquely identify any row in the table, or "V"to return information about columns whose values are automatically generated by SQL Server each time a row is inserted or updated.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_special_columns systypesREMAP="COW--CompOutWide" FORMAT="LINESPECIFIC"scope  column_name              data_type type_name     precision         length      scale   ------ ------------------------ --------- ------------- --------        ----------- ------       0 name                         12 varchar                30                  30   NULLCommentsMARK="BULL" REMAP="BU--Bullet"LINKEND="X91398"Table 5-12
 describes the results set:TOCENTRY="1"LBL="Table 5-12:" ID="X91398"Results Set for sp_special_columnsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"scope COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. Actual scope of the row id. 
SQL Server always returns 0.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. Column identifier.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"data_typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The integer code for an ODBC datatype. If this 
datatype cannot be mapped into an ANSI 
type, the value will be NULL. The native 
datatype name is returned in the type_name 
column. (See the ODBC datatypes table at the 
beginning of this chapter.)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(13) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The string representation of the datatype. This 
is the datatype name as presented by the 
underlying DBMS.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"precisionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of significant digits.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lengthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The length in bytes of the datatype.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"scaleCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of digits to the right of the 
decimal point.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"There is no table named table_name
MOREINFO="NONE" in the current database.REMAP="UN--Under"The table does not exist in the current database as specified. Check the spelling of the table name.MOREINFO="NONE"Table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_special_columns cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_special_columns.MOREINFO="NONE"Illegal value for 'col_type' argument. Legal values are 'V' or 'R'.REMAP="UN--Under"You must specify V or R.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_special_columns.Tables UsedREMAP="BO--Body"sybsystemprocs..spt_datatype_info, syscolumns, sysindexes, sysobjects, systypes, sysusersID="IN4443643929"sp_special_columns catalog stored procedureREMAP="BO--Body"ID="IN4441604330"sp_sproc_columns catalog stored proceduresp_sproc_columnsID="IN457574732"Columnssp_sproc_columns information on
ID="IN4517545033"Stored proceduressp_sproc_columns information on
Returns information about a stored procedure's input and return parameters.FORMAT="LINESPECIFIC"sp_sproc_columns sp_name [, sp_owner] [, sp_qualifier] [, column_name]ParametersREMAP="RI--RefIndent"sp_name - is the name of the stored procedure. No wildcard pattern matching is supported.sp_owner - is the owner of the stored procedure. No wildcard pattern matching is supported. If you do not specify the owner of the procedure, MOREINFO="NONE"sp_sproc_columns looks first for a procedure owned by the current user and then for a procedure owned by the Database Owner.sp_qualifier - is the name of the database. This can be either the current database or NULL.column_name - is the name of the parameter about which you want information. If you do not supply a parameter name, MOREINFO="NONE"sp_sproc_columns returns information about all input and return parameters for the stored procedure.CommentsMARK="BULL" REMAP="BU--Bullet"LINKEND="X12548"Table 5-13
 describes the results set:TOCENTRY="1"LBL="Table 5-13:" ID="X12548"Results Set for sp_sproc_columnsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="2*"COLNAME="C3" COLWIDTH="5*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"procedure_qualifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"procedure_ownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"procedure_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(41) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column_typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"data_typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The integer code for an ODBC 
datatype. If this datatype cannot be 
mapped into an ANSI type, the value 
will be NULL. The native datatype 
name is returned in the type_name 
column.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The string representation of the 
datatype. This is the datatype name as 
presented by the underlying DBMS.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"precisionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of significant digits.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lengthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The length in bytes of the datatype.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"scaleCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of digits to the right of 
the decimal point.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"radixCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Base for numeric types.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nullableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The value 1 means this datatype can 
be created allowing null values; 0 
means it cannot.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remarksCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(254)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULL COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ss_data_typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A SQL Server datatype.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"colidCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A SQL Server specific column 
appended to the result set.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_sproc_columns cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_sproc_columns.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_sproc_columns.Tables UsedREMAP="BO--Body"sybsystemprocs..spt_datatype_info, syscolumns, sysobjects, sysprocedures, systypes ID="IN4541505440"sp_sproc_columns catalog stored procedure
ID="IN457475741"Columnssp_sproc_columns information on
ID="IN4517446042"Stored proceduressp_sproc_columns information on
ID="IN4538406443"sp_statistics catalog stored proceduresp_statisticsID="IN467376845"Indexessp_statistics information on
Returns a list of indexes on a single table.FORMAT="LINESPECIFIC"sp_statistics table_name [, table_owner]
[, table_qualifier] [, index_name] [, is_unique]ParametersREMAP="RI--RefIndent"table_name - is the name of the table. No wildcard pattern matching is supported. table_owner - is the owner of the table. No wildcard pattern matching is supported. If the parameter is not specified, MOREINFO="NONE"sp_statistics looks first for a table owned by the current user and then for a table owned by the Database Owner.table_qualifier - is the name of the database. This can be either the current database or NULL.index_name - is the index name. No wildcard pattern matching is supported.is_unique - is Y if unique indexes are to be returned; otherwise, it is N.Comments MARK="BULL" REMAP="BU--Bullet"The indexes in the results set appear in ascending order by the columns non-unique, type, index_name ,and seq_in_index.The index type hashed accepts exact match or range searches, but searches involving pattern matching do not use the index.LINKEND="X32121"Table 5-14
 describes the results set:TOCENTRY="1"LBL="Table 5-14:" ID="X32121"Results Set for sp_statisticsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="9*"COLNAME="C3" COLWIDTH="22*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_qualifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The database name. This field can be 
NULL. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_ownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"non_uniqueCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. The value 0 means unique, 
and 1 means not unique.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"index_qualifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"index_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. The value 0 means statistics 
for a table means clustered, 2 means 
hashed, and 3 means other.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"seq_in_indexCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"collationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(1)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The value A means ascending; D means 
descending; and NULL means not 
applicable.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cardinalityCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of rows in the table or unique 
values in the index.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pagesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of pages to store the index or 
table.MessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_statistics cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_statistics.MOREINFO="NONE"Catalog procedure sp_statistics can not be run in a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_statistics modifies system tables, so it cannot be run within a transaction.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_statistics.Tables UsedREMAP="BO--Body" syscolumns, sysindexes, sysobjectsID="IN4638337252"sp_statistics catalog stored procedure
ID="IN467307553"Indexessp_statistics information onREMAP="BO--Body"ID="IN4645267954"sp_stored_procedures catalog stored proceduresp_stored_proceduresID="IN4717238356"Stored proceduressp_stored_procedures information on
Returns information about one or more stored procedures.FORMAT="LINESPECIFIC"sp_stored_procedures [sp_name] [, sp_owner][, sp_qualifier]ParametersREMAP="RI--RefIndent"sp_name - is the name of the stored procedure. Use wildcards to request information about more than one stored procedure.sp_owner - is the owner of the stored procedure. Use wildcards to request information about procedures owned by more than one user.sp_qualifier - is the name of the database. This can be the current database, or NULL.Comments MARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"sp_stored_procedures can return the name of stored procedures for which the current user does not have execute permission.If the server attribute accessible_sproc is Y in the results set forMOREINFO="NONE" sp_server_info, only stored procedures that are executable by the current user are returned.MOREINFO="NONE"sp_stored_procedures only returns information about local stored procedures.LINKEND="X86102"Table 5-15
 shows the results set: TOCENTRY="1"LBL="Table 5-15:" ID="X86102"Results Set for sp_stored_proceduresCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="2*"COLNAME="C3" COLWIDTH="5*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"procedure_qualifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The name of the database.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"procedure_ownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"procedure_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(41)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"num_input_paramsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.The value -1 means 
indeterminate, >= 0 means the 
number of parameters.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"num_output_paramsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. The value -1 means 
indeterminate, >= 0 means the 
number of parameters.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"num_result_setsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. The value -1 means 
indeterminate, 0 means uses 
input/output parameters only, and
 > 0 means the number of results sets.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remarksCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(254)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLMessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Stored procedure qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_stored_procedures cannot be used to return information about stored procedures in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_stored_procedures.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_stored_procedures.Tables UsedREMAP="BO--Body"sysobjects, sysprocedures, sysprotects, sysusersID="IN4745198763"sp_stored_procedures catalog stored procedure
ID="IN4717169064"Stored proceduressp_stored_procedures information onREMAP="BO--Body"ID="X48736"sp_table_privilegesID="IN4369393"Tablessp_table_privileges information on
Returns privilege information for all columns in a table or view.FORMAT="LINESPECIFIC"sp_table_privileges table_name [, table_owner[, table_qualifier]]ParametersREMAP="RI--RefIndent"table_name - is the name of the table. No wildcard pattern matching is supported.table_owner - is the name of the table owner. No wildcard pattern matching is supported. If you do not specify the table owner, MOREINFO="NONE"sp_table_privileges looks first for a table owned by the current user and then for a table owned by the Database Owner.table_qualifier - is the name of the database. This can be either the current database or NULL.CommentsMARK="BULL" REMAP="BU--Bullet"LINKEND="X80196"Table 5-16
 shows the results set:TOCENTRY="1"LBL="Table 5-16:  " ID="X80196"Results Set for sp_table_privilegesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="23*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_qualifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The name of the database. This field can be 
NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_ownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"grantorCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"granteeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"privilegeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Identifies the table privilege. May be one of 
the following:

SELECT - The grantee is permitted to 
retrieve data for one or more columns of the 
table.

INSERT - The grantee is permitted to insert 
new rows containing data for one or more 
columns into the table.

UPDATE - The grantee is permitted to 
update the data in one or more columns of 
the table.

DELETE - The grantee is permitted to delete 
rows of data from the table.

REFERENCE - The grantee is permitted to 
refer to one or more columns of the table 
within a constraint.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"is_grantableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(3)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Indicates whether the grantee is permitted 
to grant the privilege to other users. The 
values are YES, NO, or NULL.ID="IN434489137"sp_table_privileges catalog stored procedure
ID="IN43686168"Tablessp_table_privileges information onMessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Catalog procedure sp_table_privileges can not be run in a transaction.REMAP="UN--Under"MOREINFO="NONE"sp_table_privileges updates system tables, so it cannot be run from within a transaction.MOREINFO="NONE"Object name can only be qualified with owner name.MOREINFO="NONE"Object name must be qualified with the owner name.MOREINFO="NONE"This may be a temporary object. Please execute procedure from tempdb.REMAP="UN--Under"You invoked MOREINFO="NONE"sp_table_priviliges for a table beginning with "#". Execute the MOREINFO="NONE"use command to switch to tempdb, then rerun MOREINFO="NONE"sp_table_priviliges.MOREINFO="NONE"The table or view named doesn't exist in the current database.REMAP="UN--Under"The table does not exist in the current database as specified. Check the spelling of the table name.MOREINFO="NONE"Table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_table_privileges cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_table_privileges.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_table_privileges.Tables UsedREMAP="BO--Body"sysobjects, sysusersID="IN4334822012"sp_tables catalog stored procedure
ID="IN435792313"FilesFilesSee also Tables; Transaction log!see also Tables; Transaction logsp_tablesID="IN446772615"Tablessp_tables
ID="IN447752816"Queriessp_tables and
ID="IN4416723117"Database objectssp_tables list of
ID="IN4412673618"from keywordsp_tables list of objects appearing in clause
Returns a list of objects that can appear in a MOREINFO="NONE"from clause.FORMAT="LINESPECIFIC"sp_tables [table_name] [, table_owner] [, table_qualifier][, table_type]ParametersREMAP="RI--RefIndent"table_name - is the name of the table. Use wildcards to request information about more than one table.table_owner - is the table owner. Use wildcards to request information about more than one table.table_qualifier - is the name of the database. Acceptable values are the name of the current database and NULL.table_type -  A list of values, separated by commas, giving information about all tables of the table type(s) specified, including the following:REMAP="UI--UserInput" FORMAT="LINESPECIFIC""'TABLE', 'SYSTEM TABLE', 'VIEW'"Enclose each table type with single quotation marks, and enclose the entire parameter with double quotation marks. Enter table types in uppercase.ExamplesNUMERATION="ARABIC" REMAP="E1--ExampleOne" CONTINUATION="RESTARTS" INHERITNUM="IGNORE"sp_tables @table_type = "'TABLE', 'VIEW'"REMAP="UN--Under"This procedure returns information about all tables in the current database of the type TABLE and VIEW and excludes information about system tables.CommentsMARK="BULL" REMAP="BU--Bullet"SQL Server doesn't necessarily check your read and write permissions on table_name. Access to the table is not guaranteed, even if you can display information about it.The results set includes tables, views, and synonyms and aliases for gateways to DBMS products that support those types. If the server attribute accessible_tablesID="IN4439634023"sp_server_info catalog stored proceduresp_tables and
 is Y in the results set for MOREINFO="NONE"sp_server_info, only tables that are accessible by the current user are returned.LINKEND="X41112"Table 5-17
 shows the results set:TOCENTRY="1"LBL="Table 5-17:" ID="X41112"Results Set for sp_tablesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_qualifierCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The database name. This field can be NULL.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_ownerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. The table name.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"table_typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NOT NULL. One of the following: 'TABLE', 
'VIEW', 'SYSTEM TABLE'.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remarksCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(254)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLID="IN4425604324"Catalog stored procedurescatalog;System procedures:catalog storedMessagesMARK="BULL" REMAP="BU--Bullet"MOREINFO="NONE"Table qualifier must be name of current database.REMAP="UN--Under"MOREINFO="NONE"sp_tables cannot be used to return information about tables in another database. Execute the MOREINFO="NONE"use command to switch to the desired database, then rerun MOREINFO="NONE"sp_tables.PermissionsREMAP="BO--Body"Any user can execute MOREINFO="NONE"sp_tables.Tables UsedREMAP="BO--Body"sysdatabasses, sysobjects, sysprotects, sysusersID="IN4416574628"Database objectssp_tables list of
ID="IN4434535029"sp_tables catalog stored procedure
ID="IN4412485530"from keywordsp_tables list of objects appearing in clauseNUMBER="A" ID="X94212"Reserved WordsID="INA89652"KeywordsREMAP="BO--Body"Keywords are words that have a special meaning. This appendix lists Transact-SQL, APT-SQL, and SQL92 keywords.RENDERAS="SECT1"Transact-SQL Reserved WordsID="INA89563"KeywordsTransact-SQL
ID="INA149384"Reserved wordsTransact-SQL;Transact-SQL:reserved words
ID="INA1490115"Reserved wordsReserved wordsSee also Keywords!see also KeywordsREMAP="BO--Body"The following words are reserved by SQL Server as keywords (command verbs) and cannot be used for the names of database objects such as databases, tables, rules, and defaults. Reserved words can be used for the names of local variables and for stored procedure parameter names. TOCENTRY="1"LBL="Table A-1:" ID="X49156"Transact-SQL Reserved WordsCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="126*"COLNAME="C2" COLWIDTH="81*"COLNAME="C3" COLWIDTH="81*"COLNAME="C4" COLWIDTH="81*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"addCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"closeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"diskCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fromCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"allCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"clusteredCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"distinctCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"gotoCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"alterCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"commitCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"doubleCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"grantCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"andCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"computeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dropCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"groupCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"anyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"confirmCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dummyCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"havingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"arith_overflowCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"constraintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dumpCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"holdlockCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"asCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"continueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"elseCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"identityCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ascCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"controlrowCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"endCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"identity_insertCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"atCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"convertCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"endtranCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ifCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"authorizationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"countCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"errlvlCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"inCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"avgCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"createCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"errorexitCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"indexCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"beginCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"currentCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"escapeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"insertCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"betweenCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cursorCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"exceptCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intersectCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"breakCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"data_pgsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"execCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intoCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"browseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"databaseCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"executeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"isCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bulkCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dbccCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"existsCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"isolationCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"byCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"deallocateCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"exitCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"keyCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cascadeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"declareCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fetchCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"killCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char_convertCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"defaultCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fillfactorCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"levelCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"checkCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"deleteCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"forCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"likeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"checkpointCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"descCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"foreignCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"linenoCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"loadCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"permCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"rollbackCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"toCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"maxCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"permanentCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"rowcntCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tranCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"minCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"planCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"rowcountCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"transactionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mirrorCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"precisionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"rowsCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"triggerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mirrorexitCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"prepareCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ruleCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"truncateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nationalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"primaryCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"saveCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tsequalCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"noholdlockCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"printCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"schemaCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"unionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nonclusteredCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"privilegesCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"selectCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"uniqueCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"notCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"procCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"setCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"updateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nullCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"procedureCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"setuserCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"used_pgsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numeric_truncationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"processexitCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sharedCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"userCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ofCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"publicCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"shutdownCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"user_optionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"offCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"raiserrorCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"someCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"usingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"offsetsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"readCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"statisticsCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"valuesCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"onCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"readtextCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"stripeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varyingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"onceCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"reconfigureCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sumCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"viewCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"onlyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"referencesCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syb_identityCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"waitforCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"openCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"replaceCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syb_restreeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"whereCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"optionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"reserved_pgsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tableCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"whileCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"orCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"returnCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tempCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"withCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"orderCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"revokeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"temporaryCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"workCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"overCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"roleCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"textsizeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"writetext ID="INA1490116"Reserved wordsAPT-SQLRENDERAS="SECT1"APT-SQL Keywords   ID="INA890117"KeywordsAPT-SQL;APT-SQL keywords listREMAP="BO--Body"LINKEND="X42846"Table A-2: APT-SQL Keywords
 lists the APT-SQL keywords which are not reserved words in Transact-SQL. If you are planning to use APT-SQL, avoid using these words as identifiers.TOCENTRY="1"LBL="Table A-2:" ID="X42846"APT-SQL KeywordsCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="72*"COLNAME="C2" COLWIDTH="72*"COLNAME="C3" COLWIDTH="72*"COLNAME="C4" COLWIDTH="72*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"$channelCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"charindexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"$curfieldCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"closesqlCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"interruptsqlCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sqlbeginCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"$curformCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"connectCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"listCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sqlendCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"$curgroupCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"curindexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"localCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sqlexprCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"$curpickCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cursqlindexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"logCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sqlrowCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"$dateCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datalengthCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lowerCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"submitCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"$indexCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datenameCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mchoiceCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"substringCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"$statusCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datepartCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"menuCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"switchCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"abortCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetimeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"menubarCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"switchendCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"andCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"defineCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"moneyCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"systemCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"appendCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"disconnectCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nextqueryCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tabCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"aptCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"enterCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nomsgCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"textCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"backtabCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"entryCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"opensqlCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"textportCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bellCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"exitformCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"parentnameCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyintCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binaryCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"expCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"performCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"traceCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bitCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"falseCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"positionformCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"transferCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"callCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fetchsqlCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"postCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"trimCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"callexternCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fieldCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"printformCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"trueCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"callformCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"floatCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"rchoiceCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"upperCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"callreportCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"foreachCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remoteCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"useformCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cancelformCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"formCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"resetCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"variableCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"caseCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"globalCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"schoiceCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"channelCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"hiddenCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"scrollCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"charCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"imageCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sharedCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID="INA1489128"Reserved wordsSQL92RENDERAS="SECT1"SQL92 KeywordsREMAP="BO--Body"SQL Server 10.0 includes entry-level SQL92 features. Full SQL92 implementation includes the words listed in the following tables as command syntax. Since upgrading identifiers can be a complex process, we are providing this list for your convenience. The publication of this information does not commit Sybase to providing all of these SQL92 features in subsequent releases, and in addition subsequent releases may include keywords not included in this list.REMAP="BO--Body"LINKEND="X25599"Table A-3
 lists the SQL92 keywords which are not reserved words in Transact-SQL. TOCENTRY="1"LBL="Table A-3:" ID="X25599"SQL92 Keywords That Are Not Transact-SQL Reserved WordsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="135*"COLNAME="C2" COLWIDTH="119*"COLNAME="C3" COLWIDTH="119*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"absolute COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"constraintsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"false COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"action COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"correspondingCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"first COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"allocate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"crossCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"floatCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"areCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"current_dateCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"foundCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"assertionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"current_time COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fullCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"current_timestamp COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"get COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bit_length COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"current_user COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"global COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"both COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"date COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"go COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cascaded COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"day COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"hourCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"case COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dec COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"immediate COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cast COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimal COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"indicator COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"catalog COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"deferrableCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"initially COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"deferred COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"inner COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"character COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"describe COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"inputCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char_lengthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"descriptor COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"insensitive COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"character_length COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"diagnosticsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"coalesce COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"disconnect COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"integer COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"collate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"domainCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intervalCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"collationCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"end-exec COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"joinCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"column COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"exceptionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"language COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"connect COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"external COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"last COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"connection COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"extractCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"leading COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"left COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"preserveCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"time COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"local COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"prior COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"timestamp COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lowerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"real COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"timezone_hour COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"match COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"relative COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"timezone_minuteCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"minute COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"restrict COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"trailingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"module COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"rightCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"translateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"monthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"scroll COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"translation COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"names COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"second COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"trim COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"natural COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sectionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"trueCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nchar COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"session COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"unknownCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"next COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"session_user COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"upper COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"no COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"size COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"usageCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nullif COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"value COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numericCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"space COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varcharCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"octet_length COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sql COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"when COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"outerCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sqlcode COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"whenever COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"output COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sqlerror COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"writeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"overlapsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sqlstateCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"yearCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pad COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"substringCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"zoneCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"partial COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"system_userCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"position COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"then COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID="X91260" RENDERAS="SECT1"Potential SQL92 Reserved WordsREMAP="BO--Body"If you are using the ISO/IEC 9075:1989 standard, also avoid using the words in LINKEND="X49156"Table A-4: Potential Reserved Words
, as these words may become SQL92 reserved words in the future. TOCENTRY="1"LBL="Table A-4:"Potential Reserved WordsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="101*"COLNAME="C2" COLWIDTH="101*"COLNAME="C3" COLWIDTH="101*"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"afterCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"modifyCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"routineCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"aliasCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"newCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"rowCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"asyncCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"noneCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"savepointCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"beforeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"objectCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"searchCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"booleanCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"oidCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sensitiveCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"breadthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"oldCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sequenceCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"completionCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"operationCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"signalCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"callCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"operatorsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"similarCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cycleCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"othersCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sqlexceptionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dataCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"parametersCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"structureCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pendantCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"testCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dictionaryCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"preorderCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"thereCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"eachCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"privateCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"elseifCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"protectedCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"underCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"equalsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"recursiveCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"variableCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"generalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"refCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"virtualCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ignoreCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"referencingCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"visibleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"leaveCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"resignalCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"waitCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lessCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"returnCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"withoutCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"limitCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"returnsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"loopCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"roleCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID="INA1487149"Reserved words
ID="INA8851610"KeywordsREMAP="BO--Body"NUMBER="B" ID="X56552"The System TablesRENDERAS="SECT1"IntroductionID="IN381"System tablesREMAP="BO--Body"All of the tables in the MOREINFO="NONE"master database are system tables. Some of these tables also occur in user databases-they are automatically created when the MOREINFO="NONE"create database command is issued. REMAP="BO--Body"These system tables occur in all databases: TOCENTRY="1"LBL="Table B-1:" ID="X73014"System tables that occur in all databasesCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="15*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"System TableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Contents VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysalternates COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for SQL Server each  user mapped to a database 
user COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syscolumns COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each column in a table or view, and for each 
parameter in a procedure COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syscomments COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One or more rows for each view, rule, default, trigger, and 
procedure, giving SQL definition statement COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysconstraints COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each referential and check constraint 
associated with a table or columnCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysdepends COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each procedure, view, or table that is 
referenced by a procedure, view, or trigger COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysindexes COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each clustered or nonclustered index, and one 
row for each table with no indexes, and an additional row 
for each table containing text or image data. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syskeys COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each primary, foreign, or common key; set by 
user (not maintained by SQL Server) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syslogs COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction log COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysobjects COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each table, view, procedure, rule, trigger 
default, log, and (in tempdb only) temporary object COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysprocedures COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each view, rule, default, trigger, and 
procedure, giving internal definition COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysprotects COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User permissions information COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysreferences COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each referential integrity constraint declared 
on a table or columnCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysroles COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maps server-wide roles to local database groupsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syssegments COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each segment (named collection of disk 
pieces) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"systhresholds COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each threshold defined for the databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"systypes COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each system-supplied and user-defined 
datatype COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysusermessages COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each user-defined message COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysusers COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each user allowed in the database ID="IN772"System tablesmaster database
ID="IN773"master databasesystem tablesREMAP="BO--Body"These system tables occur in the MOREINFO="NONE"master database only: TOCENTRY="1"LBL="Table B-2:"System tables that occur in the master database onlyCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="15*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"System TableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Contents VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syscharsets COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each character set or sort order COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysconfigures COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each user-settable configuration parameter COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syscurconfigs COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Information about configuration parameters currently 
being used by SQL ServerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysdatabases COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each database on SQL ServerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysdevices COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each tape dump device, disk dump device, 
disk for databases, and disk partition for databases COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysengines COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each SQL Server engine currently online COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syslanguages COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each language (except U.S. English) known to 
the server COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syslocks COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Information about active locks COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysloginroles COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each server login that possesses a system-
defined roleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syslogins COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each valid SQL Server user account COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysmessages COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each system error or warning COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysprocesses COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Information about server processes COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysremotelogins COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each remote user COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"syssrvroles COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each server-wide roleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysservers COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each remote SQL ServerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysusages COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each disk piece allocated to a database REMAP="BO--Body"These system tables occur in the sybsecurity database only:TOCENTRY="1"LBL="Table B-3:"System tables that occur in the sybsecurity database onlyCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="15*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"System TableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Contents VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysaudits COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each audit recordCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysauditoptions COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One row for each global audit optionREMAP="BO--Body"In the pages that follow, each system table is described in more detail, including a list of their columns and datatypes. In addition, the indexes and the system procedures that reference a particular table are listed. ID="IN334"ColumnsreservedREMAP="BO--Body"The word "reserved" in the column description means that the column is currently not being used by SQL Server. ID="IN285"System tablespermissions on
ID="IN256"Permissionssystem tablesREMAP="BO--Body"Permissions for use of the system tables can be controlled by the database owner, just like permissions on any other tables. REMAP="BO--Body"The SYBASE installation program sets up permissions so that all users can read the system tables, with the exception of a few fields. (See the SQL Server Installation Guide for details.) ID="IN227"Updatingsystem tables
ID="IN328"Updatingdirect to system tables
ID="IN229"System tablesupdating
ID="INA3110"Direct updates to system tablesREMAP="BO--Body"All direct updates on system tables are by default not allowed even for the database owner. Instead, SQL Server supplies system procedures to make any normally needed updates and additions to system tables. ID="IN3011"Updatingsystem procedures and
ID="IN3012"System proceduresupdating and
ID="IN3113"System tablesdirect updates to
ID="IN7514"System tablesallow updates variable and
ID="IN8015"Dynamic configuration variablesallow updates
ID="IN7116"allow updates configuration variableREMAP="BO--Body"You can allow direct updates to the system tables if it becomes necessary to modify them in a way that cannot be accomplished with a system procedure. To accomplish this, a System Security Officer must reset the configuration variable called MOREINFO="NONE"allow updates with the system procedure MOREINFO="NONE"sp_configure, and a System Administrator must then execute the MOREINFO="NONE"reconfigure command. For information, see the System Administration Guide. ID="IN3417"System tableschanges dangerous to
ID="IN7018"syslogs tabledanger of changing the
ID="IN2219"Changingsystem tables
ID="IN6820"Changingsyslogs table, dangers ofREMAP="BO--Body"There are entries in some of the MOREINFO="NONE"master database tables that should not be altered by any user under any circumstances. For example, do not attempt to modify syslogs with a MOREINFO="NONE"delete, MOREINFO="NONE"update, or MOREINFO="NONE"insert command. In addition, an attempt to MOREINFO="NONE"delete all rows from syslogs will put SQL Server into an infinite loop that eventually fills up the entire database. ID="IN4621"Aggregate functionsnot used on virtual tables
ID="IN1422"Virtual tablesREMAP="BO--Body"Note that aggregate functions cannot be used on virtual tables such as syslocks and sysprocessesID="IN3623"System tables
. REMAP="BO--Body"A diagram of the system tables and their relationships is included at the back of the bound System Administration Guide and the SQL ServerReference Manuals Volumes 1 and 2. The diagram is not included with camera-ready copy or CD-ROM versions of the manuals.ID="IN5424"System tablesdescriptions of individual
ID="IN6425"sysalternates tablesysalternates(all databases) DescriptionREMAP="BO--Body"ID="IN6126"Aliasessysalternates table
sysalternates contains one row for each SQL Server user mapped (or aliased) to a user of the current database. When a user tries to access a database, SQL Server looks for a valid MOREINFO="NONE"uidID="IN10627"sysusers tablesysalternates table and
entry in sysusers. If none is found, it looks in sysalternates.suid. If the user's MOREINFO="NONE"suid is found there, he or she is treated as the database user whose MOREINFO="NONE"suid is listed in sysalternates.altsuid. REMAP="BO--Body"On the SQL Server distribution tape, there are no entries in sysalternates. TOCENTRY="1"LBL="Table B-4:"Columns in the sysalternates tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="26*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server user ID of user being mapped COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"altsuid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server user ID of user to whom another user is 
mapped IndexesREMAP="BO--Body"Unique clustered index on suidReferenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addalias, sp_adduser, sp_changedbowner, sp_dropalias, sp_dropuser, sp_helpusersysauditoptionsID="IN6428"Auditingsysauditoptions table
ID="IN8029"sysauditoptions table
ID="INA8430"Global audit options, sysauditoptions system table(sybsecurity database) DescriptionREMAP="BO--Body"sysauditoptions contains one row for each global audit option (options set via MOREINFO="NONE"sp_auditoption).These are the system-wide options only, and do not include database, object, stored procedure, trigger, and user audit options. The default value for each option is 0 or "off." sysauditoptions can be accessed only by System Security Officers.TOCENTRY="1"LBL="Table B-5:"Columns in the sysauditoptions tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="4*"COLNAME="C3" COLWIDTH="13*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"optn COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Option number. See Table B-6.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"value COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Current value; one of the following:
off = 0
ok = 1
fail = 2
both = 3 (where applicable)
For error auditing (optn=13), the values are:
off = 0
nonfatal = 1
fatal = 2
both = 3COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"min COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Minimum valid value for this optionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"max COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum valid value for this optionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of optionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"svalue COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)   COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"String equivalent of the current value: for 
example, "on", "off", "nonfatal"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"comment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Description of optionREMAP="BO--Body"Possible values for optn are:TOCENTRY="1"LBL="Table B-6:"Audit option values and descriptionsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="31*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Option 
NumberCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enable or disable auditingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UnusedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Login auditingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Logout auditingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server boot auditingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RPC connection auditingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Auditing use of the MOREINFO="NONE"set command to turn roles on and offCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Auditing commands requiring MOREINFO="NONE"sa_role roleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"9COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Auditing commands requiring MOREINFO="NONE"sso_role roleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Auditing commands requiring MOREINFO="NONE"oper_role roleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Auditing commands requiring MOREINFO="NONE"navigator roleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Error auditingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"14COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Ad hoc auditingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"15COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Auditing commands requiring MOREINFO="NONE"replication roleIndexesREMAP="BO--Body"NoneReferenced by System Procedures REMAP="BO--Body"ID="IN7831"sysauditoptions table
MOREINFO="NONE"sp_auditoption sysaudits ID="IN5832"Auditingsysaudits table
ID="IN7433"sysaudits table(sybsecurity database)DescriptionREMAP="BO--Body"The sysaudits table contains one row for each audit record. TOCENTRY="1"LBL="Table B-7:"Columns in the sysaudits tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="10*"COLNAME="C3" COLWIDTH="23*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"event COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Type of event being audited. See Table B-8.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"eventmod COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Further information about the event. 
Possible values are:
0 = no modifier for this event
1 = successful occurrence of this event; for 
     error auditing (event=13), a nonfatal error 
2 = failed occurrence of this event; for error 
     auditing (event=13), a fatal error COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"spid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server process ID of the process that caused 
the audit record to be writtenCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"eventtime COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Date and time of the audited event COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sequence COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sequence number of the record within a 
single event; some events require more than 
one audit recordCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server login ID of the user who performed 
the audited eventCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dbid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database ID in which the audited event 
occurred or the object/stored 
procedure/trigger resides, depending on 
the type of eventCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"objid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of the accessed object or stored 
procedure/triggerCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"xactid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binary(6) null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of the transaction containing the audited 
event. For a multi-database transaction, this 
is the transaction ID from the database 
where the transaction originated.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"loginname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Login name corresponding to the suidCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dbname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database name corresponding to the dbidCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"objname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object name corresponding to the objidCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"objowner COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of the owner of objidCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"extrainfo COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Additional information about the audited 
event; contents vary with the type of event 
audited. (See Table B-8.)REMAP="BO--Body"Possible values for the event column are shown in LINKEND="X99999"Table B-8
, along with the corresponding contents of the extrainfo column. Global audit events have a code of less than 100. All other event types are numbered starting at 100. TOCENTRY="1"LBL="Table B-8:" ID="X99999"Contents of event and extrainfo columns of sysauditsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="2*"COLNAME="C2" COLWIDTH="9*"COLNAME="C3" COLWIDTH="9*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"event 
No.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Contents of extrainfo ColumnVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Enable auditingCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Disable auditingCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"LoginCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Host nameCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"LogoutCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Host nameCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server bootCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Names of the server program, 
master device, interfaces file path, 
server, and error log fileCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RPC connectionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Remote server name, host nameCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Use of MOREINFO="NONE"set command to turn roles 
on and offCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Role, new settingCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command requiring MOREINFO="NONE"sa_role roleCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"9COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command requiring MOREINFO="NONE"sso_role roleCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command requiring MOREINFO="NONE"oper_role roleCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command requiring MOREINFO="NONE"navigator roleCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ErrorCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Error number, severity, and stateCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"14COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Ad hoc audit recordCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User-supplied comment textCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"15COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command requiring MOREINFO="NONE"replication 
roleCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"100COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database reference COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"101COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table reference COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"102COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"View reference COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"103COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure executionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Parameter listCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"104COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Trigger executionCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"105COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User's attempts to access a tableCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"106COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User's attempt to access a viewCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command typeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"107COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User's command text auditingCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command batch textIndexesREMAP="BO--Body"NoneReferenced by System Procedures ID="IN7234"sysaudits tableREMAP="BO--Body"NonesyscharsetsID="IN7635"syscharsets table
ID="INA7336"Character setssyscharsets system table(master database only) DescriptionREMAP="BO--Body"syscharsetscontains one row for each character set and sort order defined for use by SQL Server. One of the sort orders is marked in master..sysconfigures as the default sort order, which is the only one actually in use. ID="IN1637"Namessort orderID="IN1938"Namescharacter setID="IN6939"Sort ordersyscharsets system tableTOCENTRY="1"LBL="Table B-9:"Columns in the syscharsets tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The type of entity this row represents. Numbers 
from 1001 to 1999 represent character sets. 
Numbers from 2000 to 2999 represent sort 
orders. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The ID for a character set or sort order. A sort 
order is defined by the combination of the sort 
order ID and the character set ID (csid). The 
character set is defined by id, which must be 
unique. Sybase reserves ID numbers 0-200. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"csid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"If the row represents a character set, this field is 
unused. If the row represents a sort order, this is 
the ID of the character set that sort order is built 
on. A character set row with this ID must exist 
in this table. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Internal system status information bits. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A unique name for the character set or sort 
order. Must contain only the 7-bit ASCII letters 
A-Z or a-z, digits 0-9, and underscores (_), and 
begin with a letter. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"description COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"An optional description of the features of the 
character set or sort order. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"definition COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"imageCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The internal definition of the character set or 
sort order. The structure of the data in this field 
depends on the type. IndexesREMAP="BO--Body"unique clustered index on id, csid, typeunique nonclustered index on nameReferenced by System Procedures REMAP="BO--Body"ID="IN7440"syscharsets table
MOREINFO="NONE"sp_checkreswords, sp_helpsort, sp_serverinfo syscolumnsID="INA7541"syscolumns table(all databases) DescriptionREMAP="BO--Body"syscolumns contains one row for every column in every table and view, and a row for each parameter in a procedure. ID="IN3242"Tablessystem tables entries forID="IN3143"Viewssystem tables entries forTOCENTRY="1"LBL="Table B-10:"Columns in the syscolumns tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="9*"COLNAME="C3" COLWIDTH="24*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of table to which this column belongs or of 
procedure with which this parameter is 
associated COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"number COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sub-procedure number when the procedure is 
grouped (0 for non-procedure entries) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"colid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Indicates unique position for bit columns,
whether NULL values are legal in this 
column, and if a check constraint exists for the 
columnCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Physical storage type; copied from systypes COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"length COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Physical length of data; copied from systypes 
or supplied by user COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"offset COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Offset into the row where this column 
appears, if negative, this is a variable-length 
columnCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"usertype COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User type ID; copied from systypes COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cdefault COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of the procedure that generates default 
value for this column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"domain COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Constraint ID of the first rule or check 
constraint for this column COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"printfmt COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ReservedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"prec COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of significant digitsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"scale COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of digits to the right of the decimal 
pointIndexes REMAP="BO--Body"unique clustered index onMOREINFO="NONE" id, number, colid Referenced by System Procedures REMAP="BO--Body"MOREINFO="NONE"sp_bindefault, sp_bindrule, sp_changegroup, sp_checknames, sp_checkreswords, sp_column_privileges, sp_columns, sp_commonkey, sp_droptype, sp_dropuser, sp_estspace, sp_foreignkey, sp_help, sp_helpconstraint, sp_helpjoins, sp_helprotect, sp_primarykey, sp_rename, sp_special_columns, sp_sproc_columns, sp_statistics, sp_unbindefault, sp_unbindrule ID="IN7344"syscolumns tablesyscommentsID="INA6245"syscomments table(all databases) DescriptionREMAP="BO--Body"syscommentscontains entries for each view, rule, default, trigger, table constraint, and procedure. The MOREINFO="NONE"text field contains the original definition statements. If the MOREINFO="NONE"text is longer than 255 bytes, the entries will span rows. Each object can occupy up to 65025 rows. ID="IN3146"Viewssystem tables entries forID="INA3147"Rulessystem tables entries forID="IN3448"Defaultssystem tables entries forID="IN3449"Triggerssystem tables entries forID="IN4350"Stored proceduressystem tables entries forTOCENTRY="1"LBL="Table B-11:"Columns in the syscomments tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="26*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object ID to which this text applies COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"number COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sub-procedure number when the procedure is 
grouped (0 for non-procedure entries) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"colid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sequence of 255 rows for the object COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"texttype COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 for system-supplied comment (for views, rules, 
defaults, triggers, and procedures). 1 for user-
supplied comment (users can add entries that 
describe an object or column) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"language COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"text COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Actual text of SQL definition statementCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"colid2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Indicates next sequence of rows for the object (see 
colid above); object can have up to 255 sequences of 
255 rows each.Indexes REMAP="BO--Body"unique clustered index on MOREINFO="NONE"id, number, colid, texttypeReferenced by System Procedures REMAP="BO--Body"MOREINFO="NONE"sp_helpconstraint, sp_helptext sysconfiguresID="IN7851"sysconfigures table(master database only) DescriptionREMAP="BO--Body"sysconfigures and syscurconfigsID="IN4453"Configuration variablessystem tables values
 contain one row for each user-settable configuration variable.TOCENTRY="1"LBL="Table B-12:"Columns in the sysconfigures tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="26*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"config COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Configuration variable numberCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"value COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The user-modifiable value for the variable (being 
used by  only if MOREINFO="NONE"reconfigure has been 
run)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"comment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Explanation of the configuration variable COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Either 1 (dynamic, meaning variable takes effect 
when MOREINFO="NONE"reconfigure is issued) or 0 (variable takes 
effect when  is restartedREMAP="BO--Body"Here are the contents of sysconfigures:TOCENTRY="1"LBL="Table B-13:"Contents of sysconfigures COLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="7*"COLNAME="C4" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"configCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"valueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"commentCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"statusVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"101COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum recovery interval in minutesCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"102COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allow updates to system tablesCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"103COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of user connections allowedCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"104COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Size of available physical memory in 2k pagesCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"105COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of open databases allowed among all usersCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"106COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of locks for all usersCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"107COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of open database objectsCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"108COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Percentage of remaining memory used for procedure 
cacheCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"109COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Default fill factor percentageCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"110COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Average time slice per process in millisecondsCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"111COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Default database size in megabytesCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"112COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Tape retention period in daysCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"113COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Recovery flagsCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"115COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allow triggers to be invoked within triggersCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"116COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of devicesCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"117COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Allow remote accessCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"118COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of remote loginsCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"119COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of remote sitesCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"120COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of remote connectionsCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"121COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of pre-read packets per remote connectionCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"122COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1001COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Upgrade version   COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1   COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"123COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"50COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Default sortorder IDCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"124COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Default languageCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"125COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Language cacheCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"126COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum online enginesCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"127COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Minimum online enginesCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"128COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Engine adjust intervalCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"129COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"200COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CPU accounting flush intervalCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"130COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"I/O accounting flush intervalCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Default character set IDCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"134COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stack sizeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"135COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"System-wide password expiration intervalCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"136COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"100COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audit queue sizeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"137COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Additional netmemCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"138COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Default network packet sizeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"139COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum network packet sizeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"140COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of extent I/O buffersCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"141COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Identity burning set factorCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0IndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"config Referenced by System Procedures REMAP="BO--Body"MOREINFO="NONE"sp_configureID="IN7654"sysconfigures table
 sysconstraintsID="IN6555"sysconstraints table(all databases) DescriptionID="IN6656"Constraintssysconstraints tableREMAP="BO--Body"The sysconstraints table has one row for each referential and check constraint associated with a table or column.REMAP="BO--Body"Whenever a user declares a new check constraint or referential constraint using MOREINFO="NONE"create table or MOREINFO="NONE"alter table, SQL Server inserts a row into the sysconstraints table. The row remains until a user executes MOREINFO="NONE"alter table to drop the constraint. Dropping a table by executing MOREINFO="NONE"drop table removes all rows associated with that table from the sysconstraints table.ID="IN8857"Referential integrity constraintssysconstraints tableID="IN7258"Check constraintssysconstraints tableTOCENTRY="1"LBL="Table B-14:"Columns in the sysconstraints tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"colid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column number in the tableCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"spare1 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UnusedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"constrid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object ID of the constraintCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tableid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of the table on which the constraint is declaredCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"error COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Constraint specific error messageCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The type of constraint: 
0x0040 = a referential constraint
0x0080 = a check constraintCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"spare2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UnusedIndexesREMAP="BO--Body"clustered index on tableid, colidunique nonclustered index on constridReferenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_bindmsg, sp_bindrule, sp_helpconstraint, sp_unbindmsg, sp_unbindrulesyscurconfigsID="IN6459"syscurconfigs table(master database only) DescriptionREMAP="BO--Body"syscurconfigs is built dynamically when queried. Its structure is identical to that of sysconfiguresID="IN4462"Configuration variablessystem tables values
. It contains an entry for each of the configuration variables, as does sysconfiguresID="IN2363"Configuration structure
, but with the current values rather than the default values. In addition, it contains four rows that describe the configuration structure. ID="IN2360"StructureconfigurationID="IN4461"Information (Server)configuration variablesTOCENTRY="1"LBL="Table B-15:"Columns in the syscurconfigs tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="26*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"config COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Configuration variable numberCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"value COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The user-modifiable value for the variable (being 
used by  only if MOREINFO="NONE"reconfigure has been 
run)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"comment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Explanation of the configuration variable COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Either 1 (dynamic, meaning variable takes effect 
when MOREINFO="NONE"reconfigure is issued) or 0 (variable takes 
effect when  is restartedReferenced by System Procedures REMAP="BO--Body"MOREINFO="NONE"sp_configure, sp_helpsort, sp_serverinfo sysdatabasesID="INA7764"sysdatabases table(master database only) DescriptionREMAP="BO--Body"sysdatabases contains one row for each database on SQL Server. When SQL Server is installed, sysdatabases contains entries for the MOREINFO="NONE"master database, the MOREINFO="NONE"model database, the sybsystemprocs database and the MOREINFO="NONE"temporary database. If you have installed auditing, it also contains an entry for the sybsecurity databaseMOREINFO="NONE"ID="IN4465"Information (Server)databasesID="IN3566"Databasessystem tables entries forTOCENTRY="1"LBL="Table B-16:"Columns in the sysdatabases tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of the database COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dbid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server user ID of database creator COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Control bits; those which the user can set with 
MOREINFO="NONE"sp_dboption are marked "settable." See Table B-17.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"version COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Version of  code under which 
database was created COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"logptr COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Pointer to transaction log COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"crdate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Creation date COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dumptrdate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Date of the last MOREINFO="NONE"dump MOREINFO="NONE"transaction COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intn COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Additional control bits. See Table B-18.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"audflags COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intn COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Audit settings for databaseCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"deftabaud COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intn COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bit-mask that defines default audit settings for 
tablesCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"defvwaud COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intn COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bit-mask that defines default audit settings for 
viewsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"defpraud COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intn COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bit-mask that defines default audit settings for 
stored proceduresREMAP="BO--Body"The bit representations for the status column are:MOREINFO="NONE"TOCENTRY="1"LBL="Table B-17:"status control bits in the sysdatabases tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DecimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusVALIGN="TOP"COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x04COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"select into/bulkcopy; settableCOLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"8COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x08COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"trunc log on chkpt; settable COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"16COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x10COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"no chkpt on recovery; settableCOLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"32COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x20COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"crashed while loading database, instructs recovery 
not to proceed COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"256COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x100COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"database suspect; not recovered; cannot be opened 
or used; can only be dropped with MOREINFO="NONE"dbcc dbrepair COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"512COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x200COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"ddl in tran; settableCOLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"1024COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x400COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"read only; settableCOLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"2048COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x800 COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"dbo use only; settable COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"4096COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x1000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"single user; settable COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"8192COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x2000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"allow nulls by default; settable COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"16384COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x4000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dbname has changed REMAP="BO--Body"The bit representations for the status2 column are:MOREINFO="NONE"TOCENTRY="1"LBL="Table B-18:"status2 control bits in the sysdatabases tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="6*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DecimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusVALIGN="TOP"COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x01COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"abort tran on log full; settableCOLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x02COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"no free space acctg; settable COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x04COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"auto identity; settable IndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"nameunique nonclustered index on MOREINFO="NONE"dbidReferenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addlogin, sp_addsegment, sp_addtype, sp_changedbowner, sp_checknames, sp_checkreswords, sp_databases, sp_dboption, sp_dbremap, sp_dropdevice, sp_dropsegment, sp_extendsegment, sp_helpdb, sp_logdevice, sp_renamedb, sp_tables ID="IN4267"Information (Server)databasesID="IN7568"sysdatabases tablesysdependsID="INA6169"sysdepends table(all databases) DescriptionREMAP="BO--Body"ID="IN3270"Database objectsdependencies of
ID="IN8071"Dependencies, database objectsysdepends table
sysdependsID="IN3072"Tablesobject dependencies and
ID="IN4173"Stored proceduresobject dependencies and
ID="IN2974"Viewsobject dependencies and
ID="IN3275"Triggersobject dependencies and
contains one row for each procedure, view, or table that is referenced by a procedure, view, or trigger. TOCENTRY="1"LBL="Table B-19:"Columns in the sysdepends tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="28*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"number COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Procedure number COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dependent object ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depnumbe
r COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dependent procedure number COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Internal status information COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"selall COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bit COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"On if object is used in MOREINFO="NONE"select * statement COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"resultobj COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bit COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"On if object is being updated COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"readobj COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bit COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"On if object is being readIndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"id, number, depid, depnumberReferenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_depends sysdevicesID="IN7576"sysdevices table(master database only) DescriptionREMAP="BO--Body"ID="IN6377"Disk devicessysdevices table
ID="IN3378"Devicessystem tables entries for
ID="IN4179"Database devicessystem table entries for
ID="IN6780"Database devicessysdevices table
sysdevicesID="IN6881"Tape dump devicessysdevices table
ID="IN3882"Dump devicessystem tables entries for
ID="IN6783"Dump devicessysdevices table and
 contains one row for each tape dump device, disk dump device, disk for databases, and disk partition for databases. On the SQL Server distribution tape, there are four entries in sysdevices: one for the master device (for databases), one for a disk dump device, and two for tape dump devices. TOCENTRY="1"LBL="Table B-20:"Columns in the sysdevices tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="9*"COLNAME="C3" COLWIDTH="23*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"low COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"First virtual page number on database 
device (not used for dump devices) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"high COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Last virtual page number on database 
device or dump device COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bit map indicating type of device, default 
and mirror status. See Table B-21.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cntrltype COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Controller type (0 if database device, 2 if 
disk dump device or streaming tape, 3­ -8 if 
tape dump device) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Logical name of dump device or of database 
device COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"phyname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(127) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of physical device COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mirrorname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(127) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of mirror device REMAP="BO--Body"The bit representations for the status column are additive. For example, "3" indicates a physical disk that is also a default. REMAP="BO--Body"The status control bits are:TOCENTRY="1"LBL="Table B-21:"status control bits in the sysdevices tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="15*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DecimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Hex COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusVALIGN="TOP"COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x01COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"default diskCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x02COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"physical disk COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x04COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"logical disk COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x08COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"skip header COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x10COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dump device COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"32COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x20COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"serial writes COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"64COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x40COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"device mirrored COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"128COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x80COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"reads mirrored COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"256COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x100COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"secondary mirror side onlyCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"512COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x200COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mirror enabled COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2048COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x800COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"used internallyIndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"name Referenced by System ProceduresREMAP="BO--Body"ID="IN7384"sysdevices table
MOREINFO="NONE"sp_addsegment, sp_addumpdevice, sp_checknames, sp_checkreswords, sp_configure, sp_diskdefault, sp_dropdevice, sp_dropsegment, sp_extendsegment, sp_helpdb, sp_helpdevice, sp_helplog, sp_helpsegment, sp_logdevice, sp_volchangedsysenginesID="IN6185"sysengines table(master database only) DescriptionREMAP="BO--Body"ID="IN3386"Enginessystem tables entries for
ID="IN6987"Enginessysengines table
sysengines contains one row for each SQL Server engine currently on line. TOCENTRY="1"LBL="Table B-22:"Columns in the sysengines tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"engine COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Engine number COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"osprocid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Operating system process ID (may be NULL) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"osprocname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Operating system process name (may be NULL) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One of: online, off-line, in create, in destroy, 
debug COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"affinitied COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of  processes with affinity to 
this engine COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cur_kpid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Kernel process ID of process currently running 
on this engine, if any COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"last_kpid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Kernel process ID of process which previously 
ran on this engineCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"idle_1 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"idle_2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"idle_3 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"idle_4 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"starttime COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Date and time engine came on line IndexesREMAP="BO--Body"none Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_monitorsysindexesID="IN7588"sysindexes table(all databases) DescriptionREMAP="BO--Body"ID="IN3389"Indexessystem tables entries for
sysindexesID="IN10290"text datatypesysindexes table and
 contains one row for each clustered index, one row for each nonclustered index, one row for each table that has no clustered index, and one row for each table that contains MOREINFO="NONE"textID="INA10391"image datatypesysindexes table and
 or image columns. ID="IN3992"Number  of pagesused by table or indexREMAP="BO--Body"The column MOREINFO="NONE"doampgID="IN3693"Clustered indexespages allocated to
 is used only if the row describes a table or clustered index. TOCENTRY="1"LBL="Table B-23:"Columns in the sysindexes tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="9*"COLNAME="C3" COLWIDTH="24*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Index or table name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of table, or ID of table to which index 
belongsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"indid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0 if table, 1 if clustered index, >1 if 
nonclustered, 255 if text chain COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"doampg COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Page number for the object allocation map of a 
table or clustered index COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ioampg COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Page number for the allocation map of a 
nonclustered indexCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"oampgtrips COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Ratio of OAM page to data page residency in 
cacheCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Internal system status information. See Table B-24.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ipgtrips COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Ratio of index page to data page residency in 
cacheCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"first COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Pointer to first data or leaf page COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"root COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Pointer to root page if entry is an index; 
pointer to last page if entry is a table or text 
chain COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"distribution COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Pointer to distribution page (if entry is an 
index) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"usagecnt COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"segment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of segment in which this object 
residesCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Internal system status information (See Table B-25.)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"rowpage COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum number of rows per page COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"minlen COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Minimum size of a row COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"maxlen COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum size of a row COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"maxirow COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Maximum size of a non-leaf index row COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"keycnt COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of keys for a clustered index; number 
of keys+1 for a nonclustered indexCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"keys1 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinary(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Description of key columns (if entry is an 
index) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"keys2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinary(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Description of key columns (if entry is an 
index)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"soid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sort order ID that the index was created with. 
`0' if there is no character data in the keys COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"csid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Character set ID that the index was created 
with. `0' if there is no character data in the 
keys REMAP="BO--Body"The bit representations for the status2TOCENTRY="1"LBL="Table B-24:"status2 control bits in the sysindexes tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="6*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DecimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusVALIGN="TOP"COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Index part of referential integrity constraintCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Index part of primary key/unique constraintREMAP="BO--Body"The bit representations for the status column are: TOCENTRY="1"LBL="Table B-25:"status control bits in the sysindexes table COLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="6*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DecimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusVALIGN="TOP"COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort command or trigger if attempt to insert 
duplicate key COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Unique index COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x4COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Abort command or trigger if attempt to insert 
duplicate rowCOLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"16COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x10COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Clustered index COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"64COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x40 COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Index allows duplicate rows COLNAME="C1" ALIGN="RIGHT" ROTATE="0" MOREROWS="0"32768COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x8000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Suspect index IndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"id, indid Referenced by System ProceduresREMAP="BO--Body"ID="IN7394"sysindexes table
MOREINFO="NONE"sp_checknames, sp_checkreswords, sp_dropsegment, sp_estspace, sp_help, sp_helpconstraint, sp_helpindex, sp_helplog, sp_helpsegment, sp_indsuspect, sp_pkeys, sp_placeobject, sp_rename, sp_spaceused, sp_special_columns, sp_statisticssyskeysID="INA7295"syskeys table(all databases) DescriptionREMAP="BO--Body"ID="IN7396"Keys, tablesyskeys table
syskeysID="IN6097"Primary keyssyskeys table
ID="IN6098"Foreign keyssyskeys table
ID="IN5999"Common keyssyskeys table
 contains one row for each primary, foreign, or common key. TOCENTRY="1"LBL="Table B-26:"Columns in the syskeys tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Record type COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dependent object ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"keycnt COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of non-null keys COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"size COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key1 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key3 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key4 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key5 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key6 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key7 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"key8 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depkey1 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depkey2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depkey3 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depkey4 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depkey5 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depkey6 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depkey7 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"depkey8 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID ID="IN18100"Keys, tablesystem
ID="IN36101"System tableskeys forIndexesREMAP="BO--Body"clustered index on MOREINFO="NONE"idReferenced by System ProceduresREMAP="BO--Body"ID="IN70102"syskeys table
ID="IN71103"Keys, tablesyskeys table
ID="IN34104"System tableskeys for
MOREINFO="NONE"sp_commonkey, sp_dropkey, sp_foreignkey, sp_helpjoins, sp_helpkey, sp_primarykey syslanguagesID="IN77105"syslanguages table(master database only) DescriptionREMAP="BO--Body"ID="IN73106"Languages, alternatesyslanguages table
ID="IN46107"Languages, alternatesystem tables entries for
syslanguagesID="IN42108"English language, U.S.
 contains one row for each language known to SQL Server. us_english is not in syslanguages, but is always available to SQL Server. TOCENTRY="1"LBL="Table B-27:"Columns in the syslanguages tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="9*"COLNAME="C3" COLWIDTH="23*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"langid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Unique language ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dateformat COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(3) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Date order, for example, "dmy" COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datefirst COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"First day of the week-1 for Monday, 2 for 
Tuesday, and so on, up to 7 for Sunday. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"upgrade COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0" version of last upgrade for this 
language COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Official language name, for example, 
"french" COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"alias COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Alternate language name, for example, 
"francais" COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"months COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(251) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Comma-separated list of full-length month 
names, in order from January to 
December-each name is at most 20 
characters long COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"shortmonths COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(119) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Comma-separated list of shortened month 
names, in order from January to 
December-each name is at most 9 
characters long COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"days COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(216) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Comma-separated list of day names, in 
order from Monday to Sunday-each name 
is at most 30 characters long. IndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"langidunique nonclustered index on MOREINFO="NONE"nameunique nonclustered index on MOREINFO="NONE"aliasReferenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addlanguage, sp_addmessage, sp_checkreswords, sp_configure, sp_droplanguage, sp_dropmessage, sp_getmessage, sp_helplanguage, sp_setlangaliasID="IN75109"syslanguages table
 ID="IN73110"syslocks table
syslocks(master database only) DescriptionREMAP="BO--Body"ID="IN31111"Lockssystem tables entries for
ID="IN54112"Lockssyslocks table
syslocks contains information about active locks, but it is not a normal table. Rather, it is built dynamically when queried by a user. No updates to syslocks are allowed. MOREINFO="NONE"TOCENTRY="1"LBL="Table B-28:"Columns in the syslocks tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="26*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dbid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"page COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Page number COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Type of lock (bit values for the type column are 
listed in )COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"spid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of process that holds the lock COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"classCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of the cursor this lock is associated with, if 
anyREMAP="BO--Body"The bit representations for the type column are:MOREINFO="NONE"TOCENTRY="1"LBL="Table B-29:"type control bit in the syslocks table COLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DecimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Exclusive table lock COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Shared table lock COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x3COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Exclusive intent lock (will do page locking on 
indicated pages) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x4COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Shared intent lock COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x5COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Exclusive page lock COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x6COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Shared page lock COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x7COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Update page lock (changes to exclusive if page is 
actually modified) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"256COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x100COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Lock is blocking another process COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"512COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x200COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Demand lock IndexesREMAP="BO--Body"none Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_lockID="IN71113"syslocks table
 sysloginrolesID="IN59114"Userssysloginroles table
ID="IN64115"sysloginroles table
ID="IN59116"Rolessysloginroles table(master database only)DescriptionREMAP="BO--Body"sysloginroles contains a row for each instance of a server login possessing a system-defined role. One row is added for each role possessed by each login. For example, if a single server user is granted three roles, three rows are added to sysloginroles associated with that user's suid.TOCENTRY="1"LBL="Table B-30:"Columns in the sysloginroles tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="24*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suid COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server user IDCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"srid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server role ID; one of the following: 
0   MOREINFO="NONE"sa_role 
1   MOREINFO="NONE"sso_role 
2   MOREINFO="NONE"oper_role 
4   MOREINFO="NONE"navigator_role 
5   MOREINFO="NONE"replication_role 
6   MOREINFO="NONE"bcpin_labels_roleCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ReservedIndexesREMAP="BO--Body"Clustered index on suidReferenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_displaylogin, sp_droplogin, sp _locklogin, sp_role sysloginsID="IN74117"syslogins table(master database only) DescriptionREMAP="BO--Body"syslogins contains one row for each valid SQL Server user account. On the SQL Server distribution tape, sysloginsID="IN30121"Two Phase Commit Probe Process
contains an entry in which the name is "sa", the suid is 1, and the password is null. It also contains an entry named "probe" with an unpublished password. The login "probe" and the user "probe" exist for the Two Phase Commit Probe Process, which uses a challenge and response mechanism to access SQL Server. ID="IN31122"Probe Process, Two Phase CommitTOCENTRY="1"LBL="Table B-31:"Columns in the syslogins tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="11*"COLNAME="C3" COLWIDTH="21*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server user ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Status of the account. See Table B-32.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"accdate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Date totcpu and totio were last cleared COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"totcpu COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CPU time accumulated by login COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"totio COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"I/O accumulated by loginCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"spacelimit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"timelimit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"resultlimit COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dbname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of database in which to put user 
when connection established COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Login name of user COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"password COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinary COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Password of user (encrypted)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"language COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User's default language COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pwdate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Date the password was last changedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"audflags COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User's audit settingsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fullname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Full name of the userREMAP="Body"The bit representations for the status column are: TOCENTRY="1"LBL="Table B-32:"status control bits in the syslogins tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="5*"COLNAME="C3" COLWIDTH="28*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DecimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Password less than 6 characters, or NULLCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Account is lockedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x4COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Password is expiredIndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"suidunique nonclustered index on MOREINFO="NONE"name Referenced by System ProceduresID="IN68123"Loginssyslogins table
ID="IN72124"syslogins table
ID="IN67125"Userssyslogins table
ID="IN43126"Userssystem tables entries forREMAP="BO--Body"MOREINFO="NONE"sp_addalias, sp_addlogin, sp_addremotelogin, sp_adduser, sp_changedbowner, sp_checknames, sp_checkreswords, sp_clearstats, sp_displaylogin, sp_droplogin, sp_helpdb, sp_helpuser, sp_locklogin, sp_modifylogin, sp_reportstats, sp_rolesyslogsID="IN58127"syslogs table(all databases) DescriptionREMAP="BO--Body"syslogs contains the transaction log. It is used by SQL Server for recovery and roll forward, and is not useful to users. ID="INA75128"syslogs tableinfinite loop if changes toREMAP="BO--Body"You cannot delete from, insert into, or update syslogs. Every data modification operation is logged, so before you can change syslogs, the change must be logged. This means that a change operation on syslogs adds a row to syslogs, which then must be logged, adding another row to syslogsID="IN68129"Loopssyslogs changes and infinite
, and so on, producing an infinite loop. The loop continues until the database becomes full. TOCENTRY="1"LBL="Table B-33:"Columns in the syslogs tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"xactid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binary(6) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Transaction ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"op COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Update operation number IndexesREMAP="BO--Body"nonesysmessagesID="IN62130"sysmessages table(master database only) DescriptionREMAP="BO--Body"ID="IN60131"Messagessysmessages table
ID="IN40132"Error messagessystem tables entries for
sysmessages contains one row for each system error or warning that can be returned by SQL Server. SQL Server displays the error description on the user's screen.TOCENTRY="1"LBL="Table B-34:"Columns in the sysmessages tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"error COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Unique error number COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"severity COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Severity level of error COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dlevel COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved for number of descriptive level of this 
message: terse, short, or long COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"description COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(25) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Explanation of error with place holders for 
parameters COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"langid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Language, null for us_englishCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sqlstateCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(5)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SQLSTATE value for the errorIndexesREMAP="BO--Body"clustered index on MOREINFO="NONE"error, MOREINFO="NONE"dlevel unique nonclustered index onMOREINFO="NONE" error, dlevel, langid Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_configure, sp_dboption, sp_depends, sp_droplanguage, sp_getmessage, sp_help, sp_helpdb, sp_helpdevice, sp_helpremotelogin, sp_remoteoptionsysobjectsID="IN75133"sysobjects table(all databases) DescriptionREMAP="BO--Body"sysobjects contains one row for each table, view, stored procedure, log, rule, default, trigger, check constraint, referential constraint, and (in tempdb only) temporary object. ID="IN81134"Database objectssysobjects tableID="IN46135"Tablessystem tables entries forID="IN45136"Viewssystem tables entries forID="IN57137"Stored proceduressystem tables entries forID="IN56138"Transaction logssystem tables entries forID="IN45139"Rulessystem tables entries forID="IN48140"Defaultssystem tables entries forID="IN48141"Triggerssystem tables entries forID="IN57142"Check constraintssystem tables entries forID="IN51143"Constraintssystem tables entries forID="IN98144"Referential integrity constraintssysobjects tableID="IN89145"tempdb databasesystem tables entries andTOCENTRY="1"LBL="Table B-35:"Columns in the sysobjects tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysnameCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"uid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User ID of object owner COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(2) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One of the following object types:
 
S      system table
U      user table
V      view
L      log
P      procedure
R      rule
D      default
TR    trigger
RI    referential constraintCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"userstat COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Application-dependent type information (32768 
decimal [0x8000 hex] indicates to Data 
Workbenchname='trade' font='symbol' code='228'  charset='fontspecific' that a procedure is a report) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysstat COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Internal status information (256 decimal [0x100 
hex] indicates that table is read-only) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"indexdel COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Index delete count (incremented if an index is 
deleted) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"schemacnt COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Count of changes in schema of a given object 
(incremented if a rule or default is added) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysstat2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Additional internal status information. See Table 
B-36.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"crdate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Date object was created COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"expdate COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetime COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"deltrig COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure ID of a delete trigger COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"instrig COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure ID of an insert trigger COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"updtrig COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Stored procedure ID of an update trigger COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"seltrig COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ckfirst COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of first check constraint on the tableCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cache COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"audflags COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object's audit settingsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"objspareCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SpareREMAP="BO--Body"The bit representations for the sysstat2TOCENTRY="1"LBL="Table B-36:"systat2 control bits in the sysobjects table COLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="5*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DecimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusVALIGN="TOP"COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table has referential constraintCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table has foreign key constraintCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x4COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table has more than one check constraintCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x8COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table has primary key constraintCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x10COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Chained transaction mode only stored procedureCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"32COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x20COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Any transaction mode stored procedureCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"64COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x40COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Table has IDENTITY fieldIndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"idunique nonclustered index on MOREINFO="NONE"name, uid ID="IN73146"sysobjects table
Referenced by System ProceduresID="IN79147"Database objectssysobjects table
ID="IN44148"Tablessystem tables entries for
ID="IN43149"Viewssystem tables entries for
ID="IN55150"Stored proceduressystem tables entries for
ID="IN54151"Transaction logssystem tables entries for
ID="IN43152"Rulessystem tables entries for
ID="IN46153"Defaultssystem tables entries for
ID="IN46154"Triggerssystem tables entries for
ID="IN55155"Check constraintssystem tables entries for
ID="IN49156"Constraintssystem tables entries for
ID="IN96157"Referential integrity constraintssysobjects table
ID="IN87158"tempdb databasesystem tables entries andREMAP="BO--Body"MOREINFO="NONE"sp_addmessage, sp_addthreshold, sp_bindefault, sp_bindmsg, sp_bindrule, sp_checknames, sp_checkreswords, sp_column_privileges, sp_columns, sp_commonkey, sp_depends, sp_dropgroup, sp_dropkey, sp_dropsegment, sp_dropthreshold, sp_droptype, sp_dropuser, sp_estspace, sp_fkeys, sp_foreignkey, sp_help, sp_helpconstraint, sp_helpindex, sp_helpjoins, sp_helpkey, sp_helprotect, sp_helpthreshold, sp_indsuspect, sp_modifythreshold, sp_pkeys, sp_placeobject, sp_primarykey, sp_procxmode, sp_recompile, sp_remap, sp_rename, sp_spaceused, sp_sproc_columns, sp_statistics, sp_stored_procedures, sp_table_privileges, sp_tables, sp_unbindefault, sp_unbindmsg, sp_unbindrulesysproceduresID="IN64159"sysprocedures table(all databases) DescriptionREMAP="BO--Body"ID="IN31160"Viewssystem tables entries for
ID="IN34161"Defaultssystem tables entries for
ID="IN31162"Rulessystem tables entries for
ID="IN34163"Triggerssystem tables entries for
ID="IN43164"Stored proceduressystem tables entries for
ID="IN43165"Check constraintssystem tables entries for
ID="IN11166"Planobject
ID="IN21167"Sequence tree, object
sysprocedurescontains entries for each view, default, rule, trigger, procedure, declarative default, and check constraint. The plan or sequence tree for each object is stored in binary form. If the sequence tree doesn't fit in one entry, it is broken into more than one row. The MOREINFO="NONE"sequence column identifies the sub-rows.TOCENTRY="1"LBL="Table B-37:"Columns in the sysprocedures tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="6*"COLNAME="C3" COLWIDTH="28*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object type. See Table B-38.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object IDCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sequence COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sequence number if more than one row is used to 
describe this object COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Internal system statusCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"number COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sub-procedure number when the procedure is 
grouped (0 for non-procedure entries) REMAP="BO--Body"The bit representations for the type column are:TOCENTRY="1"LBL="Table B-38:"type control bits in the sysprocedures table COLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="5*"COLNAME="C3" COLWIDTH="28*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DecimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HexCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StatusVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry describes a plan (reserved) COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0x2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Entry describes a tree IndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"id, type, sequence, number Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_bindefault, sp_bindrule, sp_remap, sp_sproc_columns, sp_stored_procedures, sp_unbindefault, sp_unbindrule sysprocessesID="IN77168"sysprocesses table(master database only) DescriptionREMAP="BO--Body"ID="IN50169"Processes (Server tasks)system tables entries for
ID="IN77170"Processes (Server tasks)sysprocesses table
sysprocesses contains information about SQL Server processes, but it is not a normal table. Rather, it is built dynamically when queried by a user. No updates to sysprocesses are allowed. REMAP="BO--Body"Use the MOREINFO="NONE"kill statement to kill a process.TOCENTRY="1"LBL="Table B-39:"Columns in the sysprocesses tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="10*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="23*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"spid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Process ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"kpid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Kernel process ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"enginenum COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of engine on which process is being 
executed COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(12) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Process ID status, one of: 
infected
background
recv sleep
send sleep
alarm sleep
lock sleep
sleeping
runnable
running
stopped
bad status
log suspendCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suidCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server user ID of user who issued command COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"hostname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(10) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of host computer COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"program_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(16) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of front-end module COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"hostprocess COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(8) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Host process ID number COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cmd COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"char(16) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Command currently being executed COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"cpu COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Cumulative cpu time for process in ticks COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"physical_io COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of disk reads and writes for current 
commandCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"memusage COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Amount of memory allocated to process COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"blocked COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Process ID of blocking process, if any COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dbid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"uid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of user who executed command COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"gid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Group ID of user who executed commandCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tran_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(64)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of the active transactionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"time_blocked COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Time blocked in secondsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"network_pktsz COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Current connection's network packet sizeIndexesREMAP="BO--Body"none Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_dboption, sp_droplogin, sp_locklogin, sp_role, sp_whoID="IN75171"sysprocesses table
 sysprotectsID="IN76172"sysprotects table(all databases)DescriptionREMAP="BO--Body"ID="IN37173"Permissionssystem tables entries for
ID="IN63174"Permissionssysprotects table
sysprotectsID="IN100175"grant commandsysprotects table
 contains information on user permissions information-entries for each MOREINFO="NONE"grantID="IN101176"revoke commandsysprotects table
 and MOREINFO="NONE"revoke statement that has been issued. TOCENTRY="1"LBL="Table B-40:"Columns in the sysprotects tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="9*"COLNAME="C3" COLWIDTH="23*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"id COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of object to which this permission applies COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"uid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of user or group to which this permission 
applies COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"action COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One of the following permissions: 
MOREINFO="NONE"select = 193
MOREINFO="NONE"insert = 195
MOREINFO="NONE"delete = 196 
MOREINFO="NONE"update = 197 
MOREINFO="NONE"execute = 224 
MOREINFO="NONE"references = 151
MOREINFO="NONE"create database = 203
MOREINFO="NONE"create default = 233 
MOREINFO="NONE"create procedure = 222 
MOREINFO="NONE"create rule = 236 
MOREINFO="NONE"create table = 198 
MOREINFO="NONE"create view = 207 
MOREINFO="NONE"dump database = 228 
MOREINFO="NONE"dump transaction = 235 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"protecttype COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"One of the following values:
MOREINFO="NONE"grant with grant = 0
MOREINFO="NONE"grant (permanent) = 1
MOREINFO="NONE"revoke (permanent) = 2COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"columns COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinary(32) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bit map of columns to which this MOREINFO="NONE"select or 
update permission applies. Bit 0 indicates 
all columns; 1 means permission applies to 
that column; null means no information. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"grantor COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User ID of the grantorIndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"id, action, grantor, uid, protecttypeReferenced by System ProceduresREMAP="BO--Body"ID="IN74177"sysprotects table
MOREINFO="NONE"sp_changegroup, sp_dropgroup, sp_dropuser, sp_helprotect, sp_stored_procedures, sp_tablessysreferencesID="IN78178"sysreferences table(all databases) DescriptionREMAP="BO--Body"ID="IN65179"Constraintssysreferences table
sysreferencesID="IN87180"Referential integrity constraintssysreferences table
contains one row for each referential integrity constraint declared on a table or column.TOCENTRY="1"LBL="Table B-41:"Columns in the sysreferences tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="26*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"indexid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of the unique index on referenced columnsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"constrid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object ID of the constraint from sysobjectsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tableid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object ID of the referencing table COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"reftabid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Object ID of the referenced tableCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"keycnt COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The number of columns in the foreign keyCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ReservedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"frgndbidCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ReservedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pmrydbidCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ReservedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"spare2 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ReservedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"fokey1
.
.
.
fokey16 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint


tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID of the first referencing column



Column ID of the 16th referencing columnCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"refkey1
.
.
.
refkey16 COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint


tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Column ID of the first referenced column



Column ID of the 16th referenced columnCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"frgndbnameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of the database that includes the 
referencing table (the table with the foreign key). 
Null if the referencing table is in the current 
database.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pmrydbnameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of the database that includes the referenced 
table (the table with the primary key). Null if the 
referenced table is in the current database.IndexesREMAP="BO--Body"clustered index on frgndbid, tableidunique nonclustered index on frgndbid, constridnonclustered index on pmrydbid, reftableid, indexidReferenced by System ProceduresREMAP="BO--Body"ID="IN76181"sysreferences table
MOREINFO="NONE"sp_fkeys, sp_helpconstraint sysremoteloginsID="IN66182"sysremotelogins table(master database only) DescriptionID="IN39183"Remote loginssystem tables entries for
ID="IN69184"Remote loginssysremotelogins table
ID="IN62185"Loginssysremotelogins tableREMAP="BO--Body"sysremoteloginsID="IN82186"Remote procedure callssysremotelogins table and
contains one row for each remote user who is allowed to execute remote procedure calls on this SQL Server. TOCENTRY="1"LBL="Table B-42:"Columns in the sysremotelogins tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="11*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="21*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remoteserverid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Identifies the remote server COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"remoteusername COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User's login name on remote server COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Local server user ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bitmap of optionsIndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"remoteserverid, remoteusername Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addremotelogin, sp_checknames, sp_checkreswords, sp_dropremotelogin, sp_dropserver, sp_helpremotelogin, sp_remoteoption sysrolesID="IN59187"sysroles table(all databases)DescriptionREMAP="BO--Body"ID="IN54188"Rolessysroles table
sysrolesID="IN67189"IDs, server role (sysroles table)
maps server role IDs to local role IDs. TOCENTRY="1"LBL="Table B-43:"Columns in the sysroles tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="26*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"idCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server role ID (srid)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lridCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Local role IDCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"typeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UnusedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UnusedIndexesREMAP="BO--Body"Unique clustered index on lridReferenced by System ProceduresREMAP="BO--Body"NonesyssegmentsID="IN62190"syssegments table(all databases) Description REMAP="BO--Body"ID="IN60191"Segmentssyssegments table
syssegmentsID="IN34192"Segmentssystem tables entries for
contains one row for each segment (named collection of disk pieces). The default entries are: segment 0 (system) for system tables; segment 2 (logsegment) for the transaction log; and segment 1 (default) for other objects. Each database has an entry in sysusages contain these segments in its maps. TOCENTRY="1"LBL="Table B-44:"Columns in the syssegments tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"segment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Segment number COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Segment name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int null COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Indicates which segment is default segmentIndexesREMAP="BO--Body"none Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addsegment, sp_addthreshold, sp_checknames, sp_checkreswords, sp_dropsegment, sp_dropthreshold, sp_dropuser, sp_extendsegment, sp_helpdb, sp_helpindex, sp_helpsegment, sp_helpthreshold, sp_modifythreshold, sp_placeobject sysserversID="IN61193"sysservers table(master database only) DescriptionREMAP="BO--Body"sysservers
contains one row for each remote SQL Server, Backup Server, or Open Server on which this SQL Server can execute remote procedure calls. ID="IN40194"Remote serverssystem tables entries forID="IN65195"Remote serverssysservers tableID="IN77196"Remote procedure callssysservers table andTOCENTRY="1"LBL="Table B-45:"Columns in the sysservers tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="9*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="24*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"srvid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID number (for local use only) of the remote 
server COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"srvstatus COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bitmap of options COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"srvname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(30) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"srvnetname COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(32) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Interfaces file name for the server IndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"srvidunique nonclustered index on MOREINFO="NONE"srvname Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addremotelogin, sp_addserver, sp_checknames, sp_checkreswords, sp_configure, sp_dropremotelogin, sp_dropserver, sp_helpremotelogin, sp_helpserver, sp_remoteoption, sp_serveroption syssrvrolesID="IN62197"syssrvroles table(master database only)DescriptionREMAP="BO--Body"ID="IN57198"Rolessyssrvroles table
syssrvroles contains a row for each server-wide role.TOCENTRY="1"LBL="Table B-46:"Columns in the syssrvroles tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="26*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"srid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server role ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of the roleIndexesREMAP="BO--Body"Unique clustered index on sridReferenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_adduser, sp_changegroup, sp_displaylogin, sp_dropgroup, sp_helpgroup, sp_role systhresholdsID="IN64199"systhresholds table(all databases) DescriptionREMAP="BO--Body"ID="IN64200"Thresholdssysthresholds table
systhresholds contains one row for each threshold defined for the database. TOCENTRY="1"LBL="Table B-47: "Columns in the systhresholds tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="9*"COLNAME="C3" COLWIDTH="24*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"segment COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Segment number for which free space is 
being monitoredCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"free_space COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Size of threshold, in 2K pages (4K for 
Stratus)COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"status COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bit 1 equals 1 for the logsegment's last-
chance threshold, 0 for all other thresholdsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"proc_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Name of the procedure that is executed 
when the number of unused pages on 
segment falls below free_space.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suidCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The server user ID of the user who added 
the threshold or modified it most recentlyCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"currauthCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinary(255)COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A bit mask that indicates which roles were 
active for suid at the time the threshold was 
added or most recently modified. When the 
threshold is crossed, proc_name executes 
with this set of roles, less any that have been 
deactivated since the threshold was added 
or last modified.IndexesREMAP="BO--Body"Unique clustered index on segment, free_space Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addthreshold, sp_dropsegment, sp_dropthreshold, sp_dropuser, sp_helpthreshold, sp_modifythresholdsystypesID="IN73201"systypes table(all databases) DescriptionREMAP="BO--Body"ID="IN72202"Datatypessystypes table
ID="IN16203"Datatypessystem
systypes contains one row for each system-supplied and user-defined datatype. Domains (defined by rules) and defaults are given, if they exist. REMAP="BO--Body"The rows that describe system-supplied datatypes cannot be altered.TOCENTRY="1"LBL="Table B-48: "Columns in the systypes tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="27*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"uid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User ID of datatype creator COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"usertype COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User type ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"variable COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bit COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 if datatype is variable length; 0 otherwise COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"allownulls COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bit COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Indicates whether nulls are allowed for this 
datatype COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"type COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Physical storage datatype COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"length COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Physical length of datatype COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tdefault COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of system procedure that generates default for 
this datatype COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"domain COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ID of system procedure that contains integrity 
checks for this datatypeCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Datatype name COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"printfmt COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Reserved COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"prec COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of significant digitsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"scale COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of digits to the right of the decimal pointCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ident COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1 if column has the IDENTITY property, 0 if notCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"hierarchy COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyintCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Precedence of the datatype in mixed mode 
arithmeticID="IN60204"Datatypeslists ofREMAP="BO--Body"The listing that follows includes the system-supplied datatype MOREINFO="NONE"name, MOREINFO="NONE"hierarchy, type (not necessarily unique), and MOREINFO="NONE"usertype (unique). The datatypes are ordered by MOREINFO="NONE"hierarchy. In mixed mode arithmetic, the datatype with the lowest MOREINFO="NONE"hierarchy takes precedence:TOCENTRY="1"LBL="Table B-49: "Datatype names, hierarchy, types, and usertypesCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="3*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"COLNAME="C4" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"hierarchyCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"typeCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"usertypeVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"floatnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"109COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"floatCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"62COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetimnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"111COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"15COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"datetimeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"61COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"realCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"59COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"23COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numericnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"108COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"28COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"numericCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"63COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimalnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"106COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"27COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"decimalCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"9COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"55COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"26COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"moneynCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"110COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"17COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"moneyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"11COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"60COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"11COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallmoneyCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"122COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"21COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smalldatetimeCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"58COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"14COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"38COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"intCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"15COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"56COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallintCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"16COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"52COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"tinyintCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"17COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"48COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"bitCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"18COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"50COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varcharCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"19COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"39COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysnameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"19COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"39COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"18COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"nvarcharCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"19COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"39COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"25COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"charCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"20COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"47COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ncharCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"20COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"47COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"24COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varbinaryCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"21COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"37COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"timestampCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"21COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"37COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"80COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"binaryCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"45COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"textCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"23COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"35COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"19COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"imageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"24COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"34COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"20IndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"name unique nonclustered index on MOREINFO="NONE"usertype Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addtype, sp_bindefault, sp_bindrule, sp_checknames, sp_checkreswords, sp_columns, sp_datatype_info, sp_droptype, sp_dropuser, sp_help, sp_rename, sp_special_columns, sp_sproc_columns,sp_unbindefault, sp_unbindruleID="IN71205"systypes table
ID="IN70206"Datatypessystypes table
 sysusagesID="IN60207"sysusages table(master database only) DescriptionREMAP="BO--Body"sysusagesID="IN22211"Disk allocation pieces
ID="IN66212"Allocation unitssysusages table
contains one row for each disk allocation piece assigned to a database. Each database contains a specified number of database (logical) page numbers. Each disk piece includes the segments on the SQL Server distribution tape, segments 0 and 1. REMAP="BO--Body"The MOREINFO="NONE"create database command checks sysdevices and sysusages to find available disk allocation pieces. One or more contiguous disk allocation pieces is assigned to the database, and the mapping is recorded in sysusages. ID="IN57208"Mappingsysusages tableID="IN42209"Space allocationsystem tables entries forID="IN66210"Space allocationsysusages tableTOCENTRY="1"LBL="Table B-50: "Columns in the sysusages tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="8*"COLNAME="C2" COLWIDTH="7*"COLNAME="C3" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"dbid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Database ID COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"segmap COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bit map of possible segment assignmentsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"lstart COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"First database (logical) page number COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"size COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Number of contiguous database (logical) pages COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"vstart COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Starting virtual page number COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pad COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UnusedCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"unreservedpgs COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Free space not part of an allocated extentIndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"dbid, lstartunique nonclustered index on MOREINFO="NONE"vstart Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addsegment, sp_addthreshold, sp_databases, sp_dropdevice, sp_dropsegment, sp_extendsegment, sp_helpdb, sp_helplog, sp_helpsegment, sp_logdevice, sp_modifythreshold, sp_spaceused sysusermessagesID="IN66213"sysusermessages table(all databases) DescriptionREMAP="BO--Body"ID="IN75214"Messagessysusermessages table
sysusermessagesID="IN21215"Messagesuser-defined
contains one row for each user-defined message that can be returned by SQL Server. TOCENTRY="1"LBL="Table B-51: "Columns in the sysusermessages tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"error COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"int COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Unique error number. Must be 20000 or above. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"uid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User ID of the message creatorCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"description COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User-defined message with optional place 
holders for parameters COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"langid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Language ID for this message; null for 
us_englishIndexesREMAP="BO--Body"clustered index on MOREINFO="NONE"errorunique nonclustered index on MOREINFO="NONE"error, MOREINFO="NONE"langidReferenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addmessage, sp_bindmsg, sp_dropmessage, sp_getmessage, sp_helpconstraintsysusersID="IN73216"sysusers table(all databases) DescriptionREMAP="BO--Body"sysusersID="IN67219"Groupssysusers table entries for
contains one row for each user allowed in the database, and one row for each group or role. REMAP="BO--Body"On the SQL Server distribution tape, master..sysusers contains some initial users: "dbo," whose MOREINFO="NONE"suid is 1 and MOREINFO="NONE"uid is 1; "guest," whose MOREINFO="NONE"suid is -1 and MOREINFO="NONE"uid is 2; and "public," whose MOREINFO="NONE"suid is -2 and MOREINFO="NONE"uid is 0. In addition, each role (MOREINFO="NONE"sa_role, MOREINFO="NONE"sso_role, and so on) is listed in sysusers, because SQL Server treats roles much like groups.ID="IN26220"Guest accountsREMAP="BO--Body"The user guest provides a mechanism for giving users not explicitly listed in sysusers access to the database with a restricted set of permissions. The "guest" entry in master means that any user with an account on SQL Server (that is, with an entry in syslogins) can access master. ID="IN28221""public" grouppublic groupREMAP="BO--Body"The user "public" refers to all users. The keyword MOREINFO="NONE"public is used with the MOREINFO="NONE"grant and MOREINFO="NONE"revoke commands to signify that permission is being given to or taken away from all users. ID="IN54217"Userssysusers tableID="IN31218"Userssystem tables entries forTOCENTRY="1"LBL="Table B-52: "Columns in the sysusers tableCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="25*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ColumnCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DatatypeCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"suid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Server user ID, copied from syslogins. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"uid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User ID, unique in this database, used for 
granting and revoking permissions. User ID 1 is 
"dbo". COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"gid COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"smallint COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Group ID to which this user belongs. If uid = gid, 
this entry defines a group. The group "public" 
has suid = -2; all other groups have suid= - gid. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"sysname COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"User or group name, unique in this database COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"environ COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"varchar(255) COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ReservedIndexesREMAP="BO--Body"unique clustered index on MOREINFO="NONE"suidunique nonclustered index on MOREINFO="NONE"nameunique nonclustered index on MOREINFO="NONE"uid Referenced by System ProceduresREMAP="BO--Body"MOREINFO="NONE"sp_addalias, sp_addgroup, sp_adduser, sp_changedbowner, sp_changegroup, sp_checknames, sp_checkreswords, sp_column_privileges, sp_depends, sp_dropgroup, sp_droptype, sp_dropuser, sp_helpgroup, sp_helprotect, sp_helpuser, sp_indsuspect, sp_stored_procedures, sp_table_privileges, sp_tablesREMAP="BO--Body"ID="IN52222"System tablesdescriptions of individualID="IN71223"sysusers tableNUMBER="C" ID="X40724"The pubs2 DatabaseREMAP="BO--Body"This is the sample database pubs2. The names of the 11 tables are MOREINFO="NONE"publishers, authors, titles, titleauthor, sales, salesdetail, stores, discounts, roysched, au_pix, and MOREINFO="NONE"blurbs.REMAP="BO--Body"The header for each column lists its datatype (including the user-defined datatypes) and its null/not null status. Defaults, rules, triggers, and indexes are noted where they apply.RENDERAS="SECT1"Tables in the pubs2 DatabasePGWIDE=1 TOCENTRY="1"LBL="Table C-1: "Table of PublishersCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="6*"COLNAME="C4" COLWIDTH="5*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"publishersCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"pub_idchar(4)not nullpub_idruleaclust, uniqCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"pub_namevarchar(40)nullCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"cityvarchar(20)nullCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"statechar(2)nullVALIGN="TOP"COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0736 0877 1389 COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"New Age Books  Binnet & Hardley Algodata InfosystemsCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Boston Washington BerkeleyCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MA DC CA ID="IPTF0A" VALIGN="TOP"aThe pub_id rule states that the data must be 1389, 0736, 0877, 1622, or 1756, or must match the pattern 99[0-9][0-9].PGWIDE=1 TOCENTRY="1"LBL="Table C-2: "Table of AuthorsCOLS="9" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="4*"COLNAME="C2" COLWIDTH="6*"COLNAME="C3" COLWIDTH="3*"COLNAME="C4" COLWIDTH="6*"COLNAME="C5" COLWIDTH="4*"COLNAME="C6" COLWIDTH="3*"COLNAME="C7" COLWIDTH="2*"COLNAME="C8" COLWIDTH="3*"COLNAME="C9" COLWIDTH="3*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C9" ALIGN="CENTER" ROTATE="0" MOREROWS="0"authorsCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"au_ididnot nullCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"au_lnamevarchar(40)not nullCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"au_fnamevarchar(20)not nullCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"phonechar(12)not nullUNKNOWNaCOLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"addressvarchar(12)nullCOLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"cityvarchar(20)nullCOLNAME="C7" ALIGN="CENTER" ROTATE="0" MOREROWS="0"statechar(2)nullCOLNAME="C8" ALIGN="CENTER" ROTATE="0" MOREROWS="0"countryvarchar(2)nullCOLNAME="C9" ALIGN="CENTER" ROTATE="0" MOREROWS="0"postalcodechar(10)nullCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"clust, uniqCOLNAME="C2" NAMEST="C2" NAMEEND="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"nonclustCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"172-32-1176COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"WhiteCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"JohnsonCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"408 496-7223COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10932 Bigge Rd.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Menlo ParkCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94025COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"213-46-8915COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"GreenCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MarjorieCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 986-7020COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"309 63rd St. 
#411COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OaklandCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94618COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"238-95-7766COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CarsonCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CherylCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 548-7723COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"589 Darwin 
Ln.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BerkeleyCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94705COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"267-41-2394COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"O'LearyCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MichaelCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"408 286-2428COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22 Cleveland 
Av. #14COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"San JoseCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"95128COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"274-80-9391COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StraightCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DickCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 834-2919COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5420 College 
Av.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OaklandCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94609COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"341-22-1782COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SmithCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MeanderCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"913 843-0462COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10 Mississippi 
Dr.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"LawrenceCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"KSCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"66044COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"409-56-7008COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BennetCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AbrahamCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 658-9932COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6223 Bateman 
St.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BerkeleyCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94705COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"427-17-2319COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DullCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AnnCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 836-7128COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3410 Blonde St.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Palo AltoCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94301COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"472-27-2349COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"GringlesbyCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BurtCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"707 938-6445COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PO Box 792COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CoveloCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"95428COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"486-29-1786COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"LocksleyCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ChastityCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 585-4620COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"18 Broadway 
Av.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"San FranciscoCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94130COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"527-72-3246COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"GreeneCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Morningst
arCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"615 297-2723COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22 Graybar 
House Rd.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NashvilleCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TNCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"37215COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"648-92-1872COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Blotchet-
HallsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ReginaldCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"503 745-6402COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"55 Hillsdale Bl.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CorvallisCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ORCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"97330COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"672-71-3249COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"YokomotoCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AkikoCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 935-4228COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3 Silver Ct.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Walnut CreekCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94595COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"712-45-1867COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"del 
CastilloCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"InnesCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"615 996-8275COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2286 Cram Pl. 
#86COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Ann ArborCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MICOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"48105COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"722-51-5454COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DeFranceCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MichelCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"219 547-9982COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3 Balding Pl.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"GaryCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"INCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"46403COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"724-08-9931COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StringerCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DirkCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 843-2991COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5420 
Telegraph Av.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OaklandCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94609COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"724-80-9391COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MacFeathe
rCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"StearnsCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 354-7128COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"44 Upland Hts.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OaklandCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94612COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"756-30-7391COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"KarsenCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"LiviaCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 534-9219COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5720 McAuley 
St.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"OaklandCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94609COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"807-91-6654COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PanteleyCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SylviaCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"301 946-8853COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1956 
Arlington Pl.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RockvilleCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MDCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"20853COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"846-92-7186COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HunterCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SherylCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"415 836-7128COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3410 Blonde St.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Palo AltoCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"94301COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"893-72-1158COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"McBaddenCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"HeatherCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"707 448-4982COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"301 PutnamCOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"VacavilleCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"95688COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"899-46-2035COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RingerCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AnneCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"801 826-0752COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"67 Seventh Av.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Salt Lake 
CityCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UTCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"84152COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"998-72-3567COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"RingerCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AlbertCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"801 826-0752COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"67 Seventh Av.COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Salt Lake 
CityCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UTCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"84152ID="IPTF1A" VALIGN="TOP"aThe default UNKNOWN is inserted if no data is entered.PGWIDE=1 TOCENTRY="1"LBL="Table C-3: "Table of TitlesCOLS="10" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="6*"COLNAME="C3" COLWIDTH="6*"COLNAME="C4" COLWIDTH="4*"COLNAME="C5" COLWIDTH="4*"COLNAME="C6" COLWIDTH="5*"COLNAME="C7" COLWIDTH="4*"COLNAME="C8" COLWIDTH="9*"COLNAME="C9" COLWIDTH="6*"COLNAME="C10" COLWIDTH="4*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C10" ALIGN="CENTER" ROTATE="0" MOREROWS="0"titlesCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"title_idtidnot null deltitle3clust, uniqCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"titlevarchar(80)not null nonclustCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"typechar(12)not nullUNDECIDED1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"pub_idchar(4)nullCOLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"pricemoneynullCOLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"advancemoneynullCOLNAME="C7" ALIGN="CENTER" ROTATE="0" MOREROWS="0"total_salesintnullCOLNAME="C8" ALIGN="CENTER" ROTATE="0" MOREROWS="0"notesvarchar(200)nullCOLNAME="C9" ALIGN="CENTER" ROTATE="0" MOREROWS="0"pubdatedatetimenot nullgetdate()2COLNAME="C10" ALIGN="CENTER" ROTATE="0" MOREROWS="0"contractbitnot nullVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BU1032COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The Busy 
Executive's
 Database 
GuideCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"business COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1389COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"19.99COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4095COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"An overview of 
available 
database 
systems with 
emphasis on 
common 
business 
applications. 
Illustrated.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 6, 
1986COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BU1111COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Cooking 
with 
Computers
: 
Surreptitio
us Balance 
SheetsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"business COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1389COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"11.95COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3876COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Helpful hints on 
how to use your 
electronic 
resources to the 
best advantage.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 9, 
1988 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BU2075COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"You Can 
Combat 
Computer 
Stress!COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"business COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0736COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2.99COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10125.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"18722COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The latest 
medical and 
psychological 
techniques for 
living with the 
electronic office. 
Easy-to-
understand 
explanations.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 30, 
1985 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BU7832COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Straight 
Talk 
About 
ComputersCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"business COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1389COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"19.99COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4095COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Annotated 
analysis of what 
computers can 
do for you: a no-
hype guide for 
the critical user.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 22, 
1987 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MC2222COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Silicon 
Valley 
Gastronom
ic TreatsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mod_cook COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0877COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"19.99COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2032COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Favorite recipes 
for quick, easy, 
and elegant 
meals, tried and 
tested by people 
who never have 
time to eat, let 
alone cook.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 9, 
1989 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MC3021COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The 
Gourmet 
MicrowaveCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"mod_cook COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0877COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2.99COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"15000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22246COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Traditional 
French gourmet 
recipes adapted 
for modern 
microwave 
cooking.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 18, 
1985 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PC1035COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"But Is It 
User 
Friendly?COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"popular_compCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1389COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22.95COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8780COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A survey of 
software for the 
naive user, 
focusing on the 
`friendliness' of 
each.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 30, 
1986 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MC3026COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"The 
Psycholog
y of 
Computer 
CookingCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"UNDECIDED COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0877COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jul 24, 
1991 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PC8888COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Secrets of 
Silicon 
ValleyCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"popular_compCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1389COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"20.00COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4095COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Muckraking 
reporting by two 
courageous 
women on the 
world's largest 
computer 
hardware and 
software 
manufacturers.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 12, 
1987 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PC9999COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Net 
EtiquetteCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"popular_compCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1389COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NULLCOLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A must-read for 
computer 
conferencing 
debutantes!COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jul 24, 
1991 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PS1372COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Computer 
Phobic 
and Non-
Phobic 
Individual
s: 
Behavior 
VariationsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"psychology COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0877COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"21.59COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"375COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A must for the 
specialist, this 
book examines 
the difference 
between those 
who hate and 
fear computers 
and those who 
think they are 
swell.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Oct 
21,1990 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PS2091COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Is Anger 
the 
Enemy?COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"psychology COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0736COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10.95COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2275.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2045COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Carefully 
researched study 
of the effects of 
strong emotions 
on the body. 
Metabolic charts 
included.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 15, 
1989 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PS2106COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Life 
Without 
FearCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"psychology COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0736COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7.00COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"111COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"New exercise, 
meditation, and 
nutritional 
techniques that 
can reduce the 
shock of daily 
interactions. 
Popular 
audience. Sample 
menus included, 
exercise video 
available 
separately.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Oct 5, 
1990 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PS3333COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Prolonged 
Data 
Deprivatio
n: Four 
Case 
StudiesCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"psychology COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0736COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"19.99COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"2000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4072COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"What happens 
when the data 
runs dry? 
Searching 
evaluations of 
information-
shortage effects 
on heavy users.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 12, 
1988 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PS7777COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Emotional 
Security: 
A New 
AlgorithmCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"psychology COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0736COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7.99COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"3336COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Protecting 
yourself and 
your loved ones 
from undue 
emotional stress 
in the modern 
world. Use of 
computer and 
nutritional aids 
emphasized.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 12, 
1988 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TC3218COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Onions, 
Leeks, and 
Garlic: 
Cooking 
Secrets of 
the 
Mediterran
eanCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"trad_cook COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0877COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"20.95COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"375COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Profusely 
illustrated in 
color, this makes 
a wonderful gift 
book for a 
cuisine-oriented 
friend.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Oct 21, 
1990 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TC4203COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fifty Years 
in 
Buckingha
m Palace 
KitchensCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"trad_cook COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0877COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"11.95COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"15096COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"More anecdotes 
from the 
Queen's favorite 
cook describing 
life among 
English royalty. 
Recipes, 
techniques, 
tender vignettes.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 12, 
1985 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TC7777COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sushi, 
Anyone?COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"trad_cook COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"0877COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"14.99COLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8000.00COLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"4095COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Detailed 
instructions on 
improving your 
position in life by 
learning how to 
make authentic 
Japanese sushi in 
your spare time. 
5-10% increase 
in number of 
friends per recipe 
reported from 
beta test.COLNAME="C9" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 12, 
1987 COLNAME="C10" ALIGN="LEFT" ROTATE="0" MOREROWS="0"1VALIGN="TOP"1. The default UNDECIDED is inserted if no data is entered in the column.2. The getdate function inserts the current date as the default if no data is entered in the column.3. The deltitle trigger prohibits deleting a title is the title_id is listed in the sales table.PGWIDE=1 TOCENTRY="1"LBL="Table C-4: "Table of titleauthorCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"COLNAME="C4" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"titleauthorCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"au_ididnot nullnonclustCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"title_idtidnot nullnonclustCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"au_ordtinyintnullCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"royaltyperintnullCOLNAME="C1" NAMEST="C1" NAMEEND="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"uniq, clust, compositeCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"VALIGN="TOP"COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"172-32-1176COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"213-46-8915COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"213-46-8915COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"238-95-7766COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"267-41-2394COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"267-41-2394COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"30COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"274-80-9391COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"409-56-7008COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"60COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"427-17-2319COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"472-27-2349COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"30COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"486-29-1786COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC9999COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"486-29-1786COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"648-92-1872COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"672-71-3249COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"712-45-1867COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC2222COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"722-51-5454COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"75COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"724-80-9391COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"60COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"724-80-9391COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS1372COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"25COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"756-30-7391COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS1372COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"75COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"807-91-6654COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"846-92-7186COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"899-46-2035COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"25COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"899-46-2035COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2091COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"998-72-3567COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2091COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"998-72-3567COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2106COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100PGWIDE=1 TOCENTRY="1"LBL="Table C-5: "Table of au_pixCOLS="6" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"COLNAME="C4" COLWIDTH="1*"COLNAME="C5" COLWIDTH="1*"COLNAME="C6" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"au_pixCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"au_ididnot nullCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"picimagenullCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"format_typechar(11)nullCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"bytesizeintnullCOLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"pixwidth_horchar(14)nullCOLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"pixwidth_vertchar(14)nullVALIGN="TOP"COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"409-56-7008COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0x0000...COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PICTCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"30220COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"626COLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"635COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"486-29-1786COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0x59a6...COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"SunrasterCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"27931COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"647COLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"640COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"648-92-1872COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0x59a6...COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"SunrasterCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"36974COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"647COLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"640COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"672-71-3249COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0x000a...COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PICTCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"13487COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"654COLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"639COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"899-46-2035COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0x4949...COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TIFCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"52023COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"648COLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"641COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"998-72-3567COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0x4949...COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TIFCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"52336COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"653COLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"637REMAP="BO--Body"The MOREINFO="NONE"pic column contains binary data, which is not reproduced in this table in its entirety. The pictures represented by this data are shown on the next page. Since the image data (six pictures, two each in PICT, TIF, and Sun raster file formats) is quite large, you should run the MOREINFO="NONE"installpix2  script only  if you want to use or test the image datatype. The image data is supplied to show how SYBASE stores image data. Sybase does not supply any tools for displaying image data: you must use the appropriate screen graphics tools in order to display the images once you have extracted them from the database. FLOAT="0"FORMAT="UNKNOWN" FILEREF="figb_1.xwd"LBL="Figure C-1: "Authors' Portraits from the au_pix TablePGWIDE=1 TOCENTRY="1"LBL="Table C-6: "Table of SalesdetailCOLS="5" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"COLNAME="C4" COLWIDTH="1*"COLNAME="C5" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"salesdetailCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"stor_idchar(4)not nullCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"ord_numvarchar(20)not nullCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"title_idtidnot nulltitle_idruleCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"qtysmallintnot nullCOLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"discountfloatnot nullCOLNAME="C1" NAMEST="C1" NAMEEND="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"nonclustCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"nonclustCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"VALIGN="TOP"COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"75COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"75COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Asoap432COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Asoap432COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"80COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"XS-135-DER-432-8J2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"85COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"91-A-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"90COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"45.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"91-A-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"45.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"91-A-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2106COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"30COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"45.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"91-V-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2106COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"45.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"55-V-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2106COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"31COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"45.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"91-A-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"69COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"45.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BS-345-DSE-860-1F2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AX-532-FED-452-2Z7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AX-532-FED-452-2Z7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AX-532-FED-452-2Z7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"150COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AX-532-FED-452-2Z7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"125COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"750COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fsoap867COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA52498COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA71224COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA71224COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"300COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA71224COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"350COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZD-123-DFG-752-9G8COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2091COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-3.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2091COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-3.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"250COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-3.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"345COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-3.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"360COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"XS-135-DER-432-8J2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2091COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"845COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"XS-135-DER-432-8J2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"581COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZZ-999-ZZZ-999-0A0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS1372COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"375COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-3.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"175COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"XS-135-DER-432-8J2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"885COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZD-123-DFG-752-9G8COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"900COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AX-532-FED-452-2Z7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"550COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fsoap867COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"350COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"275COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA71224COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-3.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"512COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fsoap867COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"400COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AX-532-FED-452-2Z7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"105COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"300COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA71224COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"350COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-3.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"335COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Asoap432COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"340COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AX-532-FED-452-2Z7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"370COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZD-123-DFG-752-9G8COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"750COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13-J-9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"300COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"51.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13-E-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"150COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"51.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13-E-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"300COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"51.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13-E-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"400COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"51.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"91-A-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"180COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"51.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13-J-9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"250COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"51.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13-E-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"226COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"51.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13-E-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"400COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"51.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"91-V-7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"390COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"51.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AB-872-DEF-732-2Z1COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"GH-542-NAD-713-9F9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZA-000-ASD-324-4D1COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZA-000-ASD-324-4D1COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZD-123-DFG-752-9G8COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZD-123-DFG-752-9G8COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZS-645-CAT-415-1B2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZS-645-CAT-415-1B2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"XS-135-DER-432-8J2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2687COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"XS-135-DER-432-8J2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1090COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"XS-135-DER-432-8J2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2138COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZZ-999-ZZZ-999-0A0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC2222COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2032COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZZ-999-ZZZ-999-0A0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1001COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZA-000-ASD-324-4D1COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1100COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1400COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BS-345-DSE-860-1F2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2700COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"GH-542-NAD-713-9F9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BS-345-DSE-860-1F2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AX-532-FED-452-2Z7COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1600COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2550COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZA-000-ASD-324-4D1COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZS-645-CAT-415-1B2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BS-345-DSE-860-1F2COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"GH-542-NAD-713-9F9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZZ-999-ZZZ-999-0A0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1005COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.000000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"124152COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"42COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.500000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"124152COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"25COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.500000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Asoap132COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"35COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.500000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-1.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"34COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.500000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-1.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"53COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50.500000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12-F-9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"30COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"55.500000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12-F-9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"94COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"55.500000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA27618COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"124152COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"350COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA27618COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"230COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA27618COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Asoap132COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"137COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-1.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"270COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-1.142 COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"230COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Asoap132COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"345COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-1.142COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"136COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12-F-9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"300COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"62.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12-F-9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"270COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"62.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12-F-9COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"133COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"62.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AB-123-DEF-425-1Z3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"60.500000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AB-123-DEF-425-1Z3COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4000COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"60.500000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"342157COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"342157COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"250COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"57.200000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"356921COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"200COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"356921COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"500COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"356921COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"125COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"135COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"320COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"300COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"400COLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"46.700000PGWIDE=1 TOCENTRY="1"LBL="Table C-7: "Table of SalesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"salesCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"stor_idchar(4)not nullCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"ord_numvarchar(20)not nullCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"datedatetimenot nullCOLNAME="C1" NAMEST="C1" NAMEEND="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"clust, uniqCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"VALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AB-123-DEF-425-1Z3COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Oct 31 1985 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AB-872-DEF-732-2Z1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Nov 6 1985 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"AX-532-FED-452-2Z7COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dec 1 1990 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BS-345-DSE-860-1F2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dec 12 1986 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"GH-542-NAD-713-9F9COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mar 15 1987 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NF-123-ADS-642-9G3COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jul 18 1987 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"XS-135-DER-432-8J2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mar 21 1991 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZA-000-ASD-324-4D1COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jul 27 1988 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZD-123-DFG-752-9G8COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mar 21 1991 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZS-645-CAT-415-1B2COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mar 21 1991 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ZZ-999-ZZZ-999-0A0COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mar 21 1991 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sep 30 1987 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"342157COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dec 13 1985 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"356921COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Feb 17 1991 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA27618COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Oct 12 1985 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA52498COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Oct 27 1987 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BA71224COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Aug 5 1988 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-1.142COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jan 2 1987 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"NB-3.142COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jun 13 1990 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Asoap132COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Nov 16 1986 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Asoap432COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Dec 20 1990 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fsoap867COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Sep 8 1987 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"124152COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Aug 14 1986 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"234518COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Feb 14 1991 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"12-F-9COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jul 13 1986 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13-E-7COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"May 23 1989 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"13-J-9COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Jan 13 1988 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"55-V-7COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mar 20 1991 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"91-A-7COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mar 20 1991 COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"91-V-7COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Mar 20 1991 PGWIDE=1 TOCENTRY="1"LBL="Table C-8: "Table of StoresCOLS="8" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="9*"COLNAME="C3" COLWIDTH="10*"COLNAME="C4" COLWIDTH="6*"COLNAME="C5" COLWIDTH="4*"COLNAME="C6" COLWIDTH="6*"COLNAME="C7" COLWIDTH="6*"COLNAME="C8" COLWIDTH="6*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C8" ALIGN="CENTER" ROTATE="0" MOREROWS="0"storesCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"stor_idchar(4)not nullCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"stor_namevarchar(40)nullCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"stor_addressvarchar(40)nullCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"cityvarchar(20)nullCOLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"statechar(2)nullCOLNAME="C6" ALIGN="CENTER" ROTATE="0" MOREROWS="0"countryvarchar(12)nullCOLNAME="C7" ALIGN="CENTER" ROTATE="0" MOREROWS="0"postalcodechar(10)nullCOLNAME="C8" ALIGN="CENTER" ROTATE="0" MOREROWS="0"paytermsvarchar(12)nullVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7066COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Barnum'sCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"567 Pasadena 
Ave.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TustinCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"92789COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Net 30COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7067COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"News & BrewsCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"577 First St.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Los 
GatosCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"96745COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Net 30COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7131COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Doc-U-Mat: 
Quality 
Laundry and 
BooksCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"24-A Avrogado 
WayCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Remulad
eCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"WACOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"98014COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Net 60COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"8042COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"BookbeatCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"679 Carson St.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"PortlandCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ORCOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"89076COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Net 30COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"6380COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Eric the Read 
BooksCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"788 Catamaugus 
Ave.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"SeattleCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"WACOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"98056COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Net 60COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"7896COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Fricative 
BookshopCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"89 Madison St.COLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"FremontCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"CACOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"90019COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Net 60COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"5023COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Thoreau 
Reading 
Discount ChainCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"20435 Walden 
ExpresswayCOLNAME="C4" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ConcordCOLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MACOLNAME="C6" ALIGN="LEFT" ROTATE="0" MOREROWS="0"USACOLNAME="C7" ALIGN="LEFT" ROTATE="0" MOREROWS="0"01776COLNAME="C8" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Net 60PGWIDE=1 TOCENTRY="1"LBL="Table C-9: "Table of DiscountsCOLS="5" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="6*"COLNAME="C2" COLWIDTH="5*"COLNAME="C3" COLWIDTH="5*"COLNAME="C4" COLWIDTH="5*"COLNAME="C5" COLWIDTH="6*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"discountsCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"discounttypevarchar(40)not nullCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"stor_idchar(4)nullCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"lowqtysmallintnullCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"highqtysmallintnullCOLNAME="C5" ALIGN="CENTER" ROTATE="0" MOREROWS="0"discountfloatnot nullVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Initial CustomerVolume DiscountHuge Volume DiscountCustomer DiscountCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"  8042COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"100 1001COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1000COLNAME="C5" ALIGN="LEFT" ROTATE="0" MOREROWS="0"10.56.7105PGWIDE=1 TOCENTRY="1"LBL="Table C-10: "Table of royshedCOLS="4" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="1*"COLNAME="C3" COLWIDTH="1*"COLNAME="C4" COLWIDTH="1*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"royschedCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"title_idtidnot nullnonclustCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"lorangeintnullCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"hirangeintnullCOLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"royaltyintnullVALIGN="TOP"COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1032COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC1035COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"18COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"3001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"7001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"18COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"22COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU2075COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"24COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2091COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2091COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2091COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2091COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2106COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2106COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2106COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS2106COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"1001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"18COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"22COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC3021COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"24COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"6001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"18COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"22COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC3218COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"24COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"15000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PC8888COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"15001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS7777COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"15000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS3333COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"15001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"18COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"24000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"24001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"28000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"22COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU1111COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"28001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"24COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC2222COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC2222COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC2222COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"4001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC2222COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC2222COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC2222COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"18COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"MC2222COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"15000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC7777COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"15001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"2001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"8001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"24000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"24001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"32000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"18COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"32001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TC4203COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"22COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"5001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"15000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"15001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"25000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"18COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"25001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"30000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"30001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"35000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"22COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"BU7832COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"35001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"24COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS1372COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"0COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS1372COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"10001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"12COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS1372COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"20001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"30000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"14COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS1372COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"30001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"16COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"PS1372COLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"40001COLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"50000COLNAME="C4" ALIGN="CENTER" ROTATE="0" MOREROWS="0"18PGWIDE=1 TOCENTRY="1"LBL="Table C-11: "Table of BlurbsCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="5*"COLNAME="C2" COLWIDTH="47*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"blurbsCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"COLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"au_id
id
not 
nullCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"copy
textnullVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"486-
29-
1786COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"If Chastity Locksley didn't exist, this troubled world would have created her! Not only did 
she master the mystic secrets of inner strength to conquer adversity when she encountered it 
in life, but, after "reinventing herself", as she says, by writing "Emotional Security: A New 
Algorithm" following the devastating loss of her cat Old Algorithm, she also founded Publish 
or Perish, the page-by-page, day-by-day, write-yourself-to-wellness encounter workshops 
franchise empire, the better to share her inspiring discoveries with us all. Her "Net Etiquette," 
a brilliant social treatise in its own right and a fabulous pun, is the only civilized alternative to 
the gross etiquette often practiced on the public networks.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"648-
92-
1872COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"A chef's chef and a raconteur's raconteur, Reginald Blotchet-Halls calls London his second 
home. "Th' palace kitchen's me first `ome, act'lly!" Blotchet-Halls' astounding ability to 
delight our palates with palace delights is matched only by his equal skill in satisfying our 
perpetual hunger for delicious back-stairs gossip by serving up tidbits and entrees literally fit 
for a king!COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"998-
72-
3567COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Albert Ringer was born in a trunk to circus parents, but another kind of circus trunk played a 
more important role in his life years later. He grew up as an itinerant wrestler and roustabout 
in the reknowned Ringer Brothers and Betty and Bernie's Circus. Once known in the literary 
world only as Anne Ringer's wrestling brother, he became a writer while recuperating from a 
near-fatal injury received during a charity benefit bout with a gorilla. "Slingshotting" himself 
from the ring ropes, Albert flew over the gorilla's head and would have landed head first on 
the concrete. He was saved from certain death by Nana, an elephant he had befriended as a 
child, who caught him in her trunk. Nana held him so tightly that three ribs cracked and he 
turned blue from lack of oxygen. "I was delirious. I had an out-of-body experience! My whole 
life passed before me eyes. I promised myself `If I get through this, I'll use my remaining time 
to share what I learned out there.' I owe it all to Nana!"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"899-
46-
2035COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Anne Ringer ran away from the circus as a child. A university creative writing professor and 
her family took Anne in and raised her as one of their own. In this warm and television-less 
setting she learned to appreciate the great classics of literature. The stream of aspiring and 
accomplished writers that flowed constantly through the house confirmed her repudiation of 
the circus family she'd been born into: "Barbarians!" The steadily growing recognition of her 
literary work was, to her, vindication. When her brother's brush with death brought them 
together after many years, she took advantage of life's crazy chance thing and broke the wall 
of anger that she had constructed to separate them. Together they wrote, "Is Anger the 
Enemy?" an even greater blockbuster than her other collaborative work, with Michel 
DeFrance, "The Gourmet Microwave."COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"672-
71-
3249COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"They asked me to write about myself and my book, so here goes: I started a restaurant called 
"de Gustibus" with two of my friends. We named it that because you really can't discuss taste. 
We're very popular with young business types because we're young business types ourselves. 
Whenever we tried to go out to eat in a group we always got into these long tiresome 
negotiations: "I just ate Italian," or "I ate Greek yesterday," or ``I NEVER eat anything that's 
not organic!" Inefficient. Not what business needs today. So, it came to us that we needed a 
restaurant we could all go to every day and not eat the same thing twice in a row maybe for a 
year! We thought, "Hey, why make people choose one kind of restaurant over another, when 
what they really want is a different kind of food?" At de Gustibus you can eat Italian, Chinese, 
Japanese, Greek, Russian, Tasmanian, Iranian, and on and on all at the same time. You never 
have to choose. You can even mix and match! We just pooled our recipes, opened the doors, 
and never looked back. We're a big hit, what can I say? My recipes in "Sushi, Anyone?" are 
used at de Gustibus. They satisfy crowds for us every day. They will work for you, too. 
Period!COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"409-
56-
7008COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Bennet was the classic too-busy executive. After discovering computer databases he now has 
the time to run several successful businesses and sit on three major corporate boards. Bennet 
also donates time to community service organizations. Miraculously, he also finds time to 
write and market executive-oriented in-depth computer hardware and software reviews. "I'm 
hyperkinetic, so being dynamic and fast-moving is a piece of cake. But being organized isn't 
easy for me or for anyone I know. There's just one word for that: `databases!' Databases can 
cure you or kill you. If you get the right one, you can be like me. If you get the wrong one, 
watch out. Read my book!" RENDERAS="SECT1"Primary and Foreign Keys in pubs2  TOCENTRY="1"LBL="Table C-12: "Table of Primary KeysCOLS="2" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="1*"COLNAME="C2" COLWIDTH="2*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Primary KeysCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"TableCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Primary KeyVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"titlesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"title_idCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"titleauthorCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"au_id + title_idCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"authorsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"au_idCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"publishersCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pub_idCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"royschedCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"title_idCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"salesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"stor_id + ord_num COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"salesdetailCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"stor_id + ord_numCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"storesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"stor_idCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"discountsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"discounttype + stor_idCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"au_pixCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"au_idCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"blurbsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"au_idTOCENTRY="1"LBL="Table C-13: "Table of Foreign KeysCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="7*"COLNAME="C2" COLWIDTH="8*"COLNAME="C3" COLWIDTH="10*"VALIGN="BOTTOM"COLNAME="C1" NAMEST="C1" NAMEEND="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Foreign KeysCOLNAME="C1" ALIGN="CENTER" ROTATE="0" MOREROWS="0"TableCOLNAME="C2" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Foreign KeyCOLNAME="C3" ALIGN="CENTER" ROTATE="0" MOREROWS="0"Primary Key TableVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"titleauthorCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"title_idau_idCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"titlesauthorsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"royschedCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"title_idCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"titlesCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"salesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"title_idstor_idCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"titlesstoresCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"salesdetai
lCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"title_idstor_id, 
ord_numCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"titlessalesCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"titlesCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"pub_idCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"publishersCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"discountsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"stor_idCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"storesCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"au_pixCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"au_idCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"authorsCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"blurbsCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"au_idCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"authorsRENDERAS="SECT1"Other Objects in pubs2RENDERAS="SECT2"Rules  REMAP="BO--Body"pub_idruleREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"create rule pub_idruleas @pub_id in ("1389", "0736", "0877", "1622", "1756")or @pub_id like "99[0-9][0-9]"REMAP="BO--Body"title_idruleREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"create rule title_idruleas@title_id like "BU[0-9][0-9][0-9][0-9]" or@title_id like "[MT]C[0-9][0-9][0-9][0-9]" or@title_id like "P[SC][0-9][0-9][0-9][0-9]" or@title_id like "[A-Z][A-Z]xxxx" or@title_id like "[A-Z][A-Z]yyyy"/*valid values: BU, MC, TC, PS, PC + 4 digits or**any two uppercase letters followed by x's or y's*/RENDERAS="SECT2"DefaultsREMAP="BO--Body"typedfltREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"create default typedflt as "UNDECIDED"REMAP="BO--Body"datedfltREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"create default datedflt as getdate()REMAP="BO--Body"phonedfltREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"create default phonedflt as "UNKNOWN"RENDERAS="SECT2"ViewREMAP="CO--ComputerOutput" FORMAT="LINESPECIFIC"create view titleviewasselect title, au_ord, au_lname,price, total_sales, pub_idfrom authors, titles, titleauthorwhere authors.au_id = titleauthor.au_idand titles.title_id = titleauthor.title_idRENDERAS="SECT1"Diagram of the pubs2 DatabaseFLOAT="0"FORMAT="UNKNOWN" FILEREF="figb_2.xwd"LBL="Figure C-2: "Diagram of the pubs2 DatabaseNUMBER="D" ID="X65962"SQLSTATE Codes and MessagesID="IND149921"SQLSTATE codesREMAP="BO--Body"This appendix describes SQL Server's SQLSTATE status codes and the associated messages. SQLSTATE codes are required for entry level SQL92 compliance. They provide diagnostic information about two types of conditions:MARK="BULL" REMAP="BU--Bullet"Warnings-conditions that require user notification but are not serious enough to prevent a SQL statement from executing successfullyExceptions-conditions that prevent a SQL statement from having any effect on the databaseREMAP="BO--Body"Each SQLSTATE code consists of a two-character class followed by a three-character subclass. The class specifies general information about error type; the subclass, more specific information. REMAP="BO--Body"SQLSTATE codes are stored in the sysmessages system table, along with the messages that displays when these conditions are detected. Not all SQL Server error conditions are associated with a SQLSTATE code-only those mandated by SQL92. In some cases, multiple SQL Server error conditions are associated with a single SQLSTATE value.RENDERAS="SECT1"WarningsREMAP="BO--Body"SQL Server currently detects only one SQLSTATE warning condition, which is described in LINKEND="X79613"Table D-1
:TOCENTRY="1"LBL="Table D-1:" ID="X79613"WarningsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="212*"COLNAME="C2" COLWIDTH="43*"COLNAME="C3" COLWIDTH="212*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MessageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Warning - null value eliminated in set 
function.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"01003COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when using an aggregate function 
(MOREINFO="NONE"avg, MOREINFO="NONE"max, MOREINFO="NONE"min, MOREINFO="NONE"sum, or MOREINFO="NONE"count) on an expression 
with a null value.ID="IND149562"SQLSTATE codesexceptions;Error messagesSee also SQLSTATE codesRENDERAS="SECT1"ExceptionsREMAP="BO--Body"SQL Server detects the following types of exceptions:MARK="BULL" REMAP="BU--Bullet"Cardinality violationsData exceptionsIntegrity constraint violationsInvalid cursor statesSyntax errors and access rule violationsTransaction rollbacksMOREINFO="NONE"with check option violationsREMAP="BO--Body"Exception conditions are described in LINKEND="X42200"Table D-2
 through LINKEND="X80991"Table D-8
. Each class of exceptions appears in its own table. Within each table, conditions are sorted alphabetically by message text. RENDERAS="SECT2"Cardinality ViolationsREMAP="BO--Body"Cardinality violations occur when a query that should return only a single row returns more than one row to an Embedded SQL application. TOCENTRY="1"LBL="Table D-2:" ID="X42200"Cardinality Violations COLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="212*"COLNAME="C2" COLWIDTH="43*"COLNAME="C3" COLWIDTH="212*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MessageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Subquery returned more than 1 value. This is 
illegal when the subquery follows =, !=, <, 
<=, >, >=. or when the subquery is used as an 
expression.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"21000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when:name='bull' font='symbol' code='168'  charset='fontspecific' A scalar subquery or a row subquery
returns more than one row.name='bull' font='symbol' code='168'  charset='fontspecific' A MOREINFO="NONE"select into parameter_list query in
Embedded SQL returns more than one row.RENDERAS="SECT2"Data ExceptionsREMAP="BO--Body"Data exceptions occur when an entry:MARK="BULL" REMAP="BU--Bullet"Is too long for its datatypeContains an illegal escape sequence, or Contains other format errors.TOCENTRY="1"LBL="Table D-3:"Data ExceptionsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="212*"COLNAME="C2" COLWIDTH="43*"COLNAME="C3" COLWIDTH="212*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MessageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Arithmetic overflow occurred.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22003COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when:name='bull' font='symbol' code='168'  charset='fontspecific' An exact numeric type would lose 
precision or scale as a result of an 
arithmetic operation or MOREINFO="NONE"sum functionname='bull' font='symbol' code='168'  charset='fontspecific' An approximate numeric type would lose 
precision or scale as a result of truncation, 
rounding, or a MOREINFO="NONE"sum 
functionCOLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Data exception - string data right truncated.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22001COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when a char 
or varchar 
column is too 
short for the data being inserted or updated 
and non-blank characters must be truncated.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Divide by zero occurred.       COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22012     COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when a numeric expression is being 
evaluated and the value of the divisor is zero.           COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Illegal escape character found. there are
fewer bytes than necessary to form a valid
character.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22019COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when searching for strings that match 
a given pattern if the escape sequence does 
not consist of a single character.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Invalid pattern string. The character 
following the escape character must be 
percent sign, underscore, left square bracket, 
right square bracket, or the escape character.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"22025COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when searching for strings that match 
a particular pattern if:name='bull' font='symbol' code='168'  charset='fontspecific' The escape character is not immediately
followed by a percent sign, an underscore,
or the escape character itself orname='bull' font='symbol' code='168'  charset='fontspecific' The escape character partitions the pattern
into substrings whose length is not 1 or 2
charactersRENDERAS="SECT2"Integrity Constraint ViolationsREMAP="BO--Body"Integrity constraint violations occur when an MOREINFO="NONE"insert, MOREINFO="NONE"update, or MOREINFO="NONE"delete statement violates a MOREINFO="NONE"primary key, MOREINFO="NONE"foreign key, MOREINFO="NONE"check, or MOREINFO="NONE"unique constraint or a unique index.TOCENTRY="1"LBL="Table D-4:"Integrity Constraint ViolationsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="212*"COLNAME="C2" COLWIDTH="43*"COLNAME="C3" COLWIDTH="212*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MessageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Attempt to insert duplicate key row in object 
object_name MOREINFO="NONE"with unique index index_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"23000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when a duplicate row is inserted in a 
table with a unique constraint or index.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Check constraint violation occurred,dbname = database_name, table name = table_name, constraint name = constraint_nameCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"23000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when an MOREINFO="NONE"update or MOREINFO="NONE"delete would 
violate a check constraint on a column.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Dependent foreign key constraint violation in  
a referential integrity constraint. dbname = database_name, table name = table_name,constraint name = constraint_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"23000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when an MOREINFO="NONE"update or MOREINFO="NONE"delete on a primary 
key table would violate a foreign key 
constraint.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Foreign key constraint violation occurred,dbname = database_name, table name = table_name, constraint name = constraint_name COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"23000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when an MOREINFO="NONE"insert or MOREINFO="NONE"update on a foreign 
key table is performed without a matching 
value in the primary key table.RENDERAS="SECT2"Invalid Cursor StatesREMAP="BO--Body"Invalid cursor states occur when:MARK="BULL" REMAP="BU--Bullet"A MOREINFO="NONE"fetch uses a cursor that is not currently open,An MOREINFO="NONE"update where current of or MOREINFO="NONE"delete where current of affects a cursor row that has been modified or deleted, orAn MOREINFO="NONE"update where current of or MOREINFO="NONE"delete where current of affects a cursor row that not been fetchedTOCENTRY="1"LBL="Table D-5:"Invalid Cursor StatesCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="212*"COLNAME="C2" COLWIDTH="43*"COLNAME="C3" COLWIDTH="212*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MessageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Attempt to use cursor cursor_name MOREINFO="NONE"which is 
not open. Use the system stored procedure 
sp_cursorinfo for more information.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"24000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when an attempt is made to fetch 
from a cursor that has never been opened or 
that was closed by a MOREINFO="NONE"commit statement or an 
implicit or explicit MOREINFO="NONE"rollback. Reopen the cursor 
and repeat the MOREINFO="NONE"fetch.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Cursor cursor_name MOREINFO="NONE"was closed implicitly
because the current cursor position was
deleted due to an update or a delete. The
cursor scan position could not be recovered.
This happens for cursors which reference
more than one table.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"24000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when the join column of a multi-table 
cursor has been deleted or changed. Issue 
another MOREINFO="NONE"fetch to reposition the cursor. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"The cursor cursor_name MOREINFO="NONE"had its current scan 
position deleted because of a 
DELETE/UPDATE WHERE CURRENT OF
or a regular searched DELETE/UPDATE.
You must do a new FETCH before doing an
UPDATE or DELETE WHERE CURRENT
OF.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"24000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when a user issues an MOREINFO="NONE"update/delete 
where current of whose current cursor position 
has been deleted or changed. Issue another 
MOREINFO="NONE"fetch before retrying the MOREINFO="NONE"update/delete where 
current of.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"The UPDATE/DELETE WHERE CURRENT
OF failed for the cursor cursor_name MOREINFO="NONE"because
it is not positioned on a row.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"24000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when a user issues an MOREINFO="NONE"update/delete 
where current of on a cursor that:name='bull' font='symbol' code='168'  charset='fontspecific' Has not yet fetched a row orname='bull' font='symbol' code='168'  charset='fontspecific' Has fetched one or more rows after 
reaching the end of the result set RENDERAS="SECT2"Syntax Errors and Access Rule ViolationsREMAP="BO--Body"Syntax errors are generated by SQL statements that contain unterminated comments, implicit datatype conversions not supported by SQL Server, or other incorrect syntax.REMAP="BO--Body"Access rule violations are generated when a user tries to access an object that does not exist or one for which he or she does not have the correct permissions.TOCENTRY="1"LBL="Table D-6:"Syntax Errors and Access Rule ViolationsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="212*"COLNAME="C2" COLWIDTH="43*"COLNAME="C3" COLWIDTH="212*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MessageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"command MOREINFO="NONE"permission denied on object 
object_name, MOREINFO="NONE"database database_name, MOREINFO="NONE"owner 
owner_name.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"42000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when a user tries to access an object 
for which he or she does not have the proper 
permissions.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Implicit conversion from datatype 'datatype'MOREINFO="NONE" to 'datatype'MOREINFO="NONE" is not allowed. Use the
CONVERT function to run this query.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"42000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when the user attempts to convert 
one datatype to another but SQL Server 
cannot do the conversion implicitly.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Incorrect syntax near object_name.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"42000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when incorrect SQL syntax is found 
near the object specified.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Insert error: column name or number of
supplied values does not match table
definition.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"42000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs during inserts when an invalid 
column name is used, or when an incorrect 
number of values has been inserted.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Missing end comment mark `*/'.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"42000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when a comment that begins with the 
/* opening delimiter does not also have a */ 
closing delimiter. COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"object_name MOREINFO="NONE"not found. Specify
owner.objectname or use sp_help to check
whether the object exists (sp_help may
produce lots of output).COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"42000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when a user tries to reference an 
object that he or she does not own. When 
referencing an object owned by another user, 
be sure to qualify the object name with the 
name of its owner.COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"The size (size) MOREINFO="NONE"given to the object_name MOREINFO="NONE"exceeds the maximum. The largest size
allowed is size.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"42000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when:name='bull' font='symbol' code='168'  charset='fontspecific' The total size of all the columns in a table 
definition exceeds the maximum allowed 
row size orname='bull' font='symbol' code='168'  charset='fontspecific' The size of a single column or parameter 
exceeds the maximum allowed for its 
datatype.RENDERAS="SECT2"Transaction RollbacksREMAP="BO--Body"Transaction rollbacks occur when a user has set the MOREINFO="NONE"transaction isolation level to 3, but SQL Server cannot guarantee that concurrent transactions are serializable. This type of exception generally results from system problems such as disk crashes and off-line disks.TOCENTRY="1"LBL="Table D-7:"Transaction RollbacksCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="212*"COLNAME="C2" COLWIDTH="43*"COLNAME="C3" COLWIDTH="212*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MessageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"Your server command (process id #process_id) MOREINFO="NONE"was deadlocked with another process and has been chosen as deadlock victim. Re-run
your command.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"40001COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when SQL Server detects that it 
cannot guarantee the serializability of two or 
more concurrent transactions.RENDERAS="SECT2"With Check Option ViolationREMAP="BO--Body"This class of exception occurs when data being inserted or updated through a view would not be visible through the view.TOCENTRY="1"LBL="Table D-8:" ID="X80991"With Check Option ViolationsCOLS="3" CHAROFF="50" CHAR="" ALIGN="LEFT"COLNAME="C1" COLWIDTH="212*"COLNAME="C2" COLWIDTH="43*"COLNAME="C3" COLWIDTH="212*"VALIGN="BOTTOM"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MessageCOLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"ValueCOLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"DescriptionVALIGN="TOP"COLNAME="C1" ALIGN="LEFT" ROTATE="0" MOREROWS="0"MOREINFO="NONE"The attempted insert or update failed
because the target view was either created
WITH CHECK OPTION or spans another
view created WITH CHECK OPTION. At 
least one resultant row from the command
would not qualify under the CHECK
OPTION constraint.COLNAME="C2" ALIGN="LEFT" ROTATE="0" MOREROWS="0"44000COLNAME="C3" ALIGN="LEFT" ROTATE="0" MOREROWS="0"Occurs when the view itself, or any view on 
which it depends, was created with a MOREINFO="NONE"with 
check option clause. 