Hello I am trying to run a query via tsql against ad. Below is the error I am getting. I have read the http://msdn2.microsoft.com/en-US/library/ms190803.aspx and changed the domain but still having issues. Any help would be appreciated.
EXEC sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces',
'ADSDSOObject', 'adsdatasource'
GO
SELECT *
FROM OPENQUERY( ADSI,
'SELECT Name, SN, ST
FROM ''LDAP://ADSISrv/ OU=Users,DC=XXXXX,DC=LOCAL''
WHERE objectCategory = ''Person'' AND
objectClass = ''user''')
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT Name, SN, ST
FROM 'LDAP://ADSISrv/ OU=Users,DC=XXXXX,DC=LOCAL'
WHERE objectCategory = 'Person' AND
objectClass = 'user'" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".
This is something that should not be so difficult, but it is proving to be very cumbersome. I need to query an LDAP database on a Linux server FROM a sql server, namely sql server 2005. I have found bits and pieces, but can€™t seem to put it all together yet €“ it should be easy, but it€™s proving to be very difficult. It seems like you can either link an LDAP server through sp_addlinkedserver OR through enterprise manager/sql server studio, you can create a LINKED SERVER. The problem is HOW to do this. Here are the parameters for the ldap server: Server name: serverabc Ldap info (which I don€™t know how to label) is: 'ou=Hosts,dc=mc,dc=vanderbilt,dc=edu'. I was able to somehow get this to work last week, but now it€™s not working - it didn't return any data, as i don't have any ldap hierarchy specified, but at least it came back with "command completed successfully": SELECT * FROM OPENQUERY( [serverabc], 'SELECT * FROM ''LDAP://serverabcu/ OU=Hosts,DC=mc,DC=vanderbilt,DC=edu'' ') With all the ldap usage out there, this is really frustrating not being able to find out how to do this. Any help is greatly appreciated. Thanks
I have a linked server set up and working correctly. I can create a query to get all the users from active directory with something like this:
SELECT [name], [samaccountname] from OpenQuery( ADSI, 'SELECT name, samaccountname FROM ''LDAP://DC=domain,DC=com'' WHERE objectClass = ''user'' and objectCategory=''Person''')
Now I am trying to select all the users in a specifed security group, but I am not having much luck. What is the best way to get this?
I'm trying to query an LDAP server from a stored procedure written for the CLR but not getting the expected results.
The code is as follows:
<Microsoft.SqlServer.Server.SqlProcedure()> _ Public Shared Sub LDAP_UserExists(<Out()> ByRef exists As Boolean, ByVal username As SqlString)
Dim adspath As New StringBuilder() adspath.Append(LDAP://[.......]/ou=Members/cn=) adspath.Append(username)
If username.ToString().Length > 0 Then Dim uobject As New DirectoryEntry(adspath.ToString(), "", "", System.DirectoryServices.AuthenticationTypes.Anonymous) If Not (uobject Is Nothing) Then exists = True Else exists = False End If End If
End Sub
The same code works fine from an ASP.NET. If I deploy the code and execute it with
exec LDAP_UserExists 'username'
I receive the error
Error converting data type varchar to bit.
And if I right-click and select "Execute Stored Procedure..." I receive @exists = 1 and Return Value = 0, regardless of the value I pass in as the username parameter.
Given that the same code works correctly on the ASP.NET page I suspect that this error has something to do with the <out()> parameter in the stored procedure declaration.
Can anyone suggest the correct method of performing this query?
I am trying to get members of an Active Directory group by querying the AD server from Transact-SQL (SQL Server 2005). Although there does not seem to be any written list of LDAP attributes that can be queried in AD (or I am not finding it), I have gotten this far:
SELECT * FROM
OPENQUERY( MYSERVER,
'SELECT cn, msExchHomeServerName, userPrincipalName FROM ''LDAP://CN=Users,DC=MYSERVER,DC=COM'' WHERE userPrincipalName=''*'' ')
This gives me a user list. But I can't find the syntax or attribute name(s) to query in order to get the membership of a specific group - for example, the group "SQL_Developers".
Anybody out there familiar enough with LDAP, AD and OPENQUERY() to give me a hand?
Is it possible to use a parameter in a ldap query using the ADsDSOObject provider? I keep getting an error "The ICommandWithParameters interface is not supported by the "ADSDSOObject" provider". Command parameters are unsupported with the current provider.
I don't have a linked server on my DB server to Active Directory so I'm just querying in the SSRS report design. Here is my query for my dataset. If I hard code an example it works. Just doesn't work when I pass a parameter. I've tried making it an expression (= sign), Tried several syntax's, Tried everything I can think of. Is this possible? or do I just need to push for a linked server?
I am using MS Access 2003 SP2 to maintain some data tables. I use SSIS to transfer them to SQL Server 2005, Enterprise Edition.
When I run the SSIS package from within Visual Studio 2005, the package runs without error.
When I try to run the same SSIS package by double-clicking on it in my File System (which invokes the Execute Package Utility, Version: 1.0) none of the tables get copied. Instead all I receive is a message for each table,
Error: SSIS Error Code DTS_E_PRODUCTLEVELTOLOW. The product level is insufficient for component "Data Conversion 1" (49).
The only data conversion I perform is double-byte characters to single-byte characters.
Bob Bojanic, MSFT, made a few suggestions about this in another thread -- but I have created this new thread to help focus on this specific issue. In particular, he asked if we have installed the complete SSIS support for SQL Server 2005, Enterprise Edition, and my network support and database support staff assure me that such complete SSIS support was installed.
Are others having this problem?
Dan
(I just took a look at some of the transformations in the Data Conversion task, and many of them are using an Output Alias identical to the Input Column name. Might that be causing the problem? I will try changing the Output Alias for some tables and see if they then transfer correctly. The "identical name" Output Alias values were created by the Migration Wizard for a DTS 2000 package.)
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 tobe any way to set the Page Size.I found the following:http://support.microsoft.com/defaul...kb;en-us;243281Which seems to imply that the default can be set by changing registrykey: "HKEY_CURRENT_USERSoftwarePoliciesMicrosoftWind owsDirectoryUI"I have set this key, and also set it for the user account under whichMSSQLServer runs. The value persists after a reboot. The Domain Grouppolicy sets the default to 15000.This behaviour is not restricted to the linked server. If I use thescript found here:http://hacks.oreilly.com/pub/h/1121 I can access morethan 1000 records, but only if I set the "Page Size" property. If Icomment it out to let the default hold, it is 1000.It must be settable SOMEWHERE or the whole linked server thing is ofvery limited use.At present, the best solution I've been able to come up with is to usethe above script modified to run as a DTS package. Yuck.TIA,BM
Hi, I want to call a dll from Stored procedure developed in SQL Server 2005 at configuration level 80. but when I execute the stored procedure I get the following error.
Error Source: ODSOLE Extended Procedure Description: Invalid class string
Code of stored procedure and vb.net class is given below:
Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String) ' impersonate the calling user Dim newContext As System.Security.Principal.WindowsImpersonationContext newContext = SqlContext.WindowsIdentity.Impersonate() Try Dim w As StreamWriter = File.AppendText(LogName) LogIt(newMessage, w) w.Close() Catch Ex As Exception
Finally newContext.Undo() End Try End Sub End Class ===============================================================
STORED PROCEDURE Create PROCEDURE [dbo].[PPGenerateFile] AS
BEGIN Declare @retVal INT Declare @comHandler INT declare @errorSource nvarchar(500) declare @errorDescription nvarchar(500) declare @retString nvarchar(100)
-- Intialize the COM component EXEC @retVal = sp_OACreate 'PositivePay.class', @comHandler OUTPUT IF(@retVal <> 0) BEGIN --Trap errors if any EXEC sp_OAGetErrorInfo @comHandler,@errorSource OUTPUT, @errorDescription OUTPUT SELECT [error source] = @errorsource, [Description] = @errordescription Return END
-- Call a method into the component EXEC @retVal = sp_OAMethod @comHandler,'LogToTextFile',@retString OUTPUT, @LogName = 'D: ext.txt',@newMessage='Hello' IF (@retVal <>0 ) BEGIN EXEC sp_OAGetErrorInfo @comHandler,@errorSource OUTPUT, @errorDescription OUTPUT SELECT [error source] = @errorsource, [Description] = @errordescription Return END select @retString
Does anyone else have this error message pop up in SSMS when you try to parse sql statements:
.Net SqlClient Data Provider: Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
There was a thread back in March 2006 that mentioned this error, but the posted resolution was to install SP1. I have SP1 installed but I still get the error.
I only receive the error when I'm parsing statements, if I run the statement it's fine.
We've devoted a resource to this today, but I have to believe it's something easy that we're overlooking. The scneario is that we have a production Web application that until last weekend had a SQL 2000 back end. This weekend we installed a new instance of SQL 2005 and everything works (we tested in a sandbox environment, but someone must not have load tested enough) and never saw these exceptions. So, after the upgrade we now receive 100's of thexe SQL excptions per day:A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)Does anyone know what we've overlooked that's causing this issue?Thanks for any help!
I am getteing need help Query analyzer error Unable to connect server local Msg17, level 16,state 1 ODBC SQL server driver [DBNETLIB]SQL server does not exist
I have a SProc that runs across many clients without any problems. Every now and then, though, I get the following error:
Internal Query Processor Error: The query processor encountered an unexpected error during execution. [SQLSTATE 42000] (Error 8630).
All I am doing is populating Temp tables with some data and then joining them together to create a Global Temp table that is being BCP'd to a network share.
Has anyone come across this error in SQL Server 2005? I cannot find anything on Google or Microcsoft.
Dear Friends, Here I have 2 stored procedure to return data via LDAP from Active Directory. The first SP it's OK, but the second doesn't. The difference is in ''@MyDIR'' because in the second I want to use a paramter... How can I use a paramter in the second SP? THANKS
1. CREATE PROCEDURE [dbo].[GD_SP_LDAP_CGD_GET_CNsByDIR] @MyDIR nvarchar(20) AS
DECLARE @SQLString NVARCHAR(500); SET @MyDIR ='DSO'
SET @SQLString = N'SELECT * FROM OPENQUERY(ADSI,'' SELECT name FROM ''''LDAP://OU=DSO,OU=Estacoes,OU=Servicos-Centrais,OU=cgd,DC=GrupoCGD,DC=com'''' '')';
EXECUTE sp_executesql @SQLString;
2. CREATE PROCEDURE [dbo].[GD_SP_LDAP_CGD_GET_CNsByDIR] @MyDIR nvarchar(20) AS
DECLARE @SQLString NVARCHAR(500); SET @MyDIR ='DSO'
SET @SQLString = N'SELECT * FROM OPENQUERY(ADSI,'' SELECT name FROM ''''LDAP://OU='' @MyDIR '' ,OU=Estacoes,OU=Servicos-Centrais,OU=cgd,DC=GrupoCGD,DC=com'''' '')';
Ok, some background information: I'm running an asp.net application.ASP.NET 2.0I'm using a SQL Server 2000 database.I don't have very many problems with the application, but when I do, I get this error message: Inner Source .Net SqlClient Data Provider Inner Message A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.) Here is what my connection string looks like, although from the stacktrace, it looks like its failing when I do an ExecuteReader. Any ideas why I'm getting this error? connection_string = "Data Source=database;Initial Catalog=catalog;User ID=XXXX;Password=XXXX;min pool size=1; max pool size=50"; Thanks, Khanathor
I exec local procs of archiving databases on 3 SQL 2000 Enterprise Servers. All three servers with following same error messages in the middle of processing(each had processed from 10 to 100 DBs already). ---------------------------------------------------------- Msg 64, Level 20, State 0, Line 0 A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)
There is no error message in above 3 SQL's error log and all of them are up running fine.
Since the procs are in local, I did not use hostname or '.' to refer as 'Local'.
I am writing a user defined function but I am receiving an error message that I can figure out. Any answers out there?
Msg 102, Level 15, State 1, Procedure ufn_GetStreetNumber, Line 25 Incorrect syntax near '@StreetNum'.
-- --------------------------------------------------------------------------------- SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Description: Parses out the Street number for Address field -- ============================================= CREATE FUNCTION dbo.ufn_GetStreetNumber ( -- Add the parameters for the function here @StreetAddr varchar(50) ) RETURNS int AS BEGIN -- Declare the return variable here DECLARE @StreetNum varchar(50); DECLARE @iIter smallint, @iNoOfChars smallint, @iStreetNo int;
SET @StreetNum=NULL; SET @iStreetNo=0; SET @iNoOfChars=1; SET @iIter=1;
-- Add the T-SQL statements to compute the return value here WHILE Isnumeric(Substring(@StreetAddr,@iNoOfChars,@iIter))=1 @StreetNum=@StreetNum + Substring(@StreetAddr,@iNoOfChars,@iIter) @iIter=@iIter+1 BREAK @iStreetNo=@StreetNum
-- Return the result of the function RETURN @iStreetNo
Basically the error that I am getting is in our test automation when running as non-admin on the box (regular user). We use .Net C# SQLConnection class to connect to SQL express 2005 impersonating with admin credentials. After getting the connection we try to execute a select command and it some time fails with following error: A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The handle is invalid.) at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ReadPacket(Int32 bytesExpected) at System.Data.SqlClient.TdsParserStateObject.ReadBuffer() at System.Data.SqlClient.TdsParserStateObject.ReadByte() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader()
This happen only in the non-admin scenario mentioned above. Any idea what is triggering this?
Hi, can anyone tell me how exactly sql server7 interacts with Site Server, LDAP. I am a sql dba, trying to work with above ones. Anyone pls suggest me any book or material or ur ideas.
I need to export data from an LDAP-compliant data source, to a SQL Server database. Is this possible with SQL Server 2005 Integration Services? The Import and Export Wizard does not appear to support LDAP in the Data Source drop down list.
I need to export data from an LDAP-compliant data source, to a SQL Server database. Is this possible with SQL Server 2005 Integration Services? The Import and Export Wizard does not appear to support LDAP in the Data Source drop down list.
hi actually i have a temporay table wich has four columns say col_1,col_2,col_3,col_4. so firstly i wud bulk insert from a text file wich mite contain thousands of rows. then from this temp table col_1 and col_2 shd go to master_a.wich has an identiy column as primary key. say id,col_1, col_2.
i will have another table detail_b where in there is a foreign key to the table master_a for id. so it will have f_id, col_3,col_4.
so i am riting a trigger on master_a. so whenver row is inserted in master_a. coresponding id and col 3 col4 shd be inserted into detail_b.
For this in oracle we have row level trigger. where in for each insertion in master a .. correspoding trigger will fire but in sql 2000.. but i wud like to implemtn row level trigger.. can u hlep me out..
We have upgraded our database from SQL 2000 to SQL 2005 keeping the compatibility level 80. Now the question is - Would microsoft support compatibility level 80 in SQL Server 2005 even after the extended support date for SQL Server 2000?
OR
If Microsoft dropped the support for SQL 2000, then would Microsoft support compatibility level 80 in SQL Server 2005?
My multiple level nested corelated query is not fetching correctresult. It work fine on small set of data, but fails on larger set ofdata. Any clue?Explaining data storing and discussing design would be tough for mehere, still to show you how complex I have created my life, here is thequery:select(SELECT Top 1 RowNSBranchID FROM AssoExtBranchToNSBranchMstM AM-- MMMWHERE AM.RowExtSysID IN(SELECT RowID FROM ExternalSystemMstM WHERE ExtSysID =(SELECT ExtSysID FROM ExternalSystemMstM WHERE SF = 'Active' ANDRowID =(SELECT MAX(RowID) FROM ExternalSystemMstM WHERE MCStatus = 2 ANDExtSysCode = UM.SystemCode)))AND RowExtBranchID IN(SELECT RowID FROM ExternalBranchMstMWHERE ExtBranchID =(SELECT ExtBranchID FROM ExternalBranchMstMWHERE ROWID =(SELECT RowID FROM ExternalBranchMstMWHERE ROWID =(SELECT MAX(ROWID) FROM ExternalBranchMstM WHERE MCStatus = 2 ANDExtBranchCode = UM.UpBranchCodeAND RowExtSysID IN(SELECT RowID FROM ExternalSystemMstM WHERE ExtSysID =(SELECT ExtSysID FROM ExternalSystemMstM WHERE SF = 'Active' ANDRowID =(SELECT MAX(RowID) FROM ExternalSystemMstM WHERE MCStatus = 2AND ExtSysCode = UM.SystemCode))))AND (SF = 'Active'))))AND AM.SF = 'Active'order by AssoID desc,TrackID desc) nsbranchid, UM.*fromTmpInProcessData062005MstM UM
I've got some .NET web tracking software that outputs all its data into an SQL Server database for record-keeping. The front-end for it isn't really that great, and I'm in the process of creating a (basic) alternative version.
My problem is this- I want to create a treeview that represents all the page requests on the site. I could do a SELECT DISTINCT on the whole table to build this, but that's very wasteful- a far better approach would be to select the first folder level, and fetch child pages only when that folder is expanded.
While I've got that second bit sorted (just doing a SELECT DISTINCT WHERE url LIKE 'http://www.mydomain.com/folder/%'), I can't work out how to only select the first folder level in the first place. I guess I want to do some kind of text manipulation based on forward slashes, but I have no idea how.
Please help with a problem - I need to execute the following process:
(1) Create about 200 empty tables in a database (this MUST be done prior to step 2) (2) copy rows from a source database with identical tables into all of the empty tables, (3) copy more rows from a third database source (with some duplicate rows) into the tables from step 2.
The problem is that the first copy goes OK since the tables are empty, but the second copy fails as soon as a duplicate row triggers an error in the DTS tool. At that point, the DTS tool goes on to the next table until the problem is repeated.
In Oracle, I can set a flag for import such as IGNORE=YES which will ignore object or row creation errors.
How can I get DTS to ignore row creation errors, due to expected duplicate row constraints, and just carry on with the next row after each rejected row? In other words, set DTS to simply reject duplicate rows without aborting the entire table copy.
I am getting the following error, Do you any suggesions? Thanks Rau SqlDumpExceptionHandler: Process 62 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process..