选择语句意外工作 [英] select statement working unexpectedly

查看:32
本文介绍了选择语句意外工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击 SELECT TOP 1000 row from table 然后它只显示一些记录,比如 3 条记录

when i click SELECT TOP 1000 row from table then it only shows some records like 3 records

但是当我在同一个表上手动运行查询时,它会显示所有记录,例如我一直想要的许多 1000 条记录.

but when i manually run query on same table then it shows all records like many 1000s records which i always want.

Select * from dbo.HrEmployee

为什么?请帮忙,我正在使用 SQL SERVER 2012

why ? Help please, i'm using SQL SERVER 2012

推荐答案

看起来您已经创建了同一个数据库的两个副本,一个在预期"数据库中,第二个已在主数据库中创建.然后将 3 条记录插入到预期的表中,其余记录插入到 master.dbo.HrEmployee 中.

It look like you have created two copies of the same database, the one is in the "intended" database and the second has been created in the master database. 3 records were then inserted into the intended table and the rest were inserted into the master.dbo.HrEmployee.

当您使用 select top 1000 时,您正在对正确的数据库运行查询,即使它只有 3 条记录,而当您运行第二个查询时,您正在对 Master 中的同一张表运行它

When you use the select top 1000 you are running the query against the correct database even though it only has 3 records and when you run the second query you are running it against the same table in Master

这篇关于选择语句意外工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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