Home > Database > Mysql Tutorial > sqlserver 存储过程和自定义函数

sqlserver 存储过程和自定义函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:07:13
Original
1496 people have browsed it

sqlserver 存储 过程 create procedure proc_menu ?@menuId varchar(50), ?@menuTotal int output as begin ?? set nocount on; ?? select @menuTotal=count(*) from dbo.Lov_menu t where t.menu_id=@menuId; end sqlserver 自 定义 函数 create function S

sqlserver 存储过程

create procedure proc_menu
?@menuId varchar(50),
?@menuTotal int output
as
begin
?? set nocount on;
?? select @menuTotal=count(*) from dbo.Lov_menu t where t.menu_id=@menuId;
end

sqlserver 自定义函数

create function Sector_Name(@sctId varchar(10))
returns varchar(50)
as
begin
declare @ccode varchar(50)
declare @name? varchar(50)
declare @pid?? varchar(10)
declare @sctpid varchar(10)
declare @spid?? varchar(10)

select @pid=SCT_PID? from SECTOR where SCT_ID=@sctId
if(@pid=1)
?? set @ccode=(select SCT_NAM from SECTOR where SCT_ID=@sctId)
else if(@pid=0)
?? set @ccode=(select SCT_NAM from SECTOR where SCT_ID=@sctId)
else
begin
?? select @name? =SCT_NAM? from SECTOR where SCT_ID=@sctId
?? select @sctpid=SCT_PID? from SECTOR where SCT_ID=@pid
?? if (@sctpid=1)
? set @ccode =(select SCT_NAM? from SECTOR where SCT_ID = @pid )+'-'+@name
?? else
??? begin
??? while @sctpid 1
?? begin
??? select @spid=SCT_PID? from SECTOR where SCT_ID = @sctpid
??? set @ccode =(select SCT_NAM? from SECTOR where SCT_ID = @sctpid )+'-'+@name
??? set @sctpid=@spid
??? if @sctpid=1
????break
?? end?
?end
end
return @ccode
end

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Problem with tp6 connecting to sqlserver database
From 1970-01-01 08:00:00
0
0
0
Unable to connect to SQL Server in Laravel
From 1970-01-01 08:00:00
0
0
0
Methods of parsing MYD, MYI, and FRM files
From 1970-01-01 08:00:00
0
0
0
SQLSTATE: User login failed
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template