作者CyFe (暑假到了)
看板Database
标题Re: [SQL]如何将查询出来的结果,多加一栏流水号?
时间Sun Jul 23 23:14:57 2006
※ 引述《fumizuki (蒙面加菲狮)》之铭言:
: 使用 SQL 查询语法:
: /* 建立一个有自动编号的暂存资料表 */
: create table temp_table
: (
: [No] int identity(1,1) not null,
: [Name] varchar(16) not null,
: [Score] int null constraint DF_temp_table default(0),
: primary key clustered
: (
: [Score]
: ) on [primary]
: ) on [primary]
: GO
伺服器: 讯息 8111,层级 16,状态 1,行 1
无法在资料表 'temp_table' 之可设为 Null 的资料行上定义 PRIMARY KEY 条件约束。
伺服器: 讯息 1750,层级 16,状态 1,行 1
无法建立条件约束。请查看先前的错误。
依照fumizuki大大的作法
结果出现以上的错误讯息...
能请教大家这是哪里发生错误了
因为刚学SQL 很多地方都不懂~@@
: /* 将资料复制到暂存资料表 */
: insert into temp_table select * from [你的资料表名称]
这里的指令是一整行吗
insert into之後不是都接Values
还是说这里是分成两行指令
也就是
insert into temp_table
select * from [你的资料表名称]
那这样insert的部分 values是该填什麽 = =??
: /* 取出含有流水号的资料 */
: select * from temp_table
问题很多
希望有高手能帮小弟解答~~><
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.224.85.18