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

Columns

2
Key Name Data Type Length Precision Scale Not Null Identity Rule Default Computed Persisted Description
rol smallint 2 5 0

True

False

False

id_tipo_informe int 4 10 0

True

False

False

Indexes

1
Key Name Columns Unique Type Description
PK__roles_tipo_infor__2E1BDC42 rol, id_tipo_informe

True

Triggers

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

True

True

AFTER INSERT

False

tU_roles_tipo_informe

True

True

AFTER UPDATE

False

Foreign Keys

1
Name Columns Description
FK__roles_tipo___rol__6E01572D rol

SQL Script

Copy
CREATE TABLE dbo.roles_tipo_informe (
  rol smallint NOT NULL,
  id_tipo_informe int NOT NULL,
  PRIMARY KEY NONCLUSTERED (rol, id_tipo_informe) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER trigger dbo.tI_roles_tipo_informe on dbo.roles_tipo_informe for INSERT as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* INSERT trigger on roles_tipo_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 */
  /* roles R/257 roles_tipo_informe ON CHILD INSERT RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="roles"
      CHILD_OWNER="", CHILD_TABLE="roles_tipo_informe"
      P2C_VERB_PHRASE="R/257", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_257", FK_COLUMNS="rol" */

  if
    /* %ChildFK(" or",update) */
    update(rol)
  begin
    select @nullcnt = 0
    select @validcnt = count(*)
      from inserted,roles
        where
          /* %JoinFKPK(inserted,roles) */
          inserted.rol = roles.rol
    /* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
    
    if @validcnt + @nullcnt != @numrows
    begin
      select @errno  = 30002,
             @errmsg = 'Cannot INSERT roles_tipo_informe because roles 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_roles_tipo_informe on dbo.roles_tipo_informe for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on roles_tipo_informe */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @insrol smallint, 
           @insid_tipo_informe int,
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* roles R/257 roles_tipo_informe ON CHILD UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="roles"
      CHILD_OWNER="", CHILD_TABLE="roles_tipo_informe"
      P2C_VERB_PHRASE="R/257", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_257", FK_COLUMNS="rol" */

  if
    /* %ChildFK(" or",update) */
    update(rol)
  begin
    select @nullcnt = 0
    select @validcnt = count(*)
      from inserted,roles
        where
          /* %JoinFKPK(inserted,roles) */
          inserted.rol = roles.rol
    /* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
    
    if @validcnt + @nullcnt != @numrows
    begin
      select @errno  = 30007,
             @errmsg = 'Cannot UPDATE roles_tipo_informe because roles 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.roles_tipo_informe
  ADD FOREIGN KEY (rol) REFERENCES dbo.roles (rol)
GO

Depends On

1