Showing posts with label importing. Show all posts
Showing posts with label importing. Show all posts

Friday, March 30, 2012

Linking or importing Active Directory objects to SQL Server tables

We're trying to figure out whether it's possible to link AD objects to SQL tables. For example, if we have a table of Users and a table of Companies, we'd like to enter the users into Active Directory, create the Companies as either OU's or Security Groups, then have those entities magically appear in the corresponding SQL Server tables. Is that possible? Thanks in advance.

There is a OLE DB Provider for MIcrosoft Directory Services http://msdn2.microsoft.com/en-us/library/aa172728(SQL.80).aspx.

Would that work for you?

Kar

sql

Wednesday, March 28, 2012

Linking a text file to SQL Server

Hi all.
I need to create a Linked Server in SQL 2000 to a text file. Importing the file is not an option. It has to be linked. I tried creating a ODBC link to it but I must be doing something wrong because it didn't work.
Please help.
Thanks,
ODanielsif you have sucessfully created the linkserver, you can use
EXEC sp_tables_ex <link server name> to query the tables (csv/txt files) of that link.

a sample query to retrive rows from a file can look like
select * from [txtLinkSrv].[d:\folder]..[File1.csv]

here "txtLinkSrv" is the link server name, "d:\folder" is the folder name that contains the files, "File1.csv" is the name of a csv file.|||Thanks upalsen.

Can this be used with a network path? Or does it have to be local?
I tried it and I keep getting:

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.
[OLE/DB provider returned message: [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed]
[OLE/DB provider returned message: [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed]
[OLE/DB provider returned message: [Microsoft][ODBC Text Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.]
OLE DB error trace [OLE/DB Provider 'MSDASQL' IDBInitialize::Initialize returned 0x80004005: ].