Home > Database > Mysql Tutorial > body text

SQL流水帐号的生成

WBOY
Release: 2016-06-07 17:46:49
Original
1196 people have browsed it
1 --下面的代码生成长度为8的编号,编号以BH开头,其余6位为流水号。
 2 --得到新编号的函数
 3 CREATE FUNCTION f_NextBH()
 4 RETURNS char(8)
 5 AS
 6 BEGIN
 7     RETURN(SELECT ''BH''+RIGHT(1000001+ISNULL(RIGHT(MAX(BH),6),0),6FROM
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template