SQL Server Configuration- How to check DB is ready?

  • Hi,

    I am implementing SQL Server config for my packages. But before the package runs, I want to make sure that the DB where the config table reside is available. If it its not available I want to switch it to different server/db. Any suggestions how I can achieve that?

  • You could try SELECT TOP 1 1 FROM database.schema.table and see if an error is returned or not. Or, if it is a linked server it would be linkedserver.database.schema.table

    Jared
    CE - Microsoft

  • Thanks

  • You could also do an existence check on sys.objects for the table name or check that object_id('tablename') isn't NULL.

  • check the state_desc column in master.sys.databases = 'online'

    ---------------------------------------------------------------------

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply