积极答复者
SQL 查询如何写

问题
答案
-
use tempdb
go
create table t1(col int)
go
declare @n int
set @n=0
while @n<10
begin
insert t1 (col) values(@n)
set @n=@n+1
endselect top 1 * from t1 order by newid()
有dba的职位吗- 已建议为答案 Sun weiMicrosoft employee 2009年11月18日 2:26
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2009年11月18日 5:59
-
ACCESS:
select top 1 * from news order by rnd(id),delete from table where id=id
id为表的标识列- 已标记为答案 Hong-Gang Chen - MSFTModerator 2009年11月18日 5:59
-
delete tablename where id in (select top 1 id from tablename)
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2009年11月18日 5:59
-
select top 1 * from tablename order by rnd([一个自动编号字段])
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2009年11月18日 5:59
全部回复
-
use tempdb
go
create table t1(col int)
go
declare @n int
set @n=0
while @n<10
begin
insert t1 (col) values(@n)
set @n=@n+1
endselect top 1 * from t1 order by newid()
有dba的职位吗- 已建议为答案 Sun weiMicrosoft employee 2009年11月18日 2:26
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2009年11月18日 5:59
-
ORDER BY NEWID()
--------------------------------------
成都有DBA职位- 已建议为答案 Sun weiMicrosoft employee 2009年11月18日 2:26
-
ACCESS:
select top 1 * from news order by rnd(id),delete from table where id=id
id为表的标识列- 已标记为答案 Hong-Gang Chen - MSFTModerator 2009年11月18日 5:59
-
delete tablename where id in (select top 1 id from tablename)
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2009年11月18日 5:59
-
select top 1 * from tablename order by rnd([一个自动编号字段])
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2009年11月18日 5:59