生成按日期编码的编码格式SQL语句
时间:2021-07-01 10:21:17
帮助过:40人阅读
生成按日期编码的编码格式 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() select @id";