Showing posts with label limit. Show all posts
Showing posts with label limit. Show all posts

Thursday, March 8, 2012

ADSI LDAP Query 1000 Record limit for MSSQLServer linked server

Hi,
I have successfully set and used a linked server to query ADSI.
Since this question also concerns MSSQLServer, I've cross posted it --
I hope this is not a breach of etiquette.

I have successly created a view based on the linked server.
Unfortunately, it only shows 1000 records, and there does not seem to
be any way to set the Page Size.

I found the following:
http://support.microsoft.com/defaul...kb;en-us;243281

Which seems to imply that the default can be set by changing registry
key: "HKEY_CURRENT_USER\Software\Policies\Microsoft\Wind ows\Directory
UI"

I have set this key, and also set it for the user account under which
MSSQLServer runs. The value persists after a reboot. The Domain Group
policy sets the default to 15000.

This behaviour is not restricted to the linked server. If I use the
script found here:http://hacks.oreilly.com/pub/h/1121 I can access more
than 1000 records, but only if I set the "Page Size" property. If I
comment it out to let the default hold, it is 1000.

It must be settable SOMEWHERE or the whole linked server thing is of
very limited use.

At present, the best solution I've been able to come up with is to use
the above script modified to run as a DTS package. Yuck.

TIA,
BM>This behaviour is not restricted to the linked server. If I use the
>script found here:http://hacks.oreilly.com/pub/h/1121 I can access more
>than 1000 records, but only if I set the "Page Size" property. If I
>comment it out to let the default hold, it is 1000.

Yes, that's the way it was designed - if you don't use paged searches,
AD will limit you to about 1000 objects.

So if you want more than 1000 objetcs back, just set the "Page Size"
options - where's the problem with that??

Marc
__________________________________________________ ______________
Marc Scheuner ** mscheuner -at- mvps.org ** http://adsi.mvps.org
Microsoft MVP for Directory Services Programming
http://www.dirteam.com/blogs/mscheuner/default.aspx
http://groups.yahoo.com/group/ADSIANDDirectoryServices/|||No problem at all.
Now, can you tell me where you set page size when you have ADSI set up
as a linked server? I've not been able to find it, as I mentioned in
my post.

The reference given about setting the "Directory UI" key does not seem
to work.

Thanks,
BM

Tuesday, March 6, 2012

ADODB.Recordset Invalid Column Name VB6

I'm trying to limit the recordset retuned in the sub below by a
variable called vcnumber. I'm not sure what the problem is but I keep
getting the error "Invalid Column Name" when I set sqlstring to "select
* from vc_names where vc_case_number =" & vcnumber. If I don't try to
limit the recordset returned and just set sqlstring to "select * from
vc_names", it works. If there is another\better way to do this, I am
open to suggestions. Thanks!
========================================
===================
Public Sub populatename()
Dim adoConnection As ADODB.Connection
Dim adoRecordset As ADODB.Recordset
Dim connectString As String
Dim sqlstring As String
Set adoConnection = CreateObject("ADODB.Connection")
Set adoRecordset = CreateObject("ADODB.Recordset")
connectString = "Provider=SQLOLEDB.1;Password=password;Persist Security
Info=True;User ID=user;Initial Catalog=db;Data Source=server"
adoConnection.Open connectString
sqlstring = "select * from vc_names where vc_case_number =" & vcnumber
adoRecordset.Open sqlstring, adoConnection, adOpenDynamic,
adLockOptimistic
Do Until adoRecordset.EOF
List2.AddItem adoRecordset!first_name & " " & adoRecordset!middle_name
& " " & adoRecordset!last_name
adoRecordset.MoveNext
Loop
adoRecordset.Close
adoConnection.Close
Set adoRecordset = Nothing
Set adoConnection = Nothing
End Sub
========================================
========================if vs_case_number is a char field, remember to add quotes i.e.
sqlstring = "select * from vc_names where vc_case_number = '" &
vcnumber & "'"

Sunday, February 19, 2012

ADO MaxRecords and table variables

It appears that when I specify the MaxRecords property in ADO to something other than 0, not only does SQL Server 2000 limit the number of rows that are being returned from a stored procedure, it also limits the number of "select into"s within the stored proecudre (I'm inserting into table variables within the proc).

Here's a scenario of why this is a problem. Suppose I have a proc that needs to perform calculations on all employees in my system (10,000 of them). The calculation is performed by selecting these employees into a table variable with some calculated values being inserted as well. When the processing is complete, I need to select the top 1500 employees from the table.

If I specify MaxRecords in ADO, the "select into" statement that populates my table variable appears to limit the number of rows to 1500. This is a problem if I'm expecting an employee outside of the first 1500 to be considered for the calculations I'm performing.

Is there some way of indicating that MaxRecords should be ignored when selecting into table variables or temporary tables within a stored proc?

Thanks,
TerenceI know I could simply use "top" in the last select statement of the stored procedure to get around this problem, however, this is not an option on the system I'm currently developing (for design reasons (possibly poor design reasons now that I think about it ;) ))

Thanks again,
Terence