Whatsnew in SQL
Whatsnew in SQL
Document-Back Guarantee
Sybase welcomes corrections and comments on its documents. If you mark
typographical errors, formatting errors, errors of fact, or areas that need
clarification in any Sybase user’s manual and send copies of marked-up pages to
us, we will send you a clean copy of the manual, absolutely free.
Send pages to the Publications Operations Department at the address below.
Please include your Site ID number.
Sybase, Inc.
6475 Christie Avenue
Emeryville, CA 94608
USA
(510) 922-3500
Fax (510) 922-5340
Document Orders
Customers may purchase additional copies of any document or the right to make
photocopies of documentation for their in-house use.
To order additional documents or photocopy rights, U.S. and Canadian customers
should call Customer Fulfillment at (800) 685-8225, fax (617) 229-9845.
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.
Upgrades are provided only at regularly scheduled software release dates.
©Copyright Sybase, Inc., 1989, 1994. All rights reserved.
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 Trademarks
SYBASE, the SYBASE logo, APT-FORMS, Data Workbench, DBA Companion,
Deft, GainExposure, GainInsight, GainMomentum, SA Companion, SQL Debug,
SQL Solutions, SQR, Transact-SQL, and VQL are registered trademarks of
Sybase, Inc. Adaptable Windowing Environment, ADA Workbench, Application
Manager, Applications from Models, APT-Build, APT-Edit, APT-Execute,
APT-Library, APT-Translator, APT Workbench, Build Momentum, Camelot,
Client/Server Architecture for the Online Enterprise, Client/Server for the
Real World, Configurator, Database Analyzer, DBA Companion Application
Manager, DBA Companion Resource Manager, 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, Insight, MAP, Maintenance Express, MethodSet,
Movedb, Navigation Server, Net-Gateway, Net-Library, Object Momentum,
OmniSQL Access Module, OmniSQL Gateway, OmniSQL Server, Open Client,
Open Client/Server Interfaces, Open Gateway, Open Server, Open Solutions,
Partnerships That Work, PC APT-Execute, PC DB-Net, PC Net Library, PostDoc,
Replication Server, Replication Server Manager, Report-Execute,
Report Workbench, Resource Manager, RW-Display Lib, RW-Library,
Secure SQL Server, Secure SQL Toolset, SQL Code Checker, SQL Edit,
SQL Edit/TPU, SQL Monitor, SQL Server, SQL Server/CFT, SQL Server/DBM,
SQL Station, SQL Toolset, SQR Developers Kit, SQR Execute, SQR Toolset,
SQR Workbench, SYBASE Client/Server Interfaces, SYBASE Gateways,
Sybase Momentum, SYBASE SQL Lifecycle, Sybase Synergy Program,
SYBASE Virtual Server Architecture, SYBASE User Workbench, System 10,
Tabular Data Stream, The Enterprise Client/Server Company, and
The Online Information Center are trademarks of Sybase, Inc.
All other company and product names used herein may be the trademarks or
registered trademarks of their respective companies.
vi Table of Contents
SYBASE SQL Server Release 10.0
Index
x Table of Contents
List of Tables
Table 1-1: set Options for ANSI Compliance .............................................................................1-16
Table 1-2: ANSI-Compatible Keyword Synonyms ...................................................................1-18
Table 1-3: New set Options...........................................................................................................1-25
Table 1-4: New and Changed Built-In Functions......................................................................1-27
Table 1-5: New System Procedures .............................................................................................1-28
Table 1-6: Chargeback Accounting System Procedures ...........................................................1-29
Table 1-7: Changes to System Procedures..................................................................................1-30
Table 1-8: New Configuration Options ......................................................................................1-30
Table 1-9: New sp_dboption Database Options ..........................................................................1-31
Table 1-10: Changes to Existing System Tables ...........................................................................1-33
Table 2-1: New Reserved Words....................................................................................................2-2
Table 2-2: Changes in Output Using Numeric Literals..............................................................2-9
Table 2-3: Changes to Datatype Hierarchy ................................................................................2-10
Table 2-4: New Type Conversion Error Messages ....................................................................2-12
Table 2-5: ANSI Permissions for update and delete .....................................................................2-13
Introduction
This chapter describes the new features for SYBASE SQL Server™
Release 10.0. These new features include:
• New Installation, Upgrade and Configuration Utility
• Addition to System Databases
• Backup/Space Management
• New Security Features
• Cursors
• Data Definition Enhancements
• Trigger, Transaction, and Stored Procedure Changes
• Query/Data Modification Changes
• ANSI Compliance Changes
• System Administration Changes
• Error Handling
• create index Performance Enhancements
• Query Optimizer Enhancements
• Bulk Copy Performance Enhancements
• Spanish Language Sort Orders
• Document Reorganization
The last section of this chapter provides a summary of changes to the
following commands and system tables:
• set Options
• New and Changed Built-In Functions
• New and Changed System Procedures
• New Configuration Options
• New Database Options
• New System Tables
• Changes to System Tables
Backup/Space Management
Backup Server
The Open Server-based Backup Server utility now handles all dumps
and loads for SQL Server. Dumps and loads now work more quickly,
with significantly less effect on other SQL Server activities. New
dump and load syntax provides more flexibility and more options:
• Dump striping allows you to use up to 32 dump devices in
parallel to dump or load a single database or transaction log.
• Multi-file/multi-volume dumps allow one dump to span
multiple tapes, or allow multiple dumps to be made to a single
tape.
• Network dumps allow dumping and loading over the network to
or from a device on another machine.
• Backup Server complies with ANSI standard tape labelling and
handling.
• Platform-specific tape handling options support dump/load
command syntax specification for volume naming, dismount and
load control, tape density, block size, tape capacity, days to retain,
initialization, file naming for multi-dump volumes, and listing
header or file information instead of loading the files.
• The system procedure sp_volchanged signals volume changes
during backups. (OpenVMS users do this with the REPLY
command.) It replaces the console utility program. sp_volchanged
can be submitted from any ordinary SYBASE client to signal
volume changes to the Backup Server.
• Multiple dumps and loads can be managed from one or more
local or remote servers.
◆ WARNING!
You cannot load dumps made with earlier releases using 10.0 dump and
load commands: pre-10.0 dumps are not compatible with 10.0 SQL
Server.
Threshold Manager
User Identification
Auditing
Cursors
SQL Server Release 10.0 provides full support for cursors. The
following cursor commands are documented in Volume 1 of the SQL
Server Reference Manual:
declare cursor
fetch
open
close
deallocate
A new topic called “Cursors” in Volume 1 of the SQL Server Reference
Manual provides an overview of cursors. New keywords that allow
updating and deleting at cursor positions are described on the delete
and update pages. A new set option controls the number of rows
returned by a fetch command. A new system procedure, sp_cursorinfo,
provides information about the active cursors in a database.
Chapter 15, ‘‘Cursors: Accessing Data Row by Row’’, in the
Transact-SQL User’s Guide provides examples of cursor use, including
cursors in stored procedures.
Integrity Constraints
See create table and alter table in Volume 1 of the SQL Server Reference
Manual for the new syntax. Chapter 6, ‘‘Creating Databases and
Tables’’, in the Transact-SQL User’s Guide describes how to use the
constraints along with additional examples.
Changes to Views
Schemas
The new create schema command allows you to create several objects
and grant permissions on those objects in a single statement, which
can be committed or rolled back as a unit. See create schema in Volume
1 of the SQL Server Reference Manual.
Datatypes
Trigger Self-Recursion
Release 10.0 of SQL Server eliminates the size limit for compiled
stored procedures and batches. To accommodate this change, the
maximum amount of text allowed for a stored procedure has been
increased to 16 Mb. This increase also applies to objects whose text is
stored in the syscomments system table, such as triggers, views,
defaults, rules, and constraints.
Subquery Changes
Column Alias
You can now use the keyword as in select statements between the
select expression and the alias name. For example:
select au_lname as lastname from authors
SQL Server Release 10.0 provides full support for host variables and
Dynamic SQL. Full documentation can be found in Embedded SQL/C
and Embedded SQL/COBOL Programmer’s Guides.
ANSI Compatibility
SQL Server Release 10.0 meets SQL89 /FIPS 127-1 and SQL92/FIPS
127-2 standards. In addition to major features such as declarative
integrity constraints and cursors, which are described elsewhere in
this chapter, the following changes are included in Release 10.0. Since
some of ANSI behavior is not compatible with existing SQL Server
applications, Transact-SQL provides set options that allow you to
toggle these behaviors.
Option Setting
ansi_permissions on
ansinull on
arithabort off
arithabort numeric_truncation on
arithignore off
chained on
close on endtran on
fipsflagger on
quoted_identifier on
string_rtruncation on
transaction isolation level 3
FIPS Flagger
SQL Server now supports the ANSI escape clause, which allows you to
specify an escape character in the like predicate to search for wildcard
characters. This is in addition to Transact-SQL’s use of square
brackets for the same purpose. See “Wildcard Characters” in Volume
1, Chapter 3 of the SQL Server Reference Manual.
ANSI-Style Comments
Changes were made to the set options arithabort and arithignore to allow
compliance with the SQL92 standard:
• arithabort arith_overflow determines how SQL Server handles
arithmetic overflows and divide-by-zero errors during implicit
and explicit conversions. Set this option on to roll back the entire
transaction or batch in which the error occurs. Set this option off to
abort the statement that contains the error and continue
processing other statements in the transaction or batch.
• arithabort numeric_truncation determines how SQL Server handles loss
of scale during implicit conversions to a numeric or decimal type.
Set this option on to abort the statement that contains the error
and continue processing other statements in the transaction or
batch. Set it off to truncate the results as necessary and continue
processing.
• arithignore arith_overflow determines whether SQL Server ignores
arithmetic overflow and divide-by-zero errors. Set this option off
to print a warning message when these errors occur. Set it on to
ignore these errors and print no messages.
If you have used these options in your applications, examine them to
ensure that they are still producing the desired behavior.
Synonymous Keywords
Several keywords have been added for ANSI compatibility that are
synonymous with existing Transact-SQL keywords.
tran work
transaction
any some
grant all grant all privileges
revoke all revoke all privileges
The new work keyword is synonymous with tran and transaction only
with the commit transaction and rollback transaction commands, not with
the begin transaction command.
See page 1-11 of this document for a list of synonymous datatypes.
◆ WARNING!
Before you change the default transaction mode or isolation level, be
sure to read the sections in the Transact-SQL User’s Guide and Volume 1
of the SQL Server Reference Manual that describe how these changes can
affect existing applications and stored procedures.
Delimited Identifiers
SQL Server now supports delimited identifiers for table, view, and
column names. Delimited identifiers are object names enclosed
within double quotation marks. Using them allows you to avoid
certain restrictions on object names.
➤ Note
Delimited identifiers cannot be used with some system procedures, cannot be
used with bcp, and may not be supported by all client software.
Treatment of Nulls
Enhancements to Permissions
Object and command permissions in SQL Server have been
enhanced with the following new options.
Granting to Roles
You can grant and revoke object and command permissions to all
users who have been granted a specific role. The roles are sa_role,
sso_role, and oper_role. Permissions granted to roles override
permissions granted to individuals or groups.
Chargeback Accounting
The kill command, used to terminate SQL Server sessions, can now
terminate more kinds of sessions. In previous releases, some of these
sessions could not be terminated (except by rebooting SQL Server),
or would only actually terminate when the processes stopped
sleeping. Now, these sessions can be terminated immediately. The
sp_who system procedure now displays different status values for
these sessions. For more information, see kill in Volume 1, Chapter 1
of the SQL Server Reference Manual or Chapter 11, ‘‘Diagnosing
System Problems’’ of the System Administration Guide.
tempdb Changes
By default, all users now have create table permission in tempdb. See
“Temporary Tables” in Volume 1, Chapter 3 of the SQL Server
Reference Manual for more information.
Error Handling
raiserror can now return the name of the tables and columns causing
an error, along with the error number and text. See raiserror in Volume
1 of the SQL Server Reference Manual.
Document Reorganization
The SQL Server documentation set has been reorganized for this
release.
• The Commands Reference Manual has been split into two volumes:
- Transact-SQL commands, functions, and special topics (such as
Locking and Transactions) are now documented in Volume 1 of
the SYBASE SQL Server Reference Manual.
- The SYBASE system procedures and catalog stored procedures
are now documented in Volume 2 of the SYBASE SQL Server
Reference Manual.
• The SYBASE SQL Server Utility Programs now documents the
utility programs for your operating system.
• The Transact-SQL User’s Guide has been reorganized, with the first
part tailored to new SQL users and the more advanced and
complex concepts presented in the second part.
set Options
Option Use
set ansinull {on | off} Toggles ANSI treatment of NULL-valued
operands in equality (=) and inequality (!=)
comparisons. When on, treatment is ANSI
‘89 compliant.
set ansi_permissions {on | off} Determines whether ANSI-compliant
permissions requirements for update and
delete statements are checked.
set arithabort [arith_overflow | Determines whether SQL Server aborts a
numeric_truncation] {on | off} query when an arithmetic overflow or
numeric truncation error occurs.
set arithignore [arith_overflow] {on | Determines whether SQL Server displays a
off} warning message after any query that
results in arithmetic overflow.
Option Use
set chained {on | off} Toggles the chained transaction mode in
SQL Server.
set close on endtran {on | off} Forces all open cursors to be closed when
the transaction ends (on) or to remain open
across transactions (off).
set cursor rows number Sets the number of cursor rows returned to
for cursor_name the host on each fetch for the specified
client cursor. The default is 1.
set dup_in_subquery {on | off} Controls whether a subquery using the in
clause returns duplicate values. The
default is off; duplicate rows are not
returned. In prior SQL Server releases, a
row was returned for each matching row
in the subquery. ANSI specifies removing
duplicate values from the result set.
set fipsflagger {on | off} Toggles the FIPS flagger. When on, the
option prints warning messages for the
Transact-SQL extensions to ANSI 89 SQL.
set identity_insert table_name Determines whether a user can explicitly
{on | off} insert a value into table_name’s IDENTITY
column. Users can turn this option on for
only one table at a time per database.
set quoted_identifier {on | off} Determines whether SQL Server treats
strings enclosed in double quotes (") as
identifiers.
set role {”sa_role” |”sso_role” Toggles the specified role during the
| ”oper_role”} {on | off} current SQL Server session.
set self_recursion {on | off} Switches trigger self-recursion on or off, so
that triggers that modify data cause the
trigger to fire again.
set string_rtruncation {on | off} Determines if silent truncation of character
strings is allowed. When on, treatment is
ANSI ‘89 compliant
set transaction isolation level {1|3} Sets the transaction isolation level. An
isolation level of 3 is equivalent of doing
select with holdlock.
Name Function
user New ANSI compatible system function returns the user name.
Name Function
sp_estspace Estimates the amount of space needed for a table and its
indexes.
sp_helpconstraint Reports information about any integrity constraints
specified for a table.
sp_helpthreshold Reports information on all thresholds in the current
database or all thresholds for a particular segment.
Name Function
sp_volchanged Notifies SQL Server that the operator has performed the
requested volume handling during a dump or load.
Name Function
Name Changes
Option Function
additional netmem Memory added for use with variable packet sizes
Option Function
The serial number field, configuration value 114, has been removed.
Option Function
abort tran on log full Determines whether user processes are suspended (the
default) or aborted when the last-chance threshold on a
database’s log segment is reached.
allow nulls by Changes the default null type for create table statements
default from not null (the Transact-SQL default) to null (the ANSI
default.)
auto identity Automatically defines a 10-digit IDENTITY column,
syb_identity_col, in each new table that does not specify a
primary key, a unique index, or an IDENTITY column. The
column is not visible with a select * statement; you must
include the column name in the select list to retrieve it.
Option Function
Table Changes
master..sysdatabases New columns: status2, audflags, deftabaud, defvwaud,
defpraud; mode removed.
master..syslocks New column: class.
master..syslogins New columns: pwdate, audflags, fullname. Formerly
reserved columns now used: status, accdate, totcpu, and
totio. (The last three columns are used by chargeback
accounting, formerly available on VMS only.)
master..sysmessages New column: sqlstate.
master..sysprocesses New columns: tran_name, time_blocked, network_pktsz.
master..sysusages New columns: pad and unreservedpgs.
syscolumns New columns: prec, scale.
syscomments New column: colid2.
sysindexes New column: status2. Changed columns: spare1 to
oampgtrips, spare2 to ipgtrips.
sysobjects Changed columns: schema to schmacnt, refdate to
sysstat2, category to ckfirst. New columns: objspare and
audflags.
sysprotects New column: grantor. Changed columns: values for the
protecttype column are different. 0 indicates grant with
grant, 1 indicates regular grant, and 2 indicates revoke.
systypes New columns: prec, scale, ident, hierarchy.
Introduction
This chapter describes the changes to Release 10.0 of SQL Server that
may affect existing applications. These changes are:
• New Transact-SQL keywords
• Password changes
• Addition of sybsystemprocs database
• Remote access configured “on” in all existing databases for
Backup Server
• Changes to dump scripts
• Changes to renaming databases
• Datatype changes:
- Display Format Changes
- Changes to the datatype hierarchy and defaults
- Overflow changes, including float-to-character, numeric-to-
numeric, and integer-to-character conversions.
• Change to between
• Addition of ANSI-style comments using “--”
• Addition of ANSI-compliant permissions requirements for update
and delete statements
• Addition of ANSI-compliant treatment of nulls when set ansinull is
on
• Chained transaction mode and its effect on stored procedures
• Role changes that may affect scripts
• Repeated table names in the from clause of an update or select
statement now causes an error
• Column names required for select into when the select list contains
expressions or aggregates
• Changes to correlation name handling
• Changes to subquery behavior
In addition, you may want to review applications using “browse
mode”, to take advantage of cursors.
You must change all database names that are new reserved words
before you can upgrade an earlier version of the server. You can
change table, view, and column names or use delimited identifiers.
Once you upgrade to Release 10.0, you cannot use database objects
whose names are new reserved words until you modify your
procedures, SQL scripts, and applications.
A new system procedure, sp_checkreswords, checks for reserved words
used as identifiers and reports the object names. For information on
running this procedure before you upgrade, see your SYBASE SQL
Server Installation Guide.
Password Changes
SQL Server no longer allows NULL passwords. All passwords must
be at least 6 bytes in length. Existing passwords containing less than
6 bytes are not changed during upgrade, but all future uses of
sp_password will require a 6-character new password.
You can globally force users to change passwords within a specified
time period using the password expiration level option to sp_configure. This
feature provides last-chance warning messages when a user logs in
with a password that is about to expire. Users whose passwords have
expired can log in, but they can execute sp_password only.
If you have applications that include embedded passwords, you will
need to update them each expiration period if you turn on password
expiration.
See Chapter 12, ‘‘Fine-Tuning Performance and Operations’’, in the
System Administration Guide for more information.
➤ Note
All dumps to the “null device” (/dev/null on UNIX or any device starting with “NL”
on VMS) are now prohibited.
• If you want to overwrite existing tapes that have ANSI labels, you
must append the with init clause to existing dump commands:
dump databasse mydb
to datadump1
with init
You can also use operating system commands to erase or
truncate the tape.
The following diagram shows the logic used in tape label checking
on a dump command used without the init option:
N
ANSI Label?
N
Single File
Format Tape?
Y
Perform dump,
appending to end Y
of tape Expired?
N
N
Insert different Y
tape Confirm
Overwrite
Perform dump,
overwriting
tape
Figure 2-1: Checking Tape Format and Expiration Dates for Dump Commands
sysname 19
nvarchar 19
char 20
nchar 20
varbinary 21
timestamp 21
binary 22
text 23
image 24
(28 rows affected)
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.
In earlier releases of SQL Server, there were certain exceptions to this
rule that have been eliminated in Release 10.0. Specifically, float and
numeric computations combined with money or smallmoney.
Workarounds include:
• If you are combining money and literals or variables, and need
results of money type, use money literals or variables:
select moneycol * $2.5 from mytable
• If you are combining money with a float or numeric column, use the
convert function:
select convert (money, moneycol * percentcol)
from debts, interest
Overflow Changes
Integer-to-Character Conversions
Conversions from integer types to character types now return a
buffer overflow error (instead of “*”) on overflow.
Error
Message
Number
241 Scale error during [explicit | implicit] conversion of datatype value
‘value’ to a datatype field.
245 Domain error during [explicit | implicit] conversion of datatype
value ‘value’ to a datatype field.
247 Arithmetic overflow during [explicit | implicit] conversion of
datatype value ‘value’ to a datatype field.
249 Syntax error during [explicit | implicit] conversion of datatype
value ‘value’ to a datatype field.
265 Insufficient result space for [explicit | implicit] conversion of
datatype value ‘value’ to a datatype field.
Change to between
The between predicate is used in where clauses, such as this:
where colx between val1 and val2
val1 must be less than val2. In a few situations, the between predicate
returned correct values, even when val2 < val1. In Release 10.0, these
values must be given in the correct order; check your applications
that use between if you think they may be dependent on the incorrect
behavior.
ANSI-Style Comments
To comply with ANSI 89, SQL Server now supports ANSI-style
comments, which consist of two dash or minus-sign characters. All
characters after “--” are ignored. This could cause problems in any
SQL query that uses the subtraction of a negative number, such as
this:
select 5--2
This query no longer returns the value “7”; it now returns “5”. All
characters from “--” to the end of the line are ignored.
You should check all applications that use select into. Examples of
select list items that require headings are:
• An aggregate function:
avg(advance)
• Arithmetic expression:
colname * 2
• String concatenation:
au_lname + ", " + au_fname
• Built-in function:
substring(au_lname,1,5)
• Constant:
"Result"
There are three ways to specify the column heading:
• Before the expression or aggregate function, with an “=”:
select title_id, avg_advance = avg(advance)
into #tempdata
from titles
• After the expression or aggregate function:
select title_id, avg(advance) avg_advance
into #tempdata
from titles
• After the expression or aggregate function, with as:
select title_id, avg(advance)as avg_advance
into #tempdata
from titles
The column names must be valid identifiers, unless you are using the
delimited identifier feature.
select title_id
from titles t
where titles.type = "trad_cook"
The correct query is:
select title_id
from titles t
where t.type = "trad_cook"
When this same type of correlation is included in a subquery, no
error is reported, but queries may return different results. Here is an
example:
select *
from mytable
where columnA =
(select min(columnB) from mytable m
where mytable.columnC = 10)
In earlier releases, the reference to mytable.columnC in the subquery
referred to the mytable in the subquery. Now, this query is a correlated
subquery, and mytable.columnC refers to the outer table mytable.
If the query needs to refer to the mytable in the subquery, the correct
statement is:
select *
from mytable
where columnA =
(select min(columnB) from mytable m
where m.columnC = 10)
Subquery Changes
Several problems relating to subqueries have been fixed in Release
10.0 of SQL Server. This section describes old and new behavior in
detail. Examine applications that use subqueries to determine if your
application relies on behavior that has been corrected. This may
especially be true of the first two items below.
The following types of subqueries have changed:
• Correlated subqueries using in and any
• Subqueries using not in when the subquery returns NULL values
• in and any subqueries combined with or
• >all and <all with subqueries that return no rows
pub_name
----------------
New Age Books
New Age Books
New Age Books
New Age Books
New Age Books
Binnet & Hardley
Binnet & Hardley
Binnet & Hardley
Binnet & Hardley
Binnet & Hardley
Binnet & Hardley
Binnet & Hardley
Algodata Infosystems
Algodata Infosystems
Algodata Infosystems
Algodata Infosystems
Algodata Infosystems
Algodata Infosystems
They now return:
pub_name
------------------------
New Age Books
Binnet & Hardley
Algodata Infosystems
If you have applications which depend on the pre-10.0 Transact-SQL
behavior, use the following set command until you can rewrite the
existing queries as joins, or add indexes to the tables the queries
operate on:
set dup_in_subquery on
◆ WARNING!
set dup_in_subquery on is provided only as an upgrade path to SQL
Server Release 10.0. It will not be supported in future releases. See the
Release Bulletin for more information.
A subquery using the not in predicate returns a set of values for each
row in the outer query. If the value from the outer query is not in this
set, the not in returns TRUE. If the set returned by the subquery
contains no matching value, but it does contain a NULL, the not in
returns UNKNOWN. This is because NULL stands for “value
unknown”, and it is impossible to tell whether the value you’re
looking for is in a set containing an unknown value. In earlier
releases, SQL Server erroneously considered this case to be TRUE.
For example, using the pubs2 database:
select pub_id
from publishers
where $100.00 not in
(select price
from titles
where titles.pub_id = publishers.pub_id)
In previous releases, this query returned:
pub_id
------
0736
0877
1389
It now returns the correct result:
pub_id
------
0736
Or:
select pub_name
from publishers
where pub_id = any
(select pub_id
from titles
where title = ‘No Such Book’)
or pub_id = ‘1389‘
These queries both returned no result rows in pre-10.0 SQL Server.
They now return:
pub_name
-----------------------------
Algodata Infosystems
> all and < all When the Subquery Matches No Rows
When a subquery using the > all or < all predicate matches no rows,
the subquery should evaluate to TRUE. Instead, it evaluated to FALSE
in pre-10.0 SQL Server. For example, using the pubs2 database:
select title
from titles
where advance > all
(select advance
from publishers, titles
where titles.pub_id = publishers.pub_id
and pub_name = ‘No Such Publisher’)
This query returned no rows. It now returns all of the rows, the
correct result.
(3 rows affected)
Introduction
This chapter lists the changes to Releases 4.8, 4.9, and 4.9.1 of SQL
Server. This information is provided mainly as a convenience for
customers who have not upgraded to one of these earlier versions.
The new for load option for the create database command speeds up
database creation for recovery from media failure or for moving
databases. See create database in Volume 1 of the SQL Server Reference
Manual, or the System Administration Guide.
union Operator
The new negative comparison operator <> (not equal to) is the same
as the != operator. See “Expressions” in Volume 1 of the SQL Server
Reference Manual.
New Datatypes
Except in create table, create view, and select into statements, column
headings now can include any characters, including blanks and SQL
Server keywords, if the column heading is enclosed in quotes.
International Features
Configuration Variables
See sp_configure in Volume 2 of the SQL Server Reference Manual for
information about these new configuration options.
Error log entries now show the engine involved for each log entry.
The date format is now yy/mm/dd.
The time is now displayed in 24-hour format.
Seconds and hundredths of a second have been added to the time
format.
New Datatypes
The national character datatypes nchar and nvarchar allow a user to
define a column length as containing a specific number of multibyte
characters. The number of bytes in a character is contained in the
new global variable @@ncharsize. See “Datatypes” in Volume 1 of the
SQL Server Reference Manual.
New Functions
valid_name determines whether a string is legal for use in an identifier.
char_length determines the number of characters in a character
expression.
These functions are documented under “String Functions” in
Volume 1 of the SQL Server Reference Manual.
Configuration Variables
The configuration variable default character set id specifies the number
of the default character set SQL Server uses. See sp_configure in
Volume 2 of the SQL Server Reference Manual or Chapter 12, ‘‘Fine-
Tuning Performance and Operations’’, in the System Administration
Guide for more information.
dbcc (Database Consistency Checker) has two new options for use
when SQL Server’s sort order or character set is changed: dbcc reindex
and dbcc fix_text. dbcc reindex checks and rebuilds character indexes
which may have been invalidated by a sort order change. dbcc fix_text
calculates the statistics needed to manage text values after changing
to a multibyte character set.
Configuration Variable
The new configuration variable stack size specifies the size of SQL
Server’s stack. See Volume 2 of the SQL Server Reference Manual or
Chapter 12, ‘‘Fine-Tuning Performance and Operations’’, in the
System Administration Guide.
2 Index
SYBASE SQL Server Release 10.0
N Q
nchar datatype 3-5 Query optimizer 1-24
Network dumps 1-4
no free space acctg
sp_dboption 1-32 R
not in predicate 2-20 raiserror 1-23
Null device 2-6 arguments 3-5
NULL operands 1-20 rand function 1-15
Numeric conversions 2-11 real datatype 3-1
numeric datatype 1-10 Recompiling stored procedures 3-3
Numeric literals 2-9 Recovery changes, master device 2-5
nvarchar datatype 3-5 Referential integrity constraints 1-9
Remote access 2-5
Repeated table names 2-15
O reserved_pgs function 3-4
object_name function 1-27 revoke command
open 1-9 in transactions 1-12
open databases configuration variable 2-3 cascade option 1-21
Open databases, limit of 2-5 roles and 1-21
Operator role 1-7 Roles 1-7, 2-14
Optimizer changes 1-24 rollback trigger 1-13
Overflow conditions, conversion rowcnt function 3-4
changes 2-10
S
P Schemas 1-10
Packet size, configuring 1-21, 1-24 Security 1-6
Passwords Segments
aging 2-3 thresholds 1-5
encryption 1-8 select into 1-15, 2-15
expiration 1-8 Self-recursive triggers 1-13
4 Index
SYBASE SQL Server Release 10.0
6 Index
SYBASE SQL Server Release 10.0
U
union operator 3-1
Unique constraints 1-9
update 1-9, 2-15
update statistics 1-24
Upgrading SQL Server 1-2
used_pgs function 3-4
user function 1-27
User-defined messages 3-6
8 Index