Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Retriving data IN SQL SERVER 2000 Expand / Collapse
Author
Message
Posted Saturday, February 23, 2008 7:02 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, February 26, 2008 7:52 AM
Points: 1, Visits: 4
my name is BABU i have requirement like this any body can help me?

i have a table name emp with 10000 records and without identity column i want first 5000 records after i want 5000 to 7000 records later 7000 to 10000 is it possible in sql server?
Post #459415
Posted Saturday, February 23, 2008 9:45 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 30, 2014 10:08 PM
Points: 1,038, Visits: 444
Hmmm - you've posted this to the wrong forum.

In any case, what do you mean by you "want" the records?

Do you want the first 5000 records to have some flag set, then the next 2000, etc? Or do you want to be able to return them in a query?

In either case, how do you define "first"? You'll need to work out how you want to order the data. This could be by date, name, colour, size, etc, etc depending on what attributes you have for your data. Now that I look again you have employees (the "emp" name is usually for this?) so I suppose name, hire date, salary, etc could be reasonable criteria.

Are you actually running SQL 2000 or did you just post this question in a forum with 2000 in the name? There are easier ways to do this in 2005...



Post #459484
Posted Saturday, February 23, 2008 11:17 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 7:27 AM
Points: 35,769, Visits: 32,437
bosekolli (2/23/2008)
my name is BABU i have requirement like this any body can help me?

i have a table name emp with 10000 records and without identity column i want first 5000 records after i want 5000 to 7000 records later 7000 to 10000 is it possible in sql server?


The answer to both questions is "Yes". Like Ian stated, though, we need just a wee bit more info... Are you in fact using SQL Server 2000 or 2005? Can you post the CREATE statement for the EMP table? In the absense of an IDENTITY column, what is the Primary Key of the table? And, last but not least, what order to you want the results to be sorted by?


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #459494
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse