in

SharePoint University

Clean slate. Nothing but SharePoint.
Go, SharePoint!

How To reference SQL tables

Last post 09-30-2008 2:03 PM by cashfo01. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 06-25-2007 1:20 PM

    • LRA
    • Not Ranked
    • Joined on 06-25-2007

    How To reference SQL tables

    Looking for a how-to reference or example code showing how to access SQL tables for a list of data to fill the "Choice" list in a column in a standard list.

  • 06-27-2007 6:10 AM In reply to

    Re: How To reference SQL tables

    I'm not sure that I understand. Do you want the SQL query to actually update the list? If so, that is something that you probably want to stay away from as it is really unsupported. If you are just looking for a some help actually querying the SQL tables for a report or something then it really quite easy.

    The actual values of data contained in a list reside in the dbo.UserData table in the 'Site' database. To figure out the list ID of the list that you are trying to get information for, you can either use your browser and go to the properties of the list or you can look in the dbo.Lists table that is also in the 'Site' database.

    As for actually updating or inserting values in those tables... I have no idea. If you need to automatically update or insert a value you should really consider creating a .NET application that uses the SharePoint API to make changes to lists.

     Just my 2 cents.

  • 06-27-2007 7:34 AM In reply to

    Re: How To reference SQL tables

    Do NOT work with the database directly.  Use the API.  There are a lot of business rules/logic in the API that will not get called if you attempt to insert/update/delete data directly in the database.  As a result, your WSS site and/or list may break.  Microsoft won't support you if you work with the database directly. 

    Besides, the API is so much easier...   I'm not sure why you'd want to use the database directly.

     

    -----------
    Mike Hodnick
    http://www.kindohm.com
    Lead Consultant
    Inetium
    http://www.inetium.com
    Filed under: , ,
  • 07-07-2007 11:31 PM In reply to

    • AaronH
    • Not Ranked
    • Joined on 07-02-2007
    • Southwest Michigan

    Re: How To reference SQL tables

    If all you're looking to do is populate the "Choice" options for a column, you can just convert the column type from "Single Line of Text" to "Choice".  SharePoint will automatically look at the data in the list and input the distinct list of options for you.

     Otherwise, a SELECT DISTINCT query against UserData table filtered down to the list you are dealing with will give you what you are looking for if I'm understanding you correctly.

    Filed under: ,
  • 09-30-2008 2:03 PM In reply to

    Re: How To reference SQL tables

    I am looking to do the same thing.  I am not sure if the original post was referring to the SharePoint SQL database, but I would like to know how to reference SQL tables from an external SQL database and populate a list or just a choice drop down within a new item.  Any help would be appreciated.

Page 1 of 1 (5 items)

Need SharePoint Training? Attend a SharePoint Bootcamp!
Forum content (c) original posters. Everything else (c) 2008 SharePoint Experts, Inc.