生成脚本文件容易,问题是如何调用SQL执行这些脚本?在狐表上怎么实现调用SQL执行?希望老爹能做个示例.....
脚本代码好长...
****** Object: Database yahis Script Date: 2009-4-11 9:03:58 ******/
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'yahis')
DROP DATABASE [yahis]
GO
CREATE DATABASE [yahis] ON (NAME = N'yahis_Data', FILENAME = N'd:\Program Files\Microsoft SQL Server\MSSQL\data\yahis.mdf' , SIZE = 4, FILEGROWTH = 10%) LOG ON (NAME = N'yahis_Log', FILENAME = N'd:\Program Files\Microsoft SQL Server\MSSQL\data\yahis_log.ldf' , SIZE = 1, FILEGROWTH = 10%)
COLLATE Chinese_PRC_CI_AS
GO
exec sp_dboption N'yahis', N'autoclose', N'true'
GO
exec sp_dboption N'yahis', N'bulkcopy', N'false'
GO
exec sp_dboption N'yahis', N'trunc. log', N'true'
GO
exec sp_dboption N'yahis', N'torn page detection', N'true'
GO
exec sp_dboption N'yahis', N'read only', N'false'
GO
exec sp_dboption N'yahis', N'dbo use', N'false'
GO
exec sp_dboption N'yahis', N'single', N'false'
GO
exec sp_dboption N'yahis', N'autoshrink', N'true'
GO
exec sp_dboption N'yahis', N'ANSI null default', N'false'
GO
exec sp_dboption N'yahis', N'recursive triggers', N'false'
GO
exec sp_dboption N'yahis', N'ANSI nulls', N'false'
GO
exec sp_dboption N'yahis', N'concat null yields null', N'false'
GO
exec sp_dboption N'yahis', N'cursor close on commit', N'false'
GO
exec sp_dboption N'yahis', N'default to local cursor', N'false'
GO
exec sp_dboption N'yahis', N'quoted identifier', N'false'
GO
exec sp_dboption N'yahis', N'ANSI warnings', N'false'
GO
exec sp_dboption N'yahis', N'auto create statistics', N'true'
GO
exec sp_dboption N'yahis', N'auto update statistics', N'true'
GO
if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
exec sp_dboption N'yahis', N'db chaining', N'false'
GO
use [yahis]
GO
/****** Object: Table [dbo].[H_CW] Script Date: 2009-4-11 9:03:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[H_CW]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[H_CW]
GO
/****** Object: Table [dbo].[H_DWXX] Script Date: 2009-4-11 9:03:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[H_DWXX]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[H_DWXX]
GO
/****** Object: Table [dbo].[H_FYLB] Script Date: 2009-4-11 9:03:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[H_FYLB]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[H_FYLB]
GO
/****** Object: Table [dbo].[H_HZ] Script Date: 2009-4-11 9:03:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[H_HZ]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[H_HZ]
GO
/****** Object: Table [dbo].[H_ICD] Script Date: 2009-4-11 9:03:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[H_ICD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[H_ICD]
GO
后面还有很多很多.......
[此贴子已经被作者于2009-4-11 10:41:31编辑过]