——種子表
create table SEED (BM varchar(
BH varchar(
constraint PK_SEED primary key(BM)
)
go
——向種子中表添加記錄
insert into SEED (BM
go
——為參數傳遞來的某個表自動生成編號
if exists (select * from sysobjects where name=
drop procedure proc_getbh
go
create procedure proc_getbh @BM varchar(
as
declare @BH char(
declare @TODAY char(
begin
select @TODAY=convert(char(
select @BH=BH from SEED where BM=@BM
if @BH is null or left(@BH
begin
select @BH=@TODAY+
end
select @BH=left(@BH
update SEED set BH=@BH where BM=@BM
select @BH AS BH
end
set rs=conn
這樣
From:http://tw.wingwit.com/Article/program/net/201311/13557.html