Database containment and c

  • Thomas Franz

    Hall of Fame

    Points: 3565

    Comments posted to this topic are about the item Database containment and c

    God is real, unless declared integer.

  • Solomon Rutzky

    SSCoach

    Points: 16135

    Hi Thomas. Interesting question. A few notes:

    1. Most importantly, there is a typo in the setup code, implying that the answer should be the opposite of what it really is. In the part where you state that you are going to set the test database to "partial containment", your SQL statement actually sets it to its current state of "none". You have:
      ALTER DATABASE [test_cont] SET CONTAINMENT = NONE WITH NO_WAIT

      when it should be:

      ALTER DATABASE [test_cont] SET CONTAINMENT = PARTIAL WITH NO_WAIT;

      Changing this would have the T-SQL match the text description of what's going on.

    2.  Official documentation is here:Contained Database Collations
    3. Minor point, but your initial setup code block could be simplified to be just the following:
      CREATE DATABASE [test_cont]
      CONTAINMENT = NONE
      COLLATE Latin1_General_CI_AS_KS;

      or even just the following, since "NONE" is the default for containment type anyway:

      CREATE DATABASE [test_cont]
      COLLATE Latin1_General_CI_AS_KS;

     

    Take care,

    Solomon....

     

    SQL#https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
    Sql Quantum Lifthttps://SqlQuantumLift.com/ ( company )
    Sql Quantum Leaphttps://SqlQuantumLeap.com/ ( blog )
    Info sitesCollations     •     Module Signing     •     SQLCLR

  • Carlo Romagnano

    SSC-Insane

    Points: 21810

  • Stewart "Arturius" Campbell

    SSC Guru

    Points: 71444

    Nice question ,thanks Thomas.

     

    Concur with Solomon about the slight mix-up

    "

    ALTER DATABASE [test_cont] SET CONTAINMENT = NONE WITH NO_WAIT

    when it should be:

    ALTER DATABASE [test_cont] SET CONTAINMENT = PARTIAL WITH NO_WAIT;

    "

     

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”

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

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