国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

SQLServer中一個多用戶自動生成編號的過程

2024-07-21 02:11:59
字體:
來源:轉載
供稿:網友

商業源碼熱門下載www.html.org.cn

sqlserver中一個多用戶自動生成編號的過程
if not exists (select * from dbo.sysobjects where id = object_id(n'[indextable]') and objectproperty(id, n'isusertable') = 1)
create table indextable(ex char(20), num integer)

go

create procedure setindex @ex char(20),@result char(30) output,@fmt integer
as
  declare @num char(10)
  set nocount on
  if not exists(select num from indextable where [email protected] )
   insert into indextable values(@ex,1)
  else
   update indextable set num=num+1 where [email protected]
  select @num=cast(num as char(10)) from indextable where [email protected]
  select @num=space(@fmt-len(@num))[email protected]
  select @num=replace(@num,' ','0')
  select @result=rtrim(@ex)+rtrim(@num)
  set nocount off
go

--------

在delphi中調用

procedure tform1.button1click(sender: tobject);
begin
  storedproc1.parambyname('@ex').asstring:='user';
  storedproc1.parambyname('@fmt').asinteger:=3;
  storedproc1.execproc;
  showmessage(storedproc1.parambyname('@result').value)
end;

-----------
參數@ex表示前綴,@fmt表示數字長度,@result表示返回數據
返回user001

 

 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 莱西市| 乌鲁木齐县| 托里县| 松江区| 安图县| 清丰县| 镇安县| 莱西市| 盐津县| 玛沁县| 界首市| 新建县| 任丘市| 利川市| 封丘县| 龙口市| 桃园市| 醴陵市| 青川县| 宜兰市| 禹城市| 若羌县| 德兴市| 吴忠市| 如皋市| 忻州市| 大洼县| 金寨县| 会东县| 陕西省| 涟水县| 石景山区| 中阳县| 三河市| 漠河县| 息烽县| 六盘水市| 乌兰浩特市| 商南县| 普兰县| 福海县|