SQL to Determine if a Project is in the Published Database

問題 SQL to Determine if a Project is in the Published Database

  • 2012年6月4日 12:43
     
     

    We have projects that have been published, so they have a value in the 'Last Published' field in both the Draft and Published DBs.

    Sometimes we delete projects from the Published database only and the 'Last Published' field remains populated.

    But, I need to determine if the project is in the Published database by querying SQL.  What's the best option?  Simply comparing projects in the Published vs. Draft database doesnt work...even after deleting from the Published store, the project is still referenced in the Published DB?

    So, what is the best option for identifying whether or not a project is in the published database using SQL?

所有回覆

  • 2012年6月4日 15:06
     
      包含代碼

    Hi Joe,

    You can run the same query in draft & published database for the project to find if the project exists in draft/published. You can use the NOT IN clause to validate.

    SELECT p.PROJ_UID, p.PROJ_NAME FROM MSP_PROJECTS p
    WHERE p.PROJ_NAME like '%<YourProjectName>%'

    Just FYI: direct T-SQL to the Draft DB is not supported.
    http://msdn.microsoft.com/en-us/library/ms504195.aspx


    If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”. Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82