dbo.identificadores

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 (~) 348
Created 10/1/2007 3:29:34 PM
Last Modified 12/4/2023 2:34:34 PM

Columns

8
Key Name Data Type Length Precision Scale Not Null Identity Rule Default Computed Persisted Description
identificador varchar 10 0 0

True

False

False

nombre_identificador varchar 100 0 0

False

False

False

country_code varchar 2 0 0

False

False

False

abreviatura varchar 20 0 0

False

False

False

se_usa bit 1 1 0

True

(1)

False

False

tipo_ident char 1 0 0

False

False

False

es_pasaporte bit 1 1 0

False

False

False

orden int 4 10 0

False

False

False

Indexes

1
Key Name Columns Unique Type Description
PK__identificadores__1B0907CE identificador

True

Triggers

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

True

True

AFTER DELETE

False

tI_identificadores

True

True

AFTER INSERT

False

tU_identificadores

True

True

AFTER UPDATE

False

Foreign Keys

20
Name Columns Description
FK__identific__count__4213A24E country_code
FK__identific__count__4307C687 country_code
FK__identific__count__43FBEAC0 country_code
FK__identific__count__44F00EF9 country_code
FK__identific__count__45E43332 country_code
FK__identific__count__46D8576B country_code
FK__identific__count__47CC7BA4 country_code
FK__identific__count__48C09FDD country_code
FK__identific__count__49B4C416 country_code
FK__identific__count__4AA8E84F country_code
FK__identific__count__4B9D0C88 country_code
FK__identific__count__4C9130C1 country_code
FK__identific__count__4D8554FA country_code
FK__identific__count__4E797933 country_code
FK__identific__count__4F6D9D6C country_code
FK__identific__count__5061C1A5 country_code
FK__identific__count__5155E5DE country_code
FK__identific__count__54325289 country_code
FK__identific__count__552676C2 country_code
FK__identific__count__59EB2BDF country_code

SQL Script

Copy
CREATE TABLE dbo.identificadores (
  identificador varchar(10) NOT NULL,
  nombre_identificador varchar(100) NULL,
  country_code varchar(2) NULL,
  abreviatura varchar(20) NULL,
  se_usa bit NOT NULL DEFAULT (1),
  tipo_ident char(1) NULL,
  es_pasaporte bit NULL,
  orden int NULL,
  PRIMARY KEY NONCLUSTERED (identificador) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
GO

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

    if exists (
      select * from deleted,padrones
      where
        /*  %JoinFKPK(padrones,deleted," = "," and") */
        padrones.identificador = deleted.identificador
    )
    begin
      select @errno  = 30001,
             @errmsg = 'Cannot DELETE identificadores because padrones exists.'
      goto error
    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.tI_identificadores on dbo.identificadores for INSERT as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* INSERT trigger on identificadores */
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 */
  /* country R/246 identificadores ON CHILD INSERT SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="country"
      CHILD_OWNER="", CHILD_TABLE="identificadores"
      P2C_VERB_PHRASE="R/246", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_246", FK_COLUMNS="country_code" */

  if
    /* %ChildFK(" or",update) */
    update(country_code)
  begin
    update identificadores
      set
        /* %SetFK(identificadores,NULL) */
        identificadores.country_code = NULL
      from identificadores,inserted
      where
        /* %JoinPKPK(identificadores,inserted," = "," and") */
  identificadores.identificador = inserted.identificador and
   
        not exists (
          select * from country
          where
            /* %JoinFKPK(inserted,country," = "," and") */
            inserted.country_code = country.country_code
        )
  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_identificadores on dbo.identificadores for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on identificadores */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @insidentificador varchar(10),
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* identificadores R/248 padrones ON PARENT UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="identificadores"
      CHILD_OWNER="", CHILD_TABLE="padrones"
      P2C_VERB_PHRASE="R/248", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_248", FK_COLUMNS="identificador" */

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

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* country R/246 identificadores ON CHILD UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="country"
      CHILD_OWNER="", CHILD_TABLE="identificadores"
      P2C_VERB_PHRASE="R/246", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_246", FK_COLUMNS="country_code" */

  if
    /* %ChildFK(" or",update) */
    update(country_code)
  begin
    update identificadores
      set
        /* %SetFK(identificadores,NULL) */
        identificadores.country_code = NULL
      from identificadores,inserted
      where
        /* %JoinPKPK(identificadores,inserted," = "," and") */
  identificadores.identificador = inserted.identificador and
   
        not exists (
          select * from country
          where
            /* %JoinFKPK(inserted,country," = "," and") */
            inserted.country_code = country.country_code
        )
  end


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

GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

ALTER TABLE dbo.identificadores
  ADD FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

Depends On

3

Used By

343