IF NOT EXISTS
   (SELECT 1
   FROM    sys.tables
   WHERE   object_name(object_id) = 'GLB_MEDICOS_TP_DOC '
   )
   BEGIN
      CREATE TABLE dbo.GLB_MEDICOS_TP_DOC
                   (
                                CD_TP_DOC TINYINT NOT NULL,
                                DS_TP_DOC VARCHAR(50) NOT NULL
                   )
      ON [PRIMARY]
      ALTER TABLE dbo.GLB_MEDICOS_TP_DOC ADD CONSTRAINT PK_GLB_MEDICOS_TP_DOC PRIMARY KEY CLUSTERED ( CD_TP_DOC ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
      ON [PRIMARY]
      ALTER TABLE dbo.GLB_MEDICOS_TP_DOC ADD CONSTRAINT FK_GLB_MEDICOS_TP_DOC_GLB_MEDICOS_TP_DOC FOREIGN KEY ( CD_TP_DOC ) REFERENCES dbo.GLB_MEDICOS_TP_DOC ( CD_TP_DOC )
      ON
      UPDATE NO ACTION
      ON
      DELETE NO ACTION
      ALTER TABLE dbo.GLB_MEDICOS_TP_DOC SET (LOCK_ESCALATION = TABLE)
      INSERT
      INTO   GLB_MEDICOS_TP_DOC
      SELECT 0,
             'NÃO DEFINIDO'
      INSERT
      INTO   GLB_MEDICOS_TP_DOC
      SELECT 1,
             'CRM'
      INSERT
      INTO   GLB_MEDICOS_TP_DOC
      SELECT 2,
             'CRO'
      INSERT
      INTO   GLB_MEDICOS_TP_DOC
      SELECT 3,
             'CRMV'
      INSERT
      INTO   GLB_MEDICOS_TP_DOC
      SELECT 4,
             'CRN'
      INSERT
      INTO   GLB_MEDICOS_TP_DOC
      SELECT 5,
             'CRP'
      INSERT
      INTO   GLB_MEDICOS_TP_DOC
      SELECT 6,
             'COREN'
      INSERT
      INTO   GLB_MEDICOS_TP_DOC
      SELECT 7,
             'RMS'
END