我有一个.sql文件,该怎么导入SQL SERVER数据库?内容是
CREATE TABLE [Info] (
[ID] [bigint] IDENTITY (1, 1) NOT NULL ,
[areaId] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[townId] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[schoolId] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[classroomId] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[classroomName] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[description] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
[seats] [int] NULL ,
[hasBeenExported] [tinyint] NULL
)
GO
/* 修改数据表 userInfo_student */
alter table userInfo_student
add item_multiSel [real] NULL
alter table userInfo_student
add item_descript [real] NULL
alter table userInfo_student
add item_discuss [real] NULL
alter table userInfo_student
add icc_item_multiSel [tinyint] NULL
alter table userInfo_student
add icc_item_descript [tinyint] NULL
alter table userInfo_student
add icc_item_discuss [tinyint] NULL
GO
/* 存储过程 */
CREATE proc sp_saveAnswer_multisel
@userId varchar(50),
@paperId bigint,
@itemId bigint,
@itemtype varchar(50),
@answer varchar(50),
@rt tinyint output
as
declare @reactCount int
select @rt =0
select @reactCount = (select count(*) as c from stuReactDetail where userId = @userId and paperId = @paperId and itemId = @itemId and itemType = @itemtype)
if (@reactCount > 0)
begin
update stuReactDetail set
stuReact = @answer
where
userId = @userId and paperId = @paperId and
itemId = @itemId and itemType = @itemtype
select @rt = 1
end
else
begin
insert into stuReactDetail (userId, paperId, itemId, itemType, stuReact) values
(@userId, @paperId, @itemId, @itemtype, @answer)
select @rt = 2
-- if (@itemtype = 'item_singlesel')
update userinfo_student set icc_item_singlesel = icc_item_singlesel + 1 where cardId = @userId
-- if (@itemtype = 'item_judge')
-- update userinfo_student set icc_item_judge = icc_item_judge + 1 where cardId = @userId
end
GO