dbo.constantes

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 (~) 1
Created 10/1/2007 3:29:33 PM
Last Modified 10/29/2016 10:25:07 PM

Columns

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

True

False

False

clave_constante varchar 100 0 0

True

False

False

valor1 varchar 100 0 0

False

False

False

valor2 varchar 100 0 0

False

False

False

valor3 varchar 100 0 0

False

False

False

valor4 varchar 100 0 0

False

False

False

valor5 varchar 100 0 0

False

False

False

valor_texto text 0 0

False

False

False

Indexes

1
Key Name Columns Unique Type Description
PK__constantes__023D5A04 tipo_constante, clave_constante

True

Triggers

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

True

True

AFTER INSERT

False

tU_constantes

True

True

AFTER UPDATE

False

Foreign Keys

1
Name Columns Description
FK__constante__tipo___571DF1D5 tipo_constante

SQL Script

Copy
CREATE TABLE dbo.constantes (
  tipo_constante int NOT NULL,
  clave_constante varchar(100) NOT NULL,
  valor1 varchar(100) NULL,
  valor2 varchar(100) NULL,
  valor3 varchar(100) NULL,
  valor4 varchar(100) NULL,
  valor5 varchar(100) NULL,
  valor_texto text NULL,
  PRIMARY KEY NONCLUSTERED (tipo_constante, clave_constante) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER trigger dbo.tI_constantes on dbo.constantes for INSERT as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* INSERT trigger on constantes */
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_constante R/264 constantes ON CHILD INSERT RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_constante"
      CHILD_OWNER="", CHILD_TABLE="constantes"
      P2C_VERB_PHRASE="R/264", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_264", FK_COLUMNS="tipo_constante" */

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

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* tipos_constante R/264 constantes ON CHILD UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="tipos_constante"
      CHILD_OWNER="", CHILD_TABLE="constantes"
      P2C_VERB_PHRASE="R/264", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_264", FK_COLUMNS="tipo_constante" */

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

Depends On

2