【SQL开源代码栏目提醒】:网学会员--在 SQL开源代码编辑为广大网友搜集整理了:INSTCAT.SQL绩等信息,祝愿广大网友取得需要的信息,参考学习。
/*
** INSTCAT.SQL
** Installs catalog stored procedures on the Microsoft SQL Server.
** Copyright 1992-1998, Microsoft Corp. All rights reserved.
*/
/*
NOTE: you MUST change the last row inserted into spt_server_info
to be version number of this file. the convention is j.nn.bbb, where
j is the major version number ('7' now), nn is the minor version number
('00' now), and bbb is the build number.
insert into spt_server_info
values (500, 'SYS_SPROC_VERSION', '7.00.bbb')
*/
/****************************************************************************/
/* This portion sets up the ability to perform all the functions in this */
/* script */
/****************************************************************************/
go
use master
go
dump tran master with no_log
go
set quoted_identifier on
go
if (exists (select * from sysobjects
where name = 'sp_configure' and type = 'P '))
begin
execute sp_configure 'update',1
end
reconfigure with override
go
exec sp_MS_upd_sysobj_category 1 /*Capture datetime for use below.*/
go
/*
** If old versions of tables exist, drop them.
*/
if (exists (select * from sysobjects
where name = 'MSdatatype_info' and type = 'U '))
drop table MSdatatype_info
go
if (exists (select * from sysobjects
where name = 'MSdatatype_info_ext' and type = 'U '))
drop table MSdatatype_info_ext
go
if (exists (select * from sysobjects
where name = 'MStable_types' and type = 'U '))
drop table MStable_types
go
if (exists (select * from sysobjects
where name = 'MSserver_info' and type = 'U '))
drop table MSserver_info
go
if (exists (select * from sysobjects
where name = 'spt_table_types' and type = 'U '))
drop table spt_table_types
go
/*
** If tables or procs already exist, drop them.
*/
if (exists (select * from sysobjects
where name = 'spt_datatype_info' and type = 'U '))
drop table spt_datatype_info
go
if (exists (select * from sysobjects
where name = 'spt_datatype_info_ext' and type = 'U '))
drop table spt_datatype_info_ext
go
if (exists (select * from sysobjects
where name = 'sp_add_server_sortinfo' and type = 'P '))
drop proc sp_add_server_sortinfo
go
if (exists (select * from sysobjects
where name = 'spt_server_info' and type = 'U '))
drop table spt_server_info
go
if (exists (select * from sysobjects
where name = 'sp_tables' and type = 'P '))
drop proc sp_tables
go
if (exists (select * from sysobjects
where name = 'sp_statistics' and type = 'P '))
drop proc sp_statistics
go
if (exists (select * from sysobjects
where name = 'sp_columns' and type = 'P '))
drop proc sp_columns
go
if (exists (select * from sysobjects
where name = 'sp_fkeys' and type = 'P '))
drop proc sp_fkeys
go
if (exists (select * from sysobjects
where name = 'sp_pkeys' and type = 'P '))
drop proc sp_pkeys
dump tran master with no_log
go
go
if (exists (select * from sysobjects
where name = 'sp_stored_procedures' and type = 'P '))
drop proc sp_stored_procedures
go
if (exists (select * from sysobjects
where name = 'sp_sproc_columns' and type = 'P '))
drop proc sp_sproc_columns
go
if (exists (select * from sysobjects
where name = 'sp_table_privileges' and type = 'P '))
drop proc sp_table_privileges
go
if (exists (select * from sysobjects
where name = 'sp_column_privileges' and type = 'P '))
drop proc sp_column_privileges
go
dump tran master with no_log
go
if (exists (select * from sysobjects
where name = 'sp_server_info' and type = 'P '))
drop proc sp_server_info
go
if (exists (select * from sysobjects
where name = 'sp_datatype_info' and type = 'P '))
drop proc sp_datatype_info
go
if (exists (select * from sysobjects
where name = 'sp_special_columns' and type = 'P '))
drop proc sp_special_columns
go
if (exists (select * from sysobjects
where name = 'sp_databases' and type = 'P '))
drop proc sp_databases
go
dump tran master with no_log
go
if (exists (select * from sysobjects
where name = 'sp_ddopen' and type = 'P '))
drop proc sp_ddopen
go
dump tran master with no_log
go
if (exists (select * from sysobjects
where name = 'spt_provider_types' and type = 'U '))
begin
drop table spt_provider_types
dump tran master with no_log
end
go
if (exists (select * from sysobjects
where name = 'sp_catalogs_rowset' and type = 'P '))
begin
drop procedure sp_catalogs_rowset
dump tran master with no_log
end
go
if (exists (select * from sysobjects
where name = 'sp_column_privileges_rowset' and type = 'P '))
begin
drop procedure sp_column_privileges_rowset
dump tran master with n