在SQL中以不同格式自动创建ID [英] autocreate id in different format in sql

查看:150
本文介绍了在SQL中以不同格式自动创建ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有名为myID的字段的表.我将数据类型设置为"uniqueidentifier",它将自动生成myID(1,2,3,4,5 ....).是否可以以myID(v1,v2,v3 ...)等不同格式创建myID?
?我正在使用SQL Server 2005,并且是从vs 2008创建表而不是Enterprise Manager.

I created a table with a field called myID. I set the data type as "uniqueidentifier" and it will auto generate and myID(1,2,3,4,5....). Is it possible that myID can be create in different format like myID(v1,v2,v3...)
? I''m working with SQL Server 2005 and I''m creating the table from vs 2008 not Enterprise Manager.

推荐答案

是的.保存时带有数字的字符串..
例如:
字符串strFormat = V;
字符串storeFormat = strFormat +您的自动增量值;
Yes it is..just simply concatenate your string with numbers while saving..
e.g:
string strFormat = V;
string storeFormat = strFormat + your auto increment value;


这篇关于在SQL中以不同格式自动创建ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆