用P0001表中的id字段如何? [英] id field in a table with P0001 how ?
本文介绍了用P0001表中的id字段如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
please help in this query.
create table tbl_residential
(
id varchar(max) primary key not null 'R00'+identity(1,1),
categoryid varchar(10),
title varchar(max),
images varchar(max),
pdiscription varchar(max),
contact_no bigint,
city varchar(30),
location varchar(30),
property_type varchar(50),
rate_persquarefit float,
Layout_Plan varchar(max),
Floor_Plan varchar(max),
Unit_Plan varchar(max),
)
推荐答案
我会这样做:
I''d do this instead:
create table [cpqaAnswers].[cpqa].[tblPZResidential]
(
--id varchar(max) primary key not null ''R00'' + identity(1,1),
id [int]identity(1,1) primary key NOT NULL,
idx varchar(max),
categoryid varchar(10),
title varchar(max),
images varchar(max),
pdiscription varchar(max),
contact_no bigint,
city varchar(30),
location varchar(30),
property_type varchar(50),
rate_persquarefit float,
Layout_Plan varchar(max),
Floor_Plan varchar(max),
Unit_Plan varchar(max),
)
然后,当需要用数据填充表时,执行VALUES或INSERT那个''R00''前缀为'''R00''+ CAST([id] As varchar)在SELECT中的适当位置
Then when it comes time to populate the table with data you perform a VALUES or INSERT of that ''R00'' prefixing as "''R00'' + CAST([id] As varchar)" in the appropriate place in the SELECT
看我之前的帖子:生成id,如Cust001 [ ^ ]
See my previous post: Generate the id Like ''Cust001''[^]
这篇关于用P0001表中的id字段如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文