dbo.tipos_informe

Description

Properties

Name Value
File Collation
File Group
Filestream File Group
Is Partitioned

False

Partitioned Column
Partition Scheme
File Groups
Filestream Partition Scheme
Filestream File Groups
Heap

True

Full Text Catalog
Full Text
Compression NONE
Row Count (~) 430
Created 10/1/2007 3:29:34 PM
Last Modified 11/29/2024 5:15:57 PM

Columns

35
Key Name Data Type Length Precision Scale Not Null Identity Rule Default Computed Persisted Description
tipo_informe varchar 30 0 0

True

False

False

version varchar 20 0 0

True

False

False

id_tipo_informe int 4 10 0

True

False

False

nombre_tipo_informe varchar 100 0 0

False

False

False

fecha_version smalldatetime 4 16 0

False

False

False

descripcion text 0 0

False

False

False

grupo smallint 2 5 0

False

False

False

cliente int 4 10 0

False

False

False

vigente tinyint 1 3 0

False

False

False

country_code varchar 2 0 0

False

False

False

duracion datetime 8 23 3

False

False

False

lista1 money 8 19 4

False

False

False

lista2 money 8 19 4

False

False

False

lista3 money 8 19 4

False

False

False

lista4 money 8 19 4

False

False

False

lista5 money 8 19 4

False

False

False

visible_publico tinyint 1 3 0

False

False

False

texto_email text 0 0

False

False

False

email_habilitado tinyint 1 3 0

False

False

False

tipo_tarea tinyint 1 3 0

False

False

False

selec_nuevo_informe tinyint 1 3 0

False

False

False

email_bcc varchar 200 0 0

False

False

False

grupo_informes varchar 20 0 0

False

False

False

nombre_relacion_comercial varchar 200 0 0

False

False

False

prioridad_default tinyint 1 3 0

False

False

False

daga_activo tinyint 1 3 0

False

False

False

genera_solicitud_doc tinyint 1 3 0

False

(0)

False

False

tipo_producto tinyint 1 3 0

False

False

False

bcc_habilitado tinyint 1 3 0

False

(0)

False

False

texto_email_bcc text 0 0

False

False

False

texto_email_solicitud text 0 0

False

False

False

asunto_email_solicitud varchar 255 0 0

False

False

False

confidencial tinyint 1 3 0

True

(0)

False

False

servicio_contratado int 4 10 0

False

False

False

idTipoInforme int 4 10 0

True

1 - 1

False

False

Indexes

2
Key Name Columns Unique Type Description
PK__tipos_informe__398D8EEE id_tipo_informe

True

XAK1tipos_informe tipo_informe, version

True

Triggers

3
Name ANSI Nulls ON Quoted Identifier ON On Not For Replication Description
tD_tipos_informe

True

True

AFTER DELETE

False

tI_tipos_informe

True

True

AFTER INSERT

False

tU_tipos_informe

True

True

AFTER UPDATE

False

Foreign Keys

2
Name Columns Description
FK__tipos_inf__clien__72C60C4A cliente
FK__tipos_inf__grupo__73BA3083 grupo

SQL Script

Copy
CREATE TABLE dbo.tipos_informe (
  tipo_informe varchar(30) NOT NULL,
  version varchar(20) NOT NULL,
  id_tipo_informe int NOT NULL,
  nombre_tipo_informe varchar(100) NULL,
  fecha_version smalldatetime NULL,
  descripcion text NULL,
  grupo smallint NULL,
  cliente int NULL,
  vigente tinyint NULL,
  country_code varchar(2) NULL,
  duracion datetime NULL,
  lista1 money NULL,
  lista2 money NULL,
  lista3 money NULL,
  lista4 money NULL,
  lista5 money NULL,
  visible_publico tinyint NULL,
  texto_email text NULL,
  email_habilitado tinyint NULL,
  tipo_tarea tinyint NULL,
  selec_nuevo_informe tinyint NULL,
  email_bcc varchar(200) NULL,
  grupo_informes varchar(20) NULL,
  nombre_relacion_comercial varchar(200) NULL,
  prioridad_default tinyint NULL,
  daga_activo tinyint NULL,
  genera_solicitud_doc tinyint NULL DEFAULT (0),
  tipo_producto tinyint NULL,
  bcc_habilitado tinyint NULL DEFAULT (0),
  texto_email_bcc text NULL,
  texto_email_solicitud text NULL,
  asunto_email_solicitud varchar(255) NULL,
  confidencial tinyint NOT NULL DEFAULT (0),
  servicio_contratado int NULL,
  idTipoInforme int IDENTITY,
  PRIMARY KEY NONCLUSTERED (id_tipo_informe) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO

CREATE UNIQUE INDEX XAK1tipos_informe
  ON dbo.tipos_informe (tipo_informe, version)
  WITH (FILLFACTOR = 90)
  ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER trigger dbo.tD_tipos_informe on dbo.tipos_informe for DELETE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* DELETE trigger on tipos_informe */
begin
  declare  @errno   int,
           @errmsg  varchar(255)
    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* tipos_informe R/270 tipos_informes_requeridos ON PARENT DELETE RESTRICT */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_informe"
        CHILD_OWNER="", CHILD_TABLE="tipos_informes_requeridos"
        P2C_VERB_PHRASE="R/270", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_270", FK_COLUMNS="id_tipo_informe" */

    if exists (
      select * from deleted,tipos_informes_requeridos
      where
        /*  %JoinFKPK(tipos_informes_requeridos,deleted," = "," and") */
        tipos_informes_requeridos.id_tipo_informe = deleted.id_tipo_informe
    )
    begin
      select @errno  = 30001,
             @errmsg = 'Cannot DELETE tipos_informe because tipos_informes_requeridos exists.'
      goto error
    end

    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* tipos_informe R/265 tipos_informe_variables ON PARENT DELETE RESTRICT */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_informe"
        CHILD_OWNER="", CHILD_TABLE="tipos_informe_variables"
        P2C_VERB_PHRASE="R/265", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_265", FK_COLUMNS="id_tipo_informe" */

    if exists (
      select * from deleted,tipos_informe_variables
      where
        /*  %JoinFKPK(tipos_informe_variables,deleted," = "," and") */
        tipos_informe_variables.id_tipo_informe = deleted.id_tipo_informe
    )
    begin
      select @errno  = 30001,
             @errmsg = 'Cannot DELETE tipos_informe because tipos_informe_variables exists.'
      goto error
    end

    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* tipos_informe R/230 tipos_subinformes ON PARENT DELETE RESTRICT */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_informe"
        CHILD_OWNER="", CHILD_TABLE="tipos_subinformes"
        P2C_VERB_PHRASE="R/230", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_230", FK_COLUMNS="id_tipo_informe" */

    if exists (
      select * from deleted,tipos_subinformes
      where
        /*  %JoinFKPK(tipos_subinformes,deleted," = "," and") */
        tipos_subinformes.id_tipo_informe = deleted.id_tipo_informe
    )
    begin
      select @errno  = 30001,
             @errmsg = 'Cannot DELETE tipos_informe because tipos_subinformes exists.'
      goto error
    end

    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* tipos_informe R/229 informes ON PARENT DELETE SET NULL */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_informe"
        CHILD_OWNER="", CHILD_TABLE="informes"
        P2C_VERB_PHRASE="R/229", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_229", FK_COLUMNS="id_tipo_informe" */

    update informes
      set
        /* %SetFK(informes,NULL) */
        informes.id_tipo_informe = NULL
      from informes,deleted
      where
        /* %JoinFKPK(informes,deleted," = "," and") */
        informes.id_tipo_informe = deleted.id_tipo_informe


    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    return
error:
    raiserror (@errmsg,@errno,1) 
    rollback transaction
end

GO
CREATE OR ALTER trigger dbo.tI_tipos_informe on dbo.tipos_informe for INSERT as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* INSERT trigger on tipos_informe */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* clientes R/263 tipos_informe ON CHILD INSERT SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
      CHILD_OWNER="", CHILD_TABLE="tipos_informe"
      P2C_VERB_PHRASE="R/263", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_263", FK_COLUMNS="cliente" */

  if
    /* %ChildFK(" or",update) */
    update(cliente)
  begin
    update tipos_informe
      set
        /* %SetFK(tipos_informe,NULL) */
        tipos_informe.cliente = NULL
      from tipos_informe,inserted
      where
        /* %JoinPKPK(tipos_informe,inserted," = "," and") */
  tipos_informe.id_tipo_informe = inserted.id_tipo_informe and
   
        not exists (
          select * from clientes
          where
            /* %JoinFKPK(inserted,clientes," = "," and") */
            inserted.cliente = clientes.cliente
        )
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* grupos R/249 tipos_informe ON CHILD INSERT SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="grupos"
      CHILD_OWNER="", CHILD_TABLE="tipos_informe"
      P2C_VERB_PHRASE="R/249", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_249", FK_COLUMNS="grupo" */

  if
    /* %ChildFK(" or",update) */
    update(grupo)
  begin
    update tipos_informe
      set
        /* %SetFK(tipos_informe,NULL) */
        tipos_informe.grupo = NULL
      from tipos_informe,inserted
      where
        /* %JoinPKPK(tipos_informe,inserted," = "," and") */
  tipos_informe.id_tipo_informe = inserted.id_tipo_informe and
   
        not exists (
          select * from grupos
          where
            /* %JoinFKPK(inserted,grupos," = "," and") */
            inserted.grupo = grupos.grupo
        )
  end


  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  return
error:
    raiserror (@errmsg,@errno,1) 
    rollback transaction
end

GO
CREATE OR ALTER trigger dbo.tU_tipos_informe on dbo.tipos_informe for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on tipos_informe */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @insid_tipo_informe int,
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* tipos_informe R/270 tipos_informes_requeridos ON PARENT UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_informe"
      CHILD_OWNER="", CHILD_TABLE="tipos_informes_requeridos"
      P2C_VERB_PHRASE="R/270", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_270", FK_COLUMNS="id_tipo_informe" */

  if
    /* %ParentPK(" or",update) */
    update(id_tipo_informe)
  begin
    if exists (
      select * from deleted,tipos_informes_requeridos
      where
        /*  %JoinFKPK(tipos_informes_requeridos,deleted," = "," and") */
        tipos_informes_requeridos.id_tipo_informe = deleted.id_tipo_informe
    )
    begin
      select @errno  = 30005,
             @errmsg = 'Cannot UPDATE tipos_informe because tipos_informes_requeridos exists.'
      goto error
    end
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* tipos_informe R/265 tipos_informe_variables ON PARENT UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_informe"
      CHILD_OWNER="", CHILD_TABLE="tipos_informe_variables"
      P2C_VERB_PHRASE="R/265", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_265", FK_COLUMNS="id_tipo_informe" */

  if
    /* %ParentPK(" or",update) */
    update(id_tipo_informe)
  begin
    if exists (
      select * from deleted,tipos_informe_variables
      where
        /*  %JoinFKPK(tipos_informe_variables,deleted," = "," and") */
        tipos_informe_variables.id_tipo_informe = deleted.id_tipo_informe
    )
    begin
      select @errno  = 30005,
             @errmsg = 'Cannot UPDATE tipos_informe because tipos_informe_variables exists.'
      goto error
    end
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* tipos_informe R/230 tipos_subinformes ON PARENT UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_informe"
      CHILD_OWNER="", CHILD_TABLE="tipos_subinformes"
      P2C_VERB_PHRASE="R/230", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_230", FK_COLUMNS="id_tipo_informe" */

  if
    /* %ParentPK(" or",update) */
    update(id_tipo_informe)
  begin
    if exists (
      select * from deleted,tipos_subinformes
      where
        /*  %JoinFKPK(tipos_subinformes,deleted," = "," and") */
        tipos_subinformes.id_tipo_informe = deleted.id_tipo_informe
    )
    begin
      select @errno  = 30005,
             @errmsg = 'Cannot UPDATE tipos_informe because tipos_subinformes exists.'
      goto error
    end
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* tipos_informe R/229 informes ON PARENT UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_informe"
      CHILD_OWNER="", CHILD_TABLE="informes"
      P2C_VERB_PHRASE="R/229", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_229", FK_COLUMNS="id_tipo_informe" */

  if
    /* %ParentPK(" or",update) */
    update(id_tipo_informe)
  begin
    update informes
      set
        /* %SetFK(informes,NULL) */
        informes.id_tipo_informe = NULL
      from informes,deleted
      where
        /* %JoinFKPK(informes,deleted," = "," and") */
        informes.id_tipo_informe = deleted.id_tipo_informe
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* clientes R/263 tipos_informe ON CHILD UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
      CHILD_OWNER="", CHILD_TABLE="tipos_informe"
      P2C_VERB_PHRASE="R/263", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_263", FK_COLUMNS="cliente" */

  if
    /* %ChildFK(" or",update) */
    update(cliente)
  begin
    update tipos_informe
      set
        /* %SetFK(tipos_informe,NULL) */
        tipos_informe.cliente = NULL
      from tipos_informe,inserted
      where
        /* %JoinPKPK(tipos_informe,inserted," = "," and") */
  tipos_informe.id_tipo_informe = inserted.id_tipo_informe and
   
        not exists (
          select * from clientes
          where
            /* %JoinFKPK(inserted,clientes," = "," and") */
            inserted.cliente = clientes.cliente
        )
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* grupos R/249 tipos_informe ON CHILD UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="grupos"
      CHILD_OWNER="", CHILD_TABLE="tipos_informe"
      P2C_VERB_PHRASE="R/249", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_249", FK_COLUMNS="grupo" */

  if
    /* %ChildFK(" or",update) */
    update(grupo)
  begin
    update tipos_informe
      set
        /* %SetFK(tipos_informe,NULL) */
        tipos_informe.grupo = NULL
      from tipos_informe,inserted
      where
        /* %JoinPKPK(tipos_informe,inserted," = "," and") */
  tipos_informe.id_tipo_informe = inserted.id_tipo_informe and
   
        not exists (
          select * from grupos
          where
            /* %JoinFKPK(inserted,grupos," = "," and") */
            inserted.grupo = grupos.grupo
        )
  end


  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  return
error:
    raiserror (@errmsg,@errno,1) 
    rollback transaction
end

GO

ALTER TABLE dbo.tipos_informe WITH NOCHECK
  ADD CONSTRAINT FK__tipos_inf__clien__72C60C4A FOREIGN KEY (cliente) REFERENCES dbo.clientes (cliente)
GO

ALTER TABLE dbo.tipos_informe
  ADD FOREIGN KEY (grupo) REFERENCES dbo.grupos (grupo)
GO