
sql语句中addbutch与带参数的有什么区别
1个回答
展开全部
就是交互的功能吧,带参数的功能更大,要用面多一些,实现了交互的功能呢,现在我使用一个存储过程来说明问题吧。这里用的数据库pubs是sql自带的数据库,lz可以试试的。
不带参数的,查询功能单一
use pubs go
create procedure pub_proc1
as select pub_name,type,title
from titles,publishers
where titles.pub_id=publishers.pub_id
order by pub_name,type
带参数的为,可以根据参数的选择,调用,查询自己想要的结果,存储过程应用多
use pubs go
create procedure pub_proc2(@ type char(12))
as select pub_name,type,title
from titles,publishers
where titles.pub_id=publishers.pub_id and type like @type
order by pub_name,type
调用这个存储过程
declare @t char(12)
set @t='business' 这一行可以根据自己的需求选择查询,这里我选择查询类型为商业的进行查询
exec pub_proc2 @t
不带参数的,查询功能单一
use pubs go
create procedure pub_proc1
as select pub_name,type,title
from titles,publishers
where titles.pub_id=publishers.pub_id
order by pub_name,type
带参数的为,可以根据参数的选择,调用,查询自己想要的结果,存储过程应用多
use pubs go
create procedure pub_proc2(@ type char(12))
as select pub_name,type,title
from titles,publishers
where titles.pub_id=publishers.pub_id and type like @type
order by pub_name,type
调用这个存储过程
declare @t char(12)
set @t='business' 这一行可以根据自己的需求选择查询,这里我选择查询类型为商业的进行查询
exec pub_proc2 @t

2024-11-19 广告
这方面更多更全面的信息其实可以找下大雅新。深圳市大雅新科技有限公司从事KVM延长器,DVI延长器,USB延长器,键盘鼠标延长器,双绞线视频传输器,VGA视频双绞线传输器,VGA延长器,VGA视频延长器,DVI KVM 切换器等,优质供应商,...
点击进入详情页
本回答由大雅新科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询