1

what are the important reasons to not query sharepoint production databases , if we want to run even select sql queries is any issue to database? in a case if i want to do select query and want to know how many number of rows in alldocs table how can i know?

2

The issue is it is generally not supported. Your queries can introduce locks of various sorts, which may prevent something SharePoint is attempting to do succeed. So while reading is highly discouraged (and writing is outright not supported), if you must, for some reason query directly where the SharePoint OM doesn't fit, always use (NoLock). It doesn't totally prevent locks, but it is better than not using it.

Support for changes to the databases that are used by Office server products and by Windows SharePoint Services

1

Unsupported by MS.

From MSDN: https://msdn.microsoft.com/en-us/library/office/bb861829(v=office.12).aspx

Direct modification of the SharePoint database or its data is not recommended because it puts the environment in an unsupported state. If a server component requires information from the database, it must get that data by using the appropriate items in the SharePoint object model, and not by trying to get the items from the data structures in the database through some query mechanism.

It is not good practice. And normally you do not need it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.