Deprecated Commands in SQL Server 2005

Problem

Should I really be concerned about the deprecated features\commands that I use in SQL Server?  In earlier versions, I have heard that commands will no longer be available and I have seen references in documentation.  Thus far my scripts always seem to work with the new versions of SQL Server.  Recently, I have heard rumors that Microsoft is no longer going to support the particular features once they are designated as deprecated features.  So is Microsoft really going to deprecate the features and am I really going to have modify all of my scripts?

Solution

To the best of my knowledge, in the past Microsoft has indicated that particular SQL Server features\commands would no longer be available and those commands have remained in the product.  Now Microsoft is indicated that once a feature is considered deprecated that the feature will be removed in the following product release.  By in large, the items that are removed are replaced with new and better features and Microsoft does offer sufficient warnings well in advance.  To answer your second question, I cannot say whether or not you will need to re-write all of your scripts because that really depends on what commands you are using.  One way to address that specific need is with the SQL Server 2005 Upgrade Advisor, which will outline problematic code and provide additional details for correction.

What are some of the common deprecated features impacting SQL Server 2008?











































IDDeprecated FeatureExplanationRecommended Feature
1Backup Log WITH NOLOG

Backup Log with TRUNCATE ONLY

Clear the entries in the current database transaction logSet the database recovery model to simple to clear the database log chain
2DUMP DATABASE | DUMP LOG

LOAD DATABASE | LOAD LOG


BACKUP TRANSACTION


BACKUP DATABASE with PASSWORD


BACKUP DATABASE with MEDIAPASSWORD

Backup and restore of the database or transaction log with optional featuresIssue BACKUP and RESTORE statements
360 compatibility level

65 compatibility level


70 compatibility level

Configures a database to operate in an earlier compatibility level

  • 60 = SQL Server 6.0
  • 65 = SQL Server 6.5
  • 70 = SQL Server 7.0
Use the current compatibility level based on the version of the product in use i.e. 90 for SQL Server 2005
4DBCC CONCURRENCYVIOLATIONFor the SQL Server 2000 Desktop Edition or Personal Edition, this DBCC command indicates when the 5 concurrent batches limitation is exceededUse SQL Server 2005 Express Edition
5sp_addalias

sp_dropalias


sp_addgroup


sp_changegroup


sp_dropgroup


sp_helpgroup

Groups and aliases to support SQL Server securityLeverage roles to manage security in SQL Server 2005 and beyond
6SETUSER Allows a member of the sysadmin fixed server role or db_owner fixed database role to impersonate another userLeverage the EXECUTE AS command
7Remote Servers

sp_addserver

A remote server allows a client connected to one SQL Server instance to execute a stored procedure on another instance of SQL Server without establishing another connectionLeverage Linked Servers

Source – Deprecated Database Engine Features in SQL Server 2005

Which features are currently marked as deprecated and suspected to be removed in the version of SQL Server after the SQL Server 2008 release i.e. SQL Server 2010?

Below is a list of features that I have recently seen at customer sites, so I know they are used in the field.  As such, be sure to stop using the deprecated feature and start using the recommended feature.  For the full list of features reference the URLs in the ‘Next Steps’ section below.











































IDDeprecated FeatureExplanationRecommended Feature
1DBCC SHOWCONTIGDetermine the index and table, pages, page usage,  fragmentation, etc.Leverage the sys.dm_db_index _physical_stats DMV
2table_name.index_name syntax in DROP INDEXTable and index reference has changedindex_name ON table_name syntax in DROP INDEX
3DBCC DBREINDEX

DBCC INDEXDEFRAG

Rebuild or reorganize indexesLeverage the ALTER INDEX syntax
4sp_attach_db

sp_attach_single_file_db

Attach a database file as opposed to restoring the fileCREATE DATABASE statement with the FOR ATTACH option
5sp_renamedbRename the database from an old name to a new nameUse the MODIFY NAME parameter in the ALTER DATABASE command
6sp_fulltext_catalog Modify an existing full text catalogIssue CREATE, ALTER or DROP FULLTEXT CATALOG statements
7fn_get_sqlCapture the full text of a spidLeverage the sys.dm_exec_sql_text DMV

Source – Deprecated Database Engine Features in SQL Server 2005

Next Steps

 

Leave a Reply

Your email address will not be published. Required fields are marked *