0

从数据库生成脚本时出现问题。这很简单,但我不知道如何解决它。存储过程对象在表对象之前创建。这是所有脚本:

 USE [ComicSellerManagement]
GO
/****** Object:  StoredProcedure [dbo].[sp_AddingComicGenre]    Script Date: 3/3/2016 3:39:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_AddingComicGenre]
@name nvarchar(50),
@info nvarchar(max)
as begin
    insert into COMIC_GENRE values (@name, @info)
end
GO
/****** Object:  StoredProcedure [dbo].[sp_DeletingComicGenre]    Script Date: 3/3/2016 3:39:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_DeletingComicGenre]
@id int
as begin
    delete from COMIC_GENRE where ID = @id
end
GO
/****** Object:  StoredProcedure [dbo].[sp_LoadingComicGenre]    Script Date: 3/3/2016 3:39:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_LoadingComicGenre]
as begin
    select * from COMIC_GENRE
end
GO
/****** Object:  StoredProcedure [dbo].[sp_UpdatingComicGenre]    Script Date: 3/3/2016 3:39:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_UpdatingComicGenre]
@id int,
@name nvarchar(50),
@info nvarchar(max)
as begin
    update COMIC_GENRE
    set GenreName = @name, Info = @info
    where ID = @id
end
GO
/****** Object:  Table [dbo].[COMIC]    Script Date: 3/3/2016 3:39:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[COMIC](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Name] [nvarchar](50) NULL,
    [Genre] [int] NULL,
    [PublishYear] [int] NULL,
    [Publisher] [int] NULL,
    [Actor] [nvarchar](50) NULL,
    [Price] [money] NULL,
 CONSTRAINT [PK_COMIC] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[COMIC_GENRE]    Script Date: 3/3/2016 3:39:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[COMIC_GENRE](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [GenreName] [nvarchar](50) NULL,
    [Info] [nvarchar](255) NULL,
 CONSTRAINT [PK_COMIC_GENRE] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[COMIC_PUBLISHER]    Script Date: 3/3/2016 3:39:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[COMIC_PUBLISHER](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [PublisherName] [nvarchar](50) NULL,
    [Adress] [nvarchar](max) NULL,
    [PhoneContact] [char](11) NULL,
    [Discount] [float] NULL,
 CONSTRAINT [PK_COMIC_PUBLISHER] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[COMIC_PUBLISHER] ADD  CONSTRAINT [DF_COMIC_PUBLISHER_Discount]  DEFAULT ((0)) FOR [Discount]
GO
ALTER TABLE [dbo].[COMIC]  WITH CHECK ADD  CONSTRAINT [FK_COMIC_COMIC_GENRE] FOREIGN KEY([Genre])
REFERENCES [dbo].[COMIC_GENRE] ([ID])
GO
ALTER TABLE [dbo].[COMIC] CHECK CONSTRAINT [FK_COMIC_COMIC_GENRE]
GO
ALTER TABLE [dbo].[COMIC]  WITH CHECK ADD  CONSTRAINT [FK_COMIC_COMIC_PUBLISHER] FOREIGN KEY([Publisher])
REFERENCES [dbo].[COMIC_PUBLISHER] ([ID])
GO
ALTER TABLE [dbo].[COMIC] CHECK CONSTRAINT [FK_COMIC_COMIC_PUBLISHER]
GO

我无法在任何计算机上运行此 sql 文件来恢复我的数据库。有什么建议可以让我解决这个问题吗?

4

1 回答 1

2
  1. 生成脚本时尝试更改此选项 -

在此处输入图像描述

  1. 另一种解决方案尝试使用dbForge模式比较

  2. 使用备份

于 2016-03-03T08:53:00.233 回答