If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Importing Multi-Value LDAP information into SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-02-09, 15:07
dnbr2002 dnbr2002 is offline
Registered User
 
Join Date: Jul 2009
Posts: 2
Question Importing Multi-Value LDAP information into SQL

I've been querying LDAP to pull information for our servers but have found certain fields (particularly the description attribute) in LDAP are Multi-Value fields and cannot be queried, at least without some additional code.

I figured this would have been a more common issue but have been unable to find anything specifically in my searches thus far.

Is there some kind of function or stored procedure in SQL that I need to use to convert the Multi-Value data to string data maybe?

FYI - I'm not a complete novice with SQL but i'm not a full tilt programmer either. I'd really appreciate any input.

Thanks
Reply With Quote
  #2 (permalink)  
Old 07-02-09, 15:25
Thrasy Thrasy is offline
Registered User
 
Join Date: Mar 2009
Posts: 349
I do not have any experience with LDAP but it sounds like you need to parse a multi valued field with SQL Servers string functions (SUBSTRING, CHARINDEX, LEFT, RIGHT etc...). Although if you have some application code that this stuff passes through it may be quicker and more efficient there because SQL is historically a poor performer in parsing strings.
Reply With Quote
  #3 (permalink)  
Old 07-03-09, 08:01
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I've never worked out how to read multi valued using the OpenRowset() type functions, however it's dead easy using C#, so you might want to go down the CLR route.
__________________
George
Twitter | Blog
Reply With Quote
  #4 (permalink)  
Old 07-03-09, 09:19
MohammedU MohammedU is offline
Registered User
 
Join Date: Jun 2009
Location: CA, USA
Posts: 59
No, I don't think you can fetch part of it...LDAP returns all attributes with the given name...
You may need to do the post processing after fetching the value before inserting into table...
__________________
MohammedU
SQL Server MVP
Reply With Quote
  #5 (permalink)  
Old 07-07-09, 15:24
dnbr2002 dnbr2002 is offline
Registered User
 
Join Date: Jul 2009
Posts: 2
Thanks for the input everyone. The C# solution sounds nice but I know I can do it in VBscript which I have more experience with so I'll probably go with that. I was just wondering if there was some way to do this natively in SQL.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On