dbo.tipos_subinformes

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 (~) 3152
Created 10/1/2007 3:29:34 PM
Last Modified 4/3/2016 12:31:45 AM

Columns

11
Key Name Data Type Length Precision Scale Not Null Identity Rule Default Computed Persisted Description
id_tipo_subinforme int 4 10 0

True

False

False

opcional tinyint 1 3 0

False

False

False

id_tipo_informe int 4 10 0

True

False

False

orden tinyint 1 3 0

False

False

False

avance decimal 5 6 2

False

False

False

f_est_dias_urgente smallint 2 5 0

False

False

False

f_est_dias_normal smallint 2 5 0

False

False

False

f_est_dias_demo smallint 2 5 0

False

False

False

f_comp_dias_urgente smallint 2 5 0

False

False

False

f_comp_dias_normal smallint 2 5 0

False

False

False

f_comp_dias_demo smallint 2 5 0

False

False

False

Indexes

1
Key Name Columns Unique Type Description
PK__tipos_subinforme__3F466844 id_tipo_informe, id_tipo_subinforme

True

Triggers

2
Name ANSI Nulls ON Quoted Identifier ON On Not For Replication Description
tI_tipos_subinformes

True

True

AFTER INSERT

False

tU_tipos_subinformes

True

True

AFTER UPDATE

False

Foreign Keys

1
Name Columns Description
FK__tipos_sub__id_ti__787EE5A0 id_tipo_informe

SQL Script

Copy
CREATE TABLE dbo.tipos_subinformes (
  id_tipo_subinforme int NOT NULL,
  opcional tinyint NULL,
  id_tipo_informe int NOT NULL,
  orden tinyint NULL,
  avance decimal(6, 2) NULL,
  f_est_dias_urgente smallint NULL,
  f_est_dias_normal smallint NULL,
  f_est_dias_demo smallint NULL,
  f_comp_dias_urgente smallint NULL,
  f_comp_dias_normal smallint NULL,
  f_comp_dias_demo smallint NULL,
  PRIMARY KEY NONCLUSTERED (id_tipo_informe, id_tipo_subinforme) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER trigger dbo.tI_tipos_subinformes on dbo.tipos_subinformes for INSERT as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* INSERT trigger on tipos_subinformes */
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 */
  /* tipos_informe R/230 tipos_subinformes ON CHILD INSERT 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
    /* %ChildFK(" or",update) */
    update(id_tipo_informe)
  begin
    select @nullcnt = 0
    select @validcnt = count(*)
      from inserted,tipos_informe
        where
          /* %JoinFKPK(inserted,tipos_informe) */
          inserted.id_tipo_informe = tipos_informe.id_tipo_informe
    /* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
    
    if @validcnt + @nullcnt != @numrows
    begin
      select @errno  = 30002,
             @errmsg = 'Cannot INSERT tipos_subinformes because tipos_informe does not exist.'
      goto error
    end
  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_subinformes on dbo.tipos_subinformes for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on tipos_subinformes */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @insid_tipo_informe int, 
           @insid_tipo_subinforme int,
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* tipos_informe R/230 tipos_subinformes ON CHILD 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
    /* %ChildFK(" or",update) */
    update(id_tipo_informe)
  begin
    select @nullcnt = 0
    select @validcnt = count(*)
      from inserted,tipos_informe
        where
          /* %JoinFKPK(inserted,tipos_informe) */
          inserted.id_tipo_informe = tipos_informe.id_tipo_informe
    /* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
    
    if @validcnt + @nullcnt != @numrows
    begin
      select @errno  = 30007,
             @errmsg = 'Cannot UPDATE tipos_subinformes because tipos_informe does not exist.'
      goto error
    end
  end


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

GO

ALTER TABLE dbo.tipos_subinformes
  ADD FOREIGN KEY (id_tipo_informe) REFERENCES dbo.tipos_informe (id_tipo_informe)
GO

Depends On

1