当前位置:数据库 > SQLServer >>

生成按日期编码的编码格式 SQL语句

生成按日期编码的编码格式 sql语句
sqlparameter[] parameters = {
   
                    new sqlparameter("@dateday", sqldbtype.nvarchar,10)
                 
                    };
       
            parameters[0].value = system.datetime.now.tostring("yymmdd");
            string strsql = @"declare @id nvarchar(20)
                            select @id=isnull(max(cast(right(id,5) as int)),0)+1
                            from chicrwh.storehouse.inwarehouse with(nolock)
                            where charindex(@dateday, id)=2
                           set @id='b'+@dateday+right('0000'+@id,5) select @id";

补充:数据库,Mssql
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,