在特定位置插入记录 [英] Insert a record in a particular place

查看:75
本文介绍了在特定位置插入记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表名是HH表

它有两列''hhno''和hhname''

HH tabele

hhno hhname

100 suresh

101 baba

103 ram

i想要插入一条记录(102,钱德拉)在HH表之间

(101,baba)和(103,ram)。

如何插入它们请帮助,谢谢

i have a table name is HH table
it has two columns ''hhno'' and hhname''
HH tabele
hhno hhname
100 suresh
101 baba
103 ram
i want to insert a one record(102 , chandra) in HH table between
(101,baba) and( 103 ,ram).
how can i insert them please help ,me thanks

推荐答案

surya(su*******@gmail.com)写道:
surya (su*******@gmail.com) writes:
我有一个表名是HH桌子
它有两列''hhno''和hhname''
HH tabele
hhno hhname
100 suresh
101 baba
103 ram (101,baba)和(103,ram)之间的HH表中插入一条记录(102,chandra)。
如何插入它们请帮忙,谢谢s
i have a table name is HH table
it has two columns ''hhno'' and hhname''
HH tabele
hhno hhname
100 suresh
101 baba
103 ram
i want to insert a one record(102 , chandra) in HH table between
(101,baba) and( 103 ,ram).
how can i insert them please help ,me thanks




就像插入任何其他行一样:

INSERT HH(hhno,hhnmae)

VALUES(102,chandra)


然后再说,你可以说你不能因为介于之间在这种情况下,任何意义上都不会产生

。表是无序的行集。


-

Erland Sommarskog,SQL Server MVP, es **** @ sommarskog.se


SQL Server 2005联机丛书
http://www.microsoft.com/technet/pro...ads/books。 mspx

SQL Server 2000联机丛书
http://www.microsoft.com/sql/prodinf...ons/books.mspx



Just as you would insert any other row:

INSERT HH(hhno, hhnmae)
VALUES (102, chandra)

Then again, one can say that you can''t because "between" does not make
any sense in this context. Tables are unordered sets of rows.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


surya写道:
我有一个表名是HH表
它有两列''hhno''和hhname''
HH tabele
hhno hhname
suresh
101 baba
103 ram
我想插入一条记录(102 ,chandra)在HH表中
(101,baba)和(103,ram)。
如何插入它们请帮忙,谢谢
i have a table name is HH table
it has two columns ''hhno'' and hhname''
HH tabele
hhno hhname
100 suresh
101 baba
103 ram
i want to insert a one record(102 , chandra) in HH table between
(101,baba) and( 103 ,ram).
how can i insert them please help ,me thanks




喜欢这样:


INSERT INTO hhtable(hhno,hhname)

(102,''chandra'');


SELECT hhno,hhname

FROM hhtable

ORDER BY hhno;


一张桌子没有有任何订单。只能对SELECT语句

的结果进行排序。


-

David Portas,SQL Server MVP

请尽可能发布足够的代码来重现您的问题。

包含CREATE TABLE和INSERT语句通常会有所帮助。

说明SQL的哪个版本您正在使用的服务器并指定任何错误消息的内容



SQL Server联机丛书:
http://msdn2.microsoft.com/library/m..S ,SQL.90).aspx

-



Like this:

INSERT INTO hhtable (hhno, hhname)
(102 , ''chandra'');

SELECT hhno, hhname
FROM hhtable
ORDER BY hhno ;

A table doesn''t have any order. Only the results of a SELECT statement
can be sorted.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/m...S,SQL.90).aspx
--




"大卫波塔斯 < RE **************************** @ acm.org>在消息中写道

news:11 ********************** @ g10g2000cwb.googlegr oups.com ...

"David Portas" <RE****************************@acm.org> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
surya写道:
我有一个表名是HH表
它有两列''hhno''和hhname''
HH tabele
hhno hhname
100 suresh
101 baba
103 ram
我想在HH表中插入一条记录(102,chandra)
(101,baba)和(103,ram)。
我怎么能插入它们请帮忙,谢谢
i have a table name is HH table
it has two columns ''hhno'' and hhname''
HH tabele
hhno hhname
100 suresh
101 baba
103 ram
i want to insert a one record(102 , chandra) in HH table between
(101,baba) and( 103 ,ram).
how can i insert them please help ,me thanks



这样:

INSERT INTO hhtable(hhno,hhname )
(102,''chandra'');

SELECT hhno,hhname
FROM hhtable
ORDER BY hhno;

A表没有任何订单。只能对SELECT语句的结果进行排序。

- 大卫Portas,SQL Server MVP

请尽可能发布足够的代码重现您的问题。
包括CREATE TABLE和INSERT语句通常会有所帮助。
说明您正在使用的SQL Server版本,并指定任何错误消息的内容。
SQL Server联机丛书:
http://msdn2.microsoft.com/library/m...S,SQL.90).aspx
-



Like this:

INSERT INTO hhtable (hhno, hhname)
(102 , ''chandra'');

SELECT hhno, hhname
FROM hhtable
ORDER BY hhno ;

A table doesn''t have any order. Only the results of a SELECT statement
can be sorted.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/m...S,SQL.90).aspx
--




如果你使用的是

聚类索引,我认为你可以在SQL Server中有一个有序的表。


问候

拉尔夫



I think you can have an ordered table in SQL Server if you are using a
clustering index.

Regards
Ralph


这篇关于在特定位置插入记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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