views:

168

answers:

2

Hi i want to retrive some data from sharepoint database . what i have to do. how can i make query on sharepoint database?

+4  A: 

You shouldn't because of these reasons:

  1. This is completely unsupported by the EULA you agreed to when you installed SharePoint.
  2. Your queries are not guaranteed to work after applying any patches or service packs to SharePoint since Microsoft could change the database schema anytime.
  3. Directly querying the database can place extra load on a server and hence performance issues.
  4. Direct SELECT statements against the database take shared read locks at the default transaction level so your custom queries might cause deadlocks and hence stability issues.
  5. Your custom queries might lead to incorrect data being retrieved.

Let me clarify, that #1 DOES NOT ALLOW you to modify sharepoint database in any way. SELECT`ing is permitted, however, as mentioned, that may lead to other problems.

However, if you are not interested in these points, then just use Visual Studio to connect to existing database, just do the regular procedure on how you connect to any other database.

But you can make your own database and store some additional information there.

Access SharePoint data the right way

  1. Use SharePoint Object Model (Code can only be run on SharePoint server)
  2. Use SharePoint WebServices (Run code from anywhere, from any application)
Janis Veinbergs
+1  A: 

I have one thing to add. If you do decide to query sharepoint content databases directy, use the NOLOCK hint to prevent shared lock being taken out and potentially creating dead locks in the application.

unclepaul84