Home >Database >Mysql Tutorial >生成按日期编码的编码格式 SQL语句

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

WBOY
WBOYOriginal
2016-06-07 17:48:031419browse

生成按日期编码的编码格式 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";

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn