存储过程的程序设计.docx

上传人:b****5 文档编号:30019102 上传时间:2023-08-04 格式:DOCX 页数:108 大小:26.67KB
下载 相关 举报
存储过程的程序设计.docx_第1页
第1页 / 共108页
存储过程的程序设计.docx_第2页
第2页 / 共108页
存储过程的程序设计.docx_第3页
第3页 / 共108页
存储过程的程序设计.docx_第4页
第4页 / 共108页
存储过程的程序设计.docx_第5页
第5页 / 共108页
点击查看更多>>
下载资源
资源描述

存储过程的程序设计.docx

《存储过程的程序设计.docx》由会员分享,可在线阅读,更多相关《存储过程的程序设计.docx(108页珍藏版)》请在冰豆网上搜索。

存储过程的程序设计.docx

存储过程的程序设计

数据库地存储过程地程序设计(68个)

1、登陆管理员

CREATEproceduremngdebarkation

@d_namevarchar(50),用户名

@p_wordvarchar(50)密码

As

Declare@numint

Set@num=(selectcount(*)frommnginfo

wheremngname=@d_nameandmngpsw=@p_word)

begin

if@num=1

print'您登陆成功!

'

else

print'您不能登陆!

'

end

GO

2、添加管理员

CREATEprocedureadding_mng

@d_namevarchar(50),用户

@p_wordvarchar(50),密码

@poweridvarchar(10),付给地权限

@resultchar

(1)output返回值

As

declare@iint

declare@namevarchar(20)

Declarecurlistcursorlocalscrollfor(

Selectmngname

frommnginfo)

opencurlist

set@i=@@cursor_rows

fetchfirstfromcurlistinto@name

while@i>=1

begin

if@name=@d_name

begin

set@result='0'

break

end

else

set@result='1'

fetchnextfromcurlistinto@name

set@i=@i-1

end

closecurlist

if@result='1'

Insertintomnginfovalues(@d_name,@p_word,@powerid)

GO

3、修改管理员地密码和权限

CREATEprocedureupdate_mng

@d_namevarchar(50),用户名

@p_word1varchar(50),旧密码

@p_wordvarchar(50),新地密码

@poweridvarchar(10)新地权限

as

declare@iint

set@i=(selectcount(*)frommnginfowheremngname=@d_nameandp_word=@p_word1)

begin

if@i>0

begin

updatemnginfo

Setmngpsw=@p_word,powerID=@powerid

wheremngname=@d_name

print'您修改信息成功!

'

end

Else

print'您不能修改用户名!

'

end

GO

4、删除管理员

CREATEprocdelete_mng

@d_namevarchar(50)用户名

as

deletefrommnginfo

wheremngname=@d_name

GO

5、查找权限

CreateprocedureManage_power_selete1/*查找权限号*/

@mngNamevarchar(50)用户名

As

Selectadding,modif,delet,brower,selecfromlegalpowerLEFTOUTERJOINmnginfo

ONlegalpower.powerID=mnginfo.powerID

wheremngName=@mngName

GO

6、登陆客户

Createprocedurecustomer_debarkation

@customerIDvarchar(20)客户端ID

@d_namevarchar(50)用户名

@p_wordvarchar(50)密码

As

Set@num=(selectcount(*)formcustomerinfo)

wherecustomerID=@customerID

username=@d_name

andpasskey=@p_word

begin

if@num=1

print'您登陆成功!

'

else

print'您不能登陆!

'

end

go

7、增加客户

CREATEprocedureadding_cust

@customerIDvarchar(20),客户端ID

@d_namevarchar(50),用户名

@p_wordvarchar(50),密码

@powerint权限

As

declare@iint

set@i=(selectcount(*)fromcustomerinfo

whereusername=@d_name)

begin

if@i=0

begin

Insertintocustomerinfo

Values(@customerID,@d_name,@p_word,@power)

print'您添加成功!

'

end

else

print'您不能添加用户!

'

end

GO

8、修改客户客户ID、密码和权限

CREATEprocedureupdate_cust

@customerIDvarchar(20),客户端ID

@d_namevarchar(50),用户名

@p_word1varchar(50),旧密码

@p_wordvarchar(50),新密码

@powerint权限

as

declare@iint

set@i=(selectcount(*)fromcustomerinfowhereUsername=@d_nameand

p_word=@p_word1)

begin

if@i>0

begin

updatecustomerinfo

Setpasskey=@p_word,power=@powercustomerID=@customerID

whereUsername=@d_name

print'您修改信息成功!

'

End

Else

begin

print'您不能修改用户名!

'

end

end

GO

9、删除客户

CREATEproceduredelete_cust

@d_namevarchar(50)用户名

as

deletefromcustomerinfo

whereusername=@d_name

GO

----------------------------------------------------------------------------------------------------------------------

10、添加试卷分类

CREATEprocedureadd_testinfo

@ClassifyIDvarchar(20),分类ID

@testnamevarchar(50),分类名称

@explainvarchar(50),说明

@builuptimedatetime,建立时间

@superiorIDvarchar(20),上级ID

@pathvarchar(50)路径

as

declare@iint

set@i=(selectcount(*)fromtestpaperinfo

whereclassifyID=@classifyID)

begin

if@i=0

begin

InsertintotestpaperInfo

Values(@ClassifyID,@testname,@explain,@builuptime,@superiorID,@path)

print'您添加成功!

!

'

end

Else

Print'你不能输入试卷分类!

'

End

11、修改试卷分类

GOCREATEprocupdate_testinfo

@ClassifyIDvarchar(20),分类ID

@testnamevarchar(50),分类名称

@explainvarchar(50),说明

@builuptimedatetime,建立时间

@superiorIDvarchar(20),上级ID

@pathvarchar(50)路径

as

declare@iint

set@i=(selectcount(*)fromtestpaperInfowhereclassifyID=@ClassifyID)

begin

if@i=0

print'您不能修改试卷分类!

'

else

begin

updatetestpaperInfo

settestname=@testname,explain=@explain,builuptime=@builuptime,superiorid=@superiorID,

path=@path

whereclassifyID=@ClassifyID

print'您修改成功'

end

end

GO

12、添加试卷分类

CREATEprocedureadd_examinfo

@ClassifyIDvarchar(20),分类ID

@testnamevarchar(50),分类名称

@explainvarchar(50),说明

@builuptimedatetime,建立时间

@superiorIDvarchar(20),上级ID

@pathvarchar(50)路径

as

declare@iint

set@i=(selectcount(*)fromexampaperinfo

whereclassifyID=@classifyID)

begin

if@i=0

begin

InsertintoexampaperInfo

Values(@ClassifyID,@testname,@explain,@builuptime,@superiorID,@path)

print'您添加成功!

!

'

end

Else

Print'你不能输入试卷分类!

'

end

GO

13、修改试卷分类

CREATEprocupdate_examInfo

@ClassifyIDvarchar(20),分类ID

@testnamevarchar(50),分类名称

@explainvarchar(50),说明

@builuptimedatetime,建立时间

@superiorIDvarchar(20),上级ID

@pathvarchar(50)路径

as

declare@iint

set@i=(selectcount(*)fromexampaperInfowhereclassifyID=@ClassifyID)

begin

if(@i=0)

print'您不能修改试卷分类!

'

else

begin

updateexampaperInfo

setexamname=@examname,explain=@explain,builuptime=@builuptime,superiorid=@superiorID,

path=@path

whereclassifyID=@ClassifyID

print'您修改成功!

!

'

end

end

return

GO

14、增加题型(如果你需要地题型不在我们给提供不范围之内,你可以自己添加题型)

createprocedureadd_comptype

@topictypevarchar(20),题型

@prototypeint对应原型

As

Declare@iint

Set@i=(selectcount(*)fromcomptypewheretopictype=@topictype)

begin

If@i=0

begin

Insertintocomptype

Values(@topictype,@prototype)

print'您添加题型成功!

!

'

end

Else

Print'您不能添加题型!

'

End

GO

15、修改题型(如果你认为那个题型用词不当可以修改,只有管理员有这个权限)

CREATEprocedureupdate_comptype

@topictypevarchar(20),原题型

@topictype1varchar(20),修改地题型

@prototypeint对应原型

as

declare@iint

set@i=(selecttypeidfromcomptypewheretopictype=@topictype)

begin

if@i>0

begin

updatecomptype

Settopictype=@topictype1,prototype=@prototype

wheretypeid=@i

print'您修改信息成功!

'

End

Else

begin

print'您不能修改用户名!

'

end

end

GO

16、删除题型(误添加,只能删除自己添加地)

createproceduredelete_comptype

@topictypevarchar(50)题型

as

deletefromcomptype

wheretopictype=@topictype

GO

17、添加附加文件地址

CREATEprocedureadd_manyfilesave

@file_addreseIDvarchar(20),附加文件地址ID

@ShowAddressvarchar(50),显示地址

@DirManConvarchar(50),直接显示内容

@Documenttypevarchar(50),文件类型

@pictureimage,图片

@Explainvarchar(50)说明

as

declare@file_countint

set@file_count=(selectcount(*)frommanyfile_savewherefile_addreseID=@file_addreseID)

begin

if(@file_count=0)

begin

Insertintomanyfile_save

Values(@file_addreseID,@ShowAddress,@DirManCon,@Documenttype,@picture,@Explain)

print'添加成功!

!

'

end

else

print'您不能添加多文件!

'

end

GO

18、修改附加文件地址

CREATEprocedureupdate_manyfilesave

@file_addreseIDvarchar(20),附加文件地址ID

@ShowAddressvarchar(50),显示地址

@DirManConvarchar(50),直接显示内容

@Documenttypevarchar(50),文件类型

@pictureimage,图片

@Explainvarchar(50)说明

as

declare@file_countint

set@file_count=(selectcount(*)frommanyfile_savewherefile_addreseID=@file_addreseID)

begin

if(@file_count>0)

begin

updatemanyfile_save

setShowAddress=@ShowAddress,DirManCon=@DirManCon,Documenttype=@Documenttype,picture=@picture,Explain=@Explain

wherefile_addreseID=@file_addreseID

print'您修改信息成功!

'

end

Else

print'您不能修改!

'

end

GO

19、添加答案表

CREATEprocedureadd_answer

@answerIDvarchar(20),答案ID

@Answer1varchar(50),答案

@rightanswervarchar(50)正确答案

As

Declare@Iint

Set@I=(selectcount(*)fromanswerwhereanswerID=@answerID)

begin

If@I=0

Insertintoanswer

Values(@answerID,@Answer1,@rightanswer)

Else

Print'不能添加答案'

End

GO

20、修改答案表

CREATEprocedureupdate_answer

@answerIDvarchar(20),答案ID

@Answer1varchar(50),答案

@rightanswervarchar(50)正确答案

As

Declare@Iint

Set@I=(selectcount(*)fromanswerwhereanswerID=@answerID)

begin

If@I>0

begin

updateanswer

setAnswer1=@Answer1,rightanswer=@rightanswer

WhereanswerID=@answerID

print'您修改信息成功!

'

end

Else

print'您不能修改!

'

end

GO

21、增加所属知识点表

CREATEprocedureadd_Belongkonwpoint

@belong_konwpointIDvarchar(20),所属知识点ID

@konwpoint1varchar(50),知识点

@powerhreal权限

as

Declare@Iint

Set@I=(selectcount(*)fromBelong_konwpoint

wherebelong_konwpointID=@belong_konwpointID)

begin

If@I=0

begin

InsertintoBelong_konwpoint

Values(@belong_konwpointID,@konwpoint1,@powerh)

print'您添加信息成功!

!

'

End

Else

Print'您不能添加所属知识点'

End

GO

22、修改所属知识点

CREATEprocedureupdate_Belongkonwpoint

@belong_konwpointIDvarchar(20),所属知识点ID

@konwpoint1varchar(50),知识点

@powerhreal权限

as

Declare@Iint

Set@I=(selectcount(*)fromBelong_konwpoint

wherebelong_konwpointID=@belong_konwpointID)

begin

If@I>0

begin

updateBelong_konwpoint

setkonwpoint1=@konwpoint1,powerh=@powerh

wherebelong_konwpointID=@belong_konwpointID

print'您修改信息成功!

!

'

End

Else

Print'您不能修改'

End

GO

23、增加认知分类(如果一道题属于两种认知分类,例如,1题即属于综合也属于评价,但在认知分类表中不存在这样地情况,你可以添加)

CREATEprocedureadd_recogclassify

@recogclassify1varchar(50)认知分类

as

declare@iint

Set@i=(selectcount(*)fromrecogclassify

whereRecogclassify1=@recogclassify1)

begin

If@i=0

begin

Insertintorecogclassify

Values(@recogclassify1)

Print'您添加成功!

!

'

End

Else

Print'您不能添加认知分类'

End

GO

24、修改认知分类(只能修改组卷添加地)

CREATEprocedureupdate_recogclassify

@recogclassifyidint,认知分类ID

@recogclassify1varchar(50)认知分类

as

declare@iint

Set@i=(selectrecogclassifyidfromrecogclassify

whereRecogclassifyid=@recogclassifyid)

begin

if@i>0

begin

updaterecogclassify

setrecogclassify1=@recogclassify1

whereRecogclassifyid=@i

print'您修改信息成功!

!

'

End

Else

Print'您不能修改'

End

GO

25、添加试卷(外面只调用这一个存储过程来添加试卷所有地属性)

CREATEprocedureadd_topicment

@classifyIDvarchar(20),分类ID

@Trnamevarchar(50),题目录入人

@customerIDvarchar(20),客户端ID

@topicIDvarchar(20),题目ID

@typeIDint,题型ID

@topicvarchar(50),题干

@file_addreseIDvarchar(20),附加文件地址ID

@ShowAddressvarchar(50),显示地址

@DirManConvarchar(50),直接显示内容

@Docum

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 笔试

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1