用(MA1,MA2,MA3)等字符递增1 [英] increment by 1 with character like (MA1, MA2, MA3)
本文介绍了用(MA1,MA2,MA3)等字符递增1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望用(MA1,MA2,MA3)等字符增加1
在注册表中我想要这个
memebr id必须看起来像这种格式
member_id
==========
MA1
MA2
MA3
MA4
...
...
我该怎么做?
Hi,
I Want to increment by 1 with character like (MA1, MA2, MA3)
in register table i want this
memebr id have to look like this format
member_id
==========
MA1
MA2
MA3
MA4
...
...
how can i do this ??
推荐答案
我将使用INT标识字段生成数字,然后为用户名/标识事物添加计算列:
I would use an INT Identity field to generate the numbers, and then add a computed column for the username / identity thing:
CREATE TABLE [dbo].[MyTable](
[Id] [int] IDENTITY(1,1) NOT NULL,
[member_id] AS ('MA'+CONVERT([varchar](6),[Id],0)),
[Name] [nchar](10) NOT NULL
) ON [PRIMARY]
试试这个链接 http://stackoverflow.com/questions/19452814/generate-increment-number-in-select-statement-using-sql-server [ ^ ]
这篇关于用(MA1,MA2,MA3)等字符递增1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文