Sql Server 2000 上部署 Sql Server 2005 脚本

最近在做项目时遇到这样的情况:

    开发环境的数据库是Sql Server 2005,服务器的数据库是Sql Server 2000,因此在部署过程中遇到一些问题,脚本和问题如下:

     1. 脚本:

   

View Code
 1 SET ANSI_NULLS ON
 2 GO
 3 SET QUOTED_IDENTIFIER ON
 4 GO
 5 CREATE TABLE [dbo].[Test](
 6     [CourseID] [int] IDENTITY(1,1) NOT NULL,
 7     [TrainingID] [int] NOT NULL,
 8     [MECategory] [tinyint] NULL,
 9     [UserCount] [int] NOT NULL CONSTRAINT [DF_Course_UserCount]  DEFAULT ((0)),
10     [Status] [tinyint] NOT NULL CONSTRAINT [DF_Course_Status]  DEFAULT ((0)),
11  CONSTRAINT [PK_Course] PRIMARY KEY CLUSTERED
12 (
13     [CourseID] ASC
14 )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
15 ) ON [PRIMARY]
16 
17 GO
18 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0=ME,1=EA' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Test', @level2type=N'COLUMN',@level2name=N'MECategory'
19 GO

 

  2. 问题:

   a. Incorrect syntax near “WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]”

   b. Could not find stored procedure 'sys.sp_addextendedproperty'

   c. An invalid parameter or option was specified for procedure 'sp_addextendedproperty'

 

  3.解决方法:

   a. 没找到什么好的解决方法,直接删了

   b. 将 'sys.sp_addextendedproperty' 改为 'sp_addextendedproperty'

   c. 将参数 @level0type=N'SCHEMA' 改为 @level0type=N'USER'

    

  以供后用,欢迎各位大牛指正。

posted @ 2012-04-11 17:02  忆起  阅读(403)  评论(0编辑  收藏  举报