Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Selecting Top Data Rows

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2010-05-05 : 06:56:23
I must be having a memory blank. I am trying to find the top 2000 rows of data, but my query is not working. What am I doing wrong.

Select Top 2000* from Products_Hospital

Thank in advance!

Wendy

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-05-05 : 06:59:38
Do you got any error message?

Without ORDER BY clause TOP doesn't provide expected result!

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

apodemus
Starting Member

30 Posts

Posted - 2010-05-05 : 07:00:53
have some error message?

apodemus
Go to Top of Page

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2010-05-05 : 07:01:46
Nevermind, I was in the wrong database. Sorry for wasting your time.

Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-05-05 : 07:03:57
Cool

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-05 : 07:28:27
quote:
Originally posted by werhardt

Nevermind, I was in the wrong database. Sorry for wasting your time.




thats why its always better to use

USE [DBNAME]
Go

on top of your query

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -