存储过程生成单据号
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[PRO_TICKETNUMBER] ( @tablename varchar(20), --表名 @outnumber varchar(20) output --返回值 ) AS begin DECLARE @SIGNNAME NVARCHAR(20) DECLARE @NUMBER NVARCHAR(20) DECLARE @TODAY NVARCHAR(20) DECLARE @YESTODAY VARCHAR(20) DECLARE @DAYSTR VARCHAR(20) DECLARE @NUM INT DECLARE @sql NVARCHAR(200) set @SIGNNAME = (select SIGN from T_TICKNUMBER where TABELNAME=@tablename) set @NUMBER = (select NUMBER from T_TICKNUMBER where TABELNAME=@tablename) if @SIGNNAME is null or @NUMBER is null set @outnumber='-1'; else begin set @YESTODAY