Ypu have to select top 100 and then next top 100 ansd so on... as below query
Declare @start int=0
SELECT TOP 100 * FROM
(
SELECT zip,city,state,latitude,longitude,timezone,dst,
ROW_NUMBER() OVER (ORDER BY zip) AS num
FROM dbo.zipcode
) AS a
WHERE num > @start
you have to set ony @start as 0, 101, 201, and so on...
Good Luck
Do FEAR (Face Everything And Rise)
Please mark as Answer if my post helps you..!
CREATE PROCEDURE [dbo].[sp_getzipcodes]
-- Add the parameters for the stored procedure here
@start int = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
Set NOCOUNT ON
SELECT TOP 100 * FROM
(
SELECT zip,city,state,latitude,longitude,timezone,dst,
ROW_NUMBER() OVER (ORDER BY zip) AS num
FROM dbo.zipcode
) AS a
WHERE num > @start
END
here @start is a parameter which you have to pass as for first 100 0
for next hunderd 101 and so on...
Good Luck
Do FEAR (Face Everything And Rise)
Please mark as Answer if my post helps you..!
objectvie is simple in my active directory 20000 users are there if get all users i am getting the timeout exception. in order to come out of that what i am planning to do is instead of getting all the users first get 100 users, after that next 100 hundered
some thing like that.
burepallisri
Member
154 Points
161 Posts
Getting OutOfMemoryException when getting all users' info from Active Directory into sql server d...
Jan 08, 2013 10:11 AM|LINK
Hi,
Getting OutOfMemoryException when updating all users' info from Active Directory into sql server database.
now the question is how to get the active directory users parts by parts instead of getting all of them in single time?
like first hundred and next hundred and next hundred something like that.
thanks,
NadeemZee
Participant
942 Points
178 Posts
Re: Getting OutOfMemoryException when getting all users' info from Active Directory into sql serv...
Jan 08, 2013 10:46 AM|LINK
Ypu have to select top 100 and then next top 100 ansd so on... as below query
Declare @start int=0 SELECT TOP 100 * FROM ( SELECT zip,city,state,latitude,longitude,timezone,dst, ROW_NUMBER() OVER (ORDER BY zip) AS num FROM dbo.zipcode ) AS a WHERE num > @startyou have to set ony @start as 0, 101, 201, and so on...
Do FEAR (Face Everything And Rise)
Please mark as Answer if my post helps you..!
burepallisri
Member
154 Points
161 Posts
Re: Getting OutOfMemoryException when getting all users' info from Active Directory into sql serv...
Jan 08, 2013 10:48 AM|LINK
if you specify like that it will always gives you first 100 only.
how to specify the get next hundred.
NadeemZee
Participant
942 Points
178 Posts
Re: Getting OutOfMemoryException when getting all users' info from Active Directory into sql serv...
Jan 08, 2013 10:57 AM|LINK
complete procedureis given below:
CREATE PROCEDURE [dbo].[sp_getzipcodes] -- Add the parameters for the stored procedure here @start int = 0 AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. Set NOCOUNT ON SELECT TOP 100 * FROM ( SELECT zip,city,state,latitude,longitude,timezone,dst, ROW_NUMBER() OVER (ORDER BY zip) AS num FROM dbo.zipcode ) AS a WHERE num > @start ENDhere @start is a parameter which you have to pass as for first 100 0
for next hunderd 101 and so on...
Do FEAR (Face Everything And Rise)
Please mark as Answer if my post helps you..!
burepallisri
Member
154 Points
161 Posts
Re: Getting OutOfMemoryException when getting all users' info from Active Directory into sql serv...
Jan 08, 2013 12:56 PM|LINK
thanks for your reply.
but i have to get the users from the active directory not from the table.
how can you specify the above things for the active directory.
thanks,
burepallisri
Member
154 Points
161 Posts
Re: Getting OutOfMemoryException when getting all users' info from Active Directory into sql serv...
Jan 08, 2013 12:58 PM|LINK
objectvie is simple in my active directory 20000 users are there if get all users i am getting the timeout exception. in order to come out of that what i am planning to do is instead of getting all the users first get 100 users, after that next 100 hundered some thing like that.
i thing now you got my point
NadeemZee
Participant
942 Points
178 Posts
Re: Getting OutOfMemoryException when getting all users' info from Active Directory into sql serv...
Jan 09, 2013 04:44 AM|LINK
can you post your code so that i look into the real problems..
Do FEAR (Face Everything And Rise)
Please mark as Answer if my post helps you..!
Pengzhen Son...
Star
8224 Points
848 Posts
Microsoft
Re: Getting OutOfMemoryException when getting all users' info from Active Directory into sql serv...
Jan 14, 2013 09:28 AM|LINK
Hi,
Please try using Linq on top of this and do a
on results. Please refer this link: http://stackoverflow.com/questions/10853011/get-2000-of-6000-records-from-directorysearcher .Hope it can help you.
Feedback to us
Develop and promote your apps in Windows Store