取n到m条记录的语句 1. select top m * from tablename where id not in (select top n id from tablename) 2. select top m * into 临时表(或表变量) from tablename order by columnname -- 将top m笔插入 set rowcount n select * from 表变量 order by columnname desc 3. select top n * from (select top m * from tablename order by columnname) a order by columnname desc 4.如果tablename里没有其他identity列,那么: select identity(int) id0,* into #temp from tablename 取n到m条的语句为: select * from #temp where id0 >=n and id0 <= m 如果你在执行select identity(int) id0,* into #temp from tablename这条语句的时候报错,那是因为你的DB中间的select into/bulkcopy属性没有打开要先执行: exec sp_dboption 你的DB名字,'select into/bulkcopy',true 5.如果表里有identity属性,那么简单: select * from tablename where identitycol between n and m 如果是sql server 2005 可以这样写: select top 20 * from T order col except select top 2 * from T order col
你装SQL企业版的机器是XP还是2000,如果是XP的话最好关掉所有的防火墙
你的SQL 2000是否打了SP4你确定2点都OK了的话,如果还连不上的话可以在你的客户机上进行以下测试
osql -S 服务器IP -U 用户名 -P 密码
看能不能在这里连接上
执行上面的命令你需要在CMD环境下,并且客户机有装SQL2000的连接工具。如果还是不行的话你看看服务器上你网络连接的设置,一般有通过管道连接和TCP/IP连接,
如果是有选择TCP/IP连接的话你可以在客户机上测试
telnet 服务器IP 1433
这个也是要在CMD环境上测试
看看服务器的1433端口是否已经开了。
SQL Server的用户管理,与操作系统的无关.
虽然与操作系统无关,但是看到过很多人在XP上装SQL,因为XP在打了SP2后防火墙默认是不让1433端口过的,自然连不上去
这里也只是让楼主排除这种情况。
三台机器装的都是SQL2000(SP4),
连Win2000没有问题,很轻松就连上了(guest用户禁止),
连Win2003怎么都连不上,当把Win2003的本地Guest用户启用后立刻就能连上,禁止之后又连不上。
(Win2003没有防火墙,telnet测试通过)
郁闷!!
看看联通状态
select top m * from tablename where id not in (select top n id from tablename) 2.
select top m * into 临时表(或表变量) from tablename order by columnname -- 将top m笔插入
set rowcount n
select * from 表变量 order by columnname desc 3.
select top n * from
(select top m * from tablename order by columnname) a
order by columnname desc
4.如果tablename里没有其他identity列,那么:
select identity(int) id0,* into #temp from tablename 取n到m条的语句为:
select * from #temp where id0 >=n and id0 <= m 如果你在执行select identity(int) id0,* into #temp from tablename这条语句的时候报错,那是因为你的DB中间的select into/bulkcopy属性没有打开要先执行:
exec sp_dboption 你的DB名字,'select into/bulkcopy',true
5.如果表里有identity属性,那么简单:
select * from tablename where identitycol between n and m 如果是sql server 2005 可以这样写:
select top 20 * from T order col
except
select top 2 * from T order col
在使用卡巴斯基杀毒后,一切OK
强烈建议楼主杀毒...
或用360安全卫士查看一下...
问题还是Win2003带来的,因为以前没用过Win2003做服务器,所以很多东西与Win2000不一样,也不熟悉。我是这样解决的:我的网络里所有机器(包括SQL服务器)的IP都是动态分配的,当我改为固定的IP之后就能链接了。
另外,在动态IP的情况下,不一定非要开启Guest用户才可连接,从网上邻居里或是运行里等用SQL服务器的某个用户和口令登录一下SQL服务器之后也能连上。以上这些在Win2000里是不存在的,我也在思考为什么这样?大家可以讨论一下原因,我用的路由器是NETCORE 605。
如果连接时不使用IP,而是直接使用计算机名\实例名(如果有),就没有问题啦。
我使用的是Windows 2003+花生壳+互联网,加拿大都可以访问。
如:我客户端当前的用户名Admin,密码123,SQL服务器上正好也有一个这样的用户和相同的密码,就能连接。
好郁闷?!