W wenjie Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #1 什么方法建立表的唯一标识(ID)最好? 数据库用SQL2000 请举例.
A antic_ant Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #2 用sqlserver 的内置函数 newid() 生成一个guid
W wenjie Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #3 我需要生成的ID 就像'1,2,3,4,5,6,7,8,9.......' 最好是连续的
Q QuickSilver Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #4 Select identity(int,1,1) as tmpid,field1,field2,.... Into #temp From table1 order by ... go Select tmpid,field1,field2,... From #temp go
Select identity(int,1,1) as tmpid,field1,field2,.... Into #temp From table1 order by ... go Select tmpid,field1,field2,... From #temp go
W wenjie Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #5 上面的兄弟可以不可以说的清楚点,小弟是菜鸟!!!!!!
U ugvanxk Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #8 create table tablename (id integer identity(1,1) primary key, ..... )
S sunroll Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #10 建立一个自增长的字段,格式如下: fieldname integer identity(1,1)
S szloner Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-28 #12 sqlserver有字段类型是ID的,它可完成你的要求
S soonstar Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-21 #13 就使用自動加一的字段類型吧,這樣才體現出sql server 的好處來,不知你有沒用過oracle, oracle沒有這樣的字段類型,必須自己建 sequence,煩得很
陈 陈晨 Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-22 #14 建立一个整型字段然后再设计的时候,把标识属性设为是增量设为1 设计时期可以看到这些属性仔细找找
G goodfriend1 Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-26 #15 create table Table_Name ( CNO_Key numeric identity, //此為唯一自動加1ID Field1_name varchar null , YNO smallint null , constraint PK_POSITION primary key (CNO) )
create table Table_Name ( CNO_Key numeric identity, //此為唯一自動加1ID Field1_name varchar null , YNO smallint null , constraint PK_POSITION primary key (CNO) )
S soonstar Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-27 #18 還要如何保证删除记录后自增量字段的连续性?好象不可能吧。還要看是刪除的是最後 一條記錄還是中間的記錄了。如果要保証連續性,那就不能使用自增長字段了,隻能自 己處理了