Recent Posts

Tuesday, March 26, 2013

How to extract Sharepoint list using SQL Query

I was searching for Sql query to be able to extract the list from Sharepoint database and found a good link that helped me fix the issue

Querying Sharepoint List Item Versions using SQL

Which actually gives the info on list and full sql query to get the list is here:
Hope this helps... enjoy


Declare @ListID as uniqueidentifier

SET @ListID =(SELECT tp_id FROM dbo.AllLists WHERE tp_title ='New User Request')
   --select @ListID
   
   
SELECT      dbo.UserData.tp_ID,
  dbo.UserData.tp_ListId,
  dbo.UserData.tp_Author,
  dbo.UserData.nvarchar1,
                dbo.UserData.nvarchar2,
  dbo.UserData.nvarchar3,
  dbo.UserData.nvarchar4,
  dbo.UserData.nvarchar5,
                dbo.UserData.nvarchar6,
  dbo.UserData.nvarchar7,
  dbo.UserData.nvarchar8,
  dbo.UserData.nvarchar9 ,
                dbo.UserData.nvarchar10,
  dbo.UserData.nvarchar11,
  dbo.UserData.nvarchar12,
  dbo.UserData.*                  --dont forget to modify this to snatch only the columns you need
FROM            dbo.Lists
INNER JOIN
                dbo.UserData ON dbo.Lists.tp_ID = dbo.UserData.tp_ListId
               
               
WHERE  
(dbo.UserData.tp_ListId =@ListID)

Related Posts by Categories




No comments:

Post a Comment