create proc Add_p_OrdersId
@p_OrdersId varchar(20) output
as
select @p_OrdersId='po060000'+convert(varchar(3),cast(right(max(right(p_OrdersId,3)),3)as int)+1) from p_Orders
print @p_OrdersId
go
--自动增长部门编号
create function dbo.DepIdIden()
returns varchar(20)
as
begin
declare @DeptmentId varchar(20)
if exists(select DeptID from dbo.Dept)
begin
select @DeptmentId='DepNo000'+convert(varchar(4),cast(right(max(right(DeptID,4)),4) as int)+1) from dbo.Dept
end
else
begin
select @DeptmentId='DepNo0001'
end
return @DeptmentId
end
@p_OrdersId varchar(20) output
as
select @p_OrdersId='po060000'+convert(varchar(3),cast(right(max(right(p_OrdersId,3)),3)as int)+1) from p_Orders
print @p_OrdersId
go
--自动增长部门编号
create function dbo.DepIdIden()
returns varchar(20)
as
begin
declare @DeptmentId varchar(20)
if exists(select DeptID from dbo.Dept)
begin
select @DeptmentId='DepNo000'+convert(varchar(4),cast(right(max(right(DeptID,4)),4) as int)+1) from dbo.Dept
end
else
begin
select @DeptmentId='DepNo0001'
end
return @DeptmentId
end
浙公网安备 33010602011771号