Backward Compatibility Details (Level 3)

Backward Compatibility Details (Level 3) consists of items supported for backward compatibility only. Any item included in this category is fully supported, but may be removed or unsupported in a future release. It is recommended that, as time allows, the backward compatible item be replaced with the recommended item. Microsoft® SQL Server™ version 7.0 provides features that accomplish these tasks more efficiently and have ongoing support.

This topic covers backward compatibility details for these items.

This subheading Relates to
Backup and Restore BACKUP
RESTORE
CREATE DATABASE
Database Options sp_dboption (publish option)
sp_replicationdboption
DBCC DBCC NEWALLOC
DBCC CHECKALLOC
DBCC ROWLOCK
Architecture Enhancements
DBCC TEXTALL
DBCC CHECKDB
DBCC TEXTALLOC
DBCC CHECKTABLE
DBCC DBREPAIR
DROP DATABASE
Devices Overview of SQL Server Architecture
DISK INIT
CREATE DATABASE
ALTER DATABASE
DISK REINIT
sp_logdevice
sp_dropdevice
Open Data Services Opends60.lib
srv_config
srv_config_alloc
SRV_GETCONFIG
srv_init
srv_run
SRV_TDSVERSION

srv_getuserdata
srv_setuserdata

srv_errhandle
SRV_IODEAD
srv_log
srv_sendstatus
srv_sfield

srv_event
SRV_EVENTDATA
SRV_GETSERVER
SRV_GOT_ATTENTION
srv_handle
srv_pre_handle
srv_post_handle
srv_setevent
srv_terminatethread

SRV_ATTENTION
SRV_CONNECT
SRV_DISCONNECT
SRV_LANGUAGE
SRV_RPC
SRV_EXIT
SRV_START
SRV_SLEEP
SRV_RESTART
SRV_STOP

srv_langcpy
srv_langlen
srv_langptr

srv_paramdata
srv_paramlen
srv_parammaxlen
srv_paramname
srv_paramnnumber
srv_paramset
srv_paramstatus
srv_paramtype
srv_returnval
srv_rpcdb
srv_rpcnumber
srv_rpcoptions

srv_clearstatistics
srv_sendstatistics

srv_alloc
srv_bmove
srv_bzero
srv_free

srv.h
srv_describe
srv_setcollen
srv_setcoldata

srv_paramsetoutput
srv_paraminfo
Query Performance SUSER_ID
SUSER_SID
SUSER_NAME
SUSER_SNAME
syslogins
sysdatabases
sysremotelogins
sysusers
sysalternates
Security GRANT
Authentication
SETUSER
SELECT FASTFIRSTROW
SELECT
INDEX = (index hint)
SET SHOWPLAN SET SHOWPLAN_TEXT
SET SHOWPLAN_ALL
SQLGetDiagRec
System Stored Procedures (Extended) xp_grantlogin
xp_revokelogin
sp_grantlogin
sp_revokelogin
System Stored Procedures (Replication) sp_replstatus
System Stored Procedures (System) sp_add_job
sp_add_jobschedule
sp_add_jobstep
sp_addtask
sp_delete_job
sp_delete_jobschedule
sp_delete_jobstep
sp_droptask
sp_help_jobhistory
sp_help_jobschedule
sp_help_jobstep
sp_helptask
sp_purge_jobhistory
sp_reassigntask
sp_start_job
sp_stop_job
sp_update_job
sp_update_jobschedule
sp_update_jobstep
sp_updatetask

  

Backup and Restore (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
The DUMP statement created database or transaction log backups (dumps). The DUMP DATABASE and DUMP TRANSACTION statements are synonymous with BACKUP DATABASE and BACKUP LOG statements. Support for the DUMP DATABASE and DUMP TRANSACTION statements may be removed in a future release. Consider removing all references of DUMP DATABASE and replacing with references to BACKUP DATABASE. Consider removing all references of DUMP TRANSACTION and replacing with references to BACKUP LOG.
The LOAD statement restored or loaded database or transaction log backups (dumps). The LOAD DATABASE and LOAD TRANSACTION statements are synonymous with the RESTORE DATABASE and RESTORE LOG statements. Support for the LOAD DATABASE and LOAD TRANSACTION statements may be removed in a future release. Consider removing all references of LOAD DATABASE and replacing with references to RESTORE DATABASE. Consider removing all references of LOAD TRANSACTION and replacing with references to RESTORE LOG. For more information about RESTORE DATABASE see RESTORE.
The CREATE DATABASE ...FOR LOAD statement syntax created a destination database before its restoration from a database backup and prevented anyone from using the database between the CREATE DATABASE, ALTER DATABASE, and LOAD statements. The CREATE DATABASE ...FOR RESTORE syntax is supported for backward compatibility only. However, because SQL Server 7.0 now creates the destination database within a restore operation, it is recommended that the destination database not be created before executing the restore operation. Do not create the database prior to restoring it.

  

Database Options (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
The publish option of sp_dboption enabled or disabled publishing in a database. publish can still be used to enable or disable publishing in a database. However, this option is supported for backward compatibility only. It is recommended that sp_replicationdboption be used for enabling or disabling publishing in a database. Consider removing all references of sp_dboption publish and replacing with references to sp_replicationdboption.

  

DBCC (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
DBCC NEWALLOC checked data and index pages against corresponding extent structures. DBCC NEWALLOC is supported for backward compatibility only and is identical to DBCC CHECKALLOC. Consider removing all references of DBCC NEWALLOC and replacing with references to DBCC CHECKALLOC.
DBCC ROWLOCK dynamically enabled Insert Row Locking (IRL) operation on tables. Row-level locking is automatic. DBCC ROWLOCK available for backward compatibility only. Consider removing all references of DBCC ROWLOCK. For more information, see Architecture Enhancements.
DBCC TEXTALL selected tables in the database that had text or image columns and ran DBCC TEXTALLOC on them. DBCC CHECKDB checks the consistency of text, ntext, and image columns in a database. DBCC TEXTALL is available for backward compatibility only. Consider removing all references of DBCC TEXTALL and replacing with references to DBCC CHECKDB.
DBCC TEXTALLOC checked the allocation of text or image columns for a table. DBCC CHECKTABLE checks the integrity of the data, index, text, ntext, and image pages for the specified table. DBCC TEXTALLOC is available for backward compatibility only. Consider removing all references of DBCC TEXTALLOC and replacing with references to DBCC CHECKTABLE.
DBCC DBREPAIR dropped the specified, and usually damaged, database. Use DROP DATABASE to drop or remove a SQL Server database. DBCC DBREPAIR is available for backward compatibility only. Consider removing all references of DBCC DBREPAIR and replacing with references to DROP DATABASE.

  

Devices (Level 3)

In Microsoft® SQL Server™ 7.0, the following changes have been made to database architecture:

For more information about database architecture, see Overview of SQL Server Architecture.

Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
DISK INIT created database or transaction log devices. When DISK INIT followed either a CREATE DATABASE or ALTER DATABASE statement, SQL Server used the specified device(s) for storing the specified database or transaction log. The CREATE DATABASE statement syntax and ALTER DATABASE statement syntax both allow the creation of separate data and log files. Both CREATE DATABASE and ALTER DATABASE create operating system files and databases in a single step (generating a log file automatically, if none is specified with the LOG ON clause). Consider removing all references to DISK INIT and replacing with references to either CREATE DATABASE or ALTER DATABASE.

DISK INIT has limited support in SQL Server 7.0; existing scripts will run as long as they do not have data and log sharing the same data file(s).

DISK REINIT restored device entries to appropriate system tables when the device entry was missing from sysdevices. Removed; no replacement. Consider removing or commenting out all references to DISK REINIT.
sp_logdevice put syslogs (contains the transaction log) on a separate database device. To add another log segment to a database with an existing log segment, it was necessary to execute DISK INIT followed by sp_logdevice. Removed. The CREATE DATABASE statement creates a log file on a new operating system file. Consider removing all references to sp_logdevice and replacing with references to CREATE DATABASE. Pre-SQL Server 7.0 scripts using the LOG ON clause of CREATE DATABASE will work as expected. Scripts without the LOG ON clause of CREATE DATABASE will have a log file generated automatically.
Devices created using DISK INIT and CREATE DATABASE could be dropped only by using sp_dropdevice. Databases created without DISK INIT before CREATE DATABASE can be dropped with DROP DATABASE; otherwise, use sp_dropdevice. Use sp_dropdevice when using DISK INIT, followed by CREATE DATABASE.

Examples

A.Use both DISK INIT and CREATE DATABASE syntax

This example uses DISK INIT and CREATE DATABASE and works in SQL Server versions 6.5 and 7.0:

DISK INIT name = 'testdb_data',

    physname = 'c:\testdb_data.dat',

    vdevno = 9,

    size = 10240

DISK INIT name = 'testdb_log',

    physname = 'c:\testdb_log.dat',

    vdevno = 8,

    size = 10240

CREATE DATABASE testdb

    ON testdb_data = 10

    LOG ON  testdb_log = 10

GO

  

B.Use sp_logdevice and CREATE DATABASE in 7.0 fails

In pre-SQL Server 7.0, this script created a 20 MB database consisting of the two files named testdb_data and testdb_log. This script also moved the transaction log to the testdb_log device by using sp_logdevice.


Note Scripts like this one were usually generated by the SQL Server 6.5 sp_help_revdatabase system stored procedure, which used sp_logdevice to ensure the proper device layout for database restores. Because SQL Server 7.0 creates the database when it is restored, scripts such as these are no longer necessary.


-- Pre-SQL Server 7.0 example.

DISK INIT name = 'testdb_data',

    physname = 'c:\testdb_data.dat',

    vdevno = 9,

    size = 10240

DISK INIT name = 'testdb_log',

    physname = 'c:\testdb_log.dat',

    vdevno = 8,

    size = 10240

CREATE DATABASE testdb on testdb_data = 10, testdb_log = 10

-- Use sp_logdevice to move the log to the testdb_log device.

sp_logdevice testdb, testdb_log

  

In SQL Server 7.0, the above script does not work the same as in pre-SQL Server 7.0 because sp_logdevice no longer exists.

In SQL Server 7.0, this script creates a 20 MB database consisting of the two files named testdb_data and testdb_log. In addition, SQL Server generates a log file automatically, which is 25 percent of the database size. In the following script (using the devices created earlier), a 10 MB log file is generated automatically:

CREATE DATABASE testdb on testdb_data = 10, testdb_log = 10

  

C.Use CREATE DATABASE syntax only

Using the SQL Server 7.0 CREATE DATABASE syntax, the database from the earlier example could be created as follows:

CREATE DATABASE testdb ON (name = 'testdb_data',

    filename = 'd:\testdb_data.dat', size = 10)

    LOG ON (name = 'testdb_log', filename = 'd:\testdb_log.dat',

    size = 10)

  

  

Open Data Services (Level 3)

Important When upgrading an existing Open Data Services application to SQL Server 7.0, it is recommended that you recompile all existing Open Data Services applications with the SQL Server 7.0 Open Data Services header file (Srv.h) and library file (Opends60.lib). For more information about Open Data Services, see Backward Compatibility Details (Level 1).


The Open Data Services gateway functions, macros, and events listed in the table are supported for backward compatibility only.

Level Function/macro name
Server Initialization and Configuration srv_config
srv_config_alloc
SRV_GETCONFIG
srv_init
srv_run
SRV_TDSVERSION
Data Retrieval srv_getuserdata
srv_setuserdata
Error and Message Handling srv_errhandle
SRV_IODEAD
srv_log
srv_sendstatus
srv_sfield
Event Management srv_event
SRV_EVENTDATA
SRV_GETSERVER
SRV_GOT_ATTENTION
srv_handle
srv_pre_handle
srv_post_handle
srv_setevent
srv_terminatethread
Event Types SRV_ATTENTION
SRV_CONNECT
SRV_DISCONNECT
SRV_LANGUAGE
SRV_RPC
SRV_EXIT
SRV_START
SRV_SLEEP
SRV_RESTART
SRV_STOP
Language Event Processing srv_langcpy
srv_langlen
srv_langptr
Remote Stored Procedure Event Processing srv_paramdata
srv_paramlen
srv_parammaxlen
srv_paramname
srv_paramnnumber
srv_paramset
srv_paramstatus
srv_paramtype
srv_returnval
srv_rpcdb
srv_rpcnumber
srv_rpcoptions
Application Management srv_clearstatistics
srv_sendstatistics
Memory Management srv_alloc
srv_bmove
srv_bzero
srv_free

Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
Multiple header files were used in Open Data Services, including:

·    Srvapi.h
·    Srvconst.h
·    Srvdbtyp.h
·    Srvmisc.h
·    Srvstruc.h
·    Srvtok.h
·    Srvtypes.h

The contents of these header files have been consolidated into srv.h. When recompiling a gateway applications, only srv.h must be included. Consider removing all references to SQL Server 6.x header files and replacing with references to the srv.h header file.
srv_describe
srv_setcollen

srv_setcoldata
These Open Data Services extended stored procedure functions have been enhanced to support new data types. Use these enhanced extended stored procedure functions (srv_describe, srv_setcollen, and srv_setcoldata), as appropriate.
srv_describe srv_describe does not support data conversion to or from the new SQL Server 7.0 data types. Consider removing or commenting out all references to srv_describe when using data types new to SQL Server 7.0.
srv_paramset * srv_parameset has been superseded by srv_paramsetoutput. Consider removing all references of srv_paramset and replacing with references to srv_paramsetoutput to obtain access to new SQL Server 7.0 data types in extended stored procedures.
srv_paramdata* srv_paramlen* srv_parammaxlen*
srv_paramtype*
These extended stored procedure functions have been superseded by srv_paraminfo. Consider removing all references of srv_paramdata, srv_paramlen, srv_parammaxlen, or srv_paramtype and replacing with references to srv_paraminfo.
* These extended stored procedure functions will support some of the new SQL Server 7.0 data types and return data compatible with version 6.x format whenever possible. For example, if a parameter is nchar(25) and srv_paramdata accesses the data, srv_paramdata returns the data as char(25). For obtaining new SQL Server 7.0 data types, use srv_paraminfo and srv_paramsetoutput.

  

Query Performance (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
Queries could include a server user ID (SUID) without performance implications, as shown in the following table. Queries using SUIDs continue to run and produce the same results as in earlier versions of SQL Server. However, there is a severe performance penalty because SUIDs are no longer native to the new security design. Consider removing all references to SUIDs and replacing with references to SIDs (as shown in the following table) to avoid degradation in query performance.

SQL Server 6.x SUID Replace with SQL Server 7.0 SID
SUSER_ID SUSER_SID, which returns a SID
SUSER_NAME SUSER_SNAME, which accepts a SID as input
syslogins.suid syslogins.sid
sysdatabases.suid sysdatabases.sid
sysremotelogins.suid sysremotelogins.sid
sysusers.suid sysusers.sid
sysalternates.suid sysusers.isaliased
sysalternates.altsuid sysusers.isaliased

Examples

A.Use SIDs and SUIDs to display login names of users in sysusers

This example shows a SQL Server 6.x query that displayed the login names of all users in sysusers:

SELECT L.name

FROM master.dbo.syslogins L, sysusers U

WHERE L.suid = U.suid

-- Or

SELECT suser_name(suid) AS name

FROM sysusers

  

Here is the earlier query rewritten to use SIDs rather than SUIDs:

SELECT L.loginname

FROM master.dbo.syslogins L, sysusers U

WHERE L.sid = U.sid

-- Or

SELECT suser_sname(sid) AS name

FROM sysusers

  

B.Use SIDs and SUIDs to display aliased usernames

This example shows a SQL Server 6.x query that displayed the login names of all logins aliased to some other login:

SELECT suser_name(suid) AS name

FROM sysalternates

  

Here is the earlier query rewritten to use SIDs rather than SUIDs:

SELECT suser_sname(sid) AS name

FROM sysusers

WHERE isaliased = 1

  

  

Security (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
The ON {table | view} (column [,...n]) syntax for the GRANT statement assigned the specified permissions to the column(s) given for the specified table or view. The ON {table | view} (column [,...n]) syntax for the GRANT statement is supported for backward compatibility only. Consider using the SQL-92 standard GRANT syntax for object permissions, and placing the column list before the ON clause.
The term integrated security allowed a SQL Server to use Windows NT Authentication mechanisms to validate logins for all connections. Standard security used SQL Server’s own login validation process for all connections. Mixed security allowed login requests to be validated using either integrated or standard security. The terms Windows NT Authentication and Mixed Mode, respectively, replace integrated security and mixed security. Standard security no longer exists. Consider using the terms Windows NT Authentication and Mixed Mode rather than integrated security and mixed security. Do not refer to standard security. For more information about security modes, see Authentication.
The SETUSER statement allowed a database owner to impersonate another user. SETUSER is included in Microsoft® SQL Server™ version 7.0 for backward compatibility only, and is not recommended to be used. This statement may no longer be supported in a future release of SQL Server. Consider removing or commenting out all references to SETUSER.

  

SELECT (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
The FASTFIRSTROW optimizer hint caused the optimizer to use the nonclustered index if one matches the ORDER BY clause. The OPTION (FAST n) query hint replaces FASTFIRSTROW. However, FASTFIRSTROW is maintained for backward compatibility only. Consider removing all references to FASTFIRSTROW in SELECT statements and replacing with references to OPTION (FAST n).
The INDEX = syntax specified one or more indexes to use for a table hint. Supported for backward compatibility only. Consider removing all references to INDEX = and replacing (when using multiple index hints) with references to INDEX(index, index...) as shown in SELECT.

  

SET SHOWPLAN (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
The SET SHOWPLAN statement returned output as informational messages through SQLGetDiagRec in ODBC, or through the message handler in DB-Library applications. The SET SHOWPLAN statement is no longer supported. It has been replaced by SET SHOWPLAN_TEXT and SET SHOWPLAN_ALL. The output of SET SHOWPLAN_TEXT and SET SHOWPLAN_ALL is returned not as informational messages, but as a result set. Consider removing all references of SET SHOWPLAN and replacing with references to either SET SHOWPLAN_TEXT (to display readable text) or SET SHOWPLAN_ALL (to display output that can be parsed more easily by an application building a report of showplan output). The application needs to process the output as part of the result set, not as messages returned through the ODBC SQLGetDiagRec function or the DB-Library message handler.

  

System Stored Procedures (Extended) (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
xp_grantlogin and xp_revokelogin granted or revoked SQL Server access to a Windows NT-based group or user. Use sp_grantlogin and sp_revokelogin even though xp_grantlogin and xp_revokelogin are supported for backward compatibility only. Consider removing all references of xp_grantlogin and xp_revokelogin and replacing with references to sp_grantlogin and sp_revokelogin, respectively.

  

System Stored Procedures (Replication) (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
sp_replstatus updated the internal table structure for replication. Even though sp_replstatus is still available, support for this stored procedure may not be available in a later release. Consider using the minimum number of references to sp_replstatus.

  

System Stored Procedures (System) (Level 3)
Pre-SQL Server 7.0 SQL Server 7.0 Recommendations
Job management was called task management, and several system stored procedures allowed system administrators to create and manage tasks. The task management system stored procedures are no longer documented and are included for backward compatibility only. Even though SQL Server 7.0 supports the task management system stored procedures (sp_addtask, sp_droptask, sp_helptask, sp_reassigntask, and sp_updatetask) for scheduling and managing SQL Server jobs, consider using either SQL Server Enterprise Manager or the job-related system stored procedures listed in the following table be used for managing jobs.

The task-related stored procedures listed in the Pre-SQL Server 7.0 column below have been replaced by the corresponding job-related stored procedures shown in the SQL Server 7.0 column.

Pre-SQL Server 7.0 SQL Server 7.0
sp_addtask sp_add_job
sp_add_jobstep

sp_add_jobschedule
sp_start_job
sp_droptask sp_delete_job
sp_delete_jobstep

sp_delete_jobschedule
sp_helptask sp_help_jobhistory
sp_help_jobschedule

sp_help_jobstep
sp_reassigntask sp_purge_jobhistory
sp_stop_job
sp_updatetask sp_update_job
sp_update_jobstep
sp_update_jobschedule

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.