dbo.balances

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 (~) 0
Created 10/1/2007 3:29:33 PM
Last Modified 7/22/2017 11:00:12 PM

Columns

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

True

False

False

identificador varchar 10 0 0

False

False

False

numero varchar 50 0 0

False

False

False

desde smalldatetime 4 16 0

False

False

False

hasta smalldatetime 4 16 0

False

False

False

fecha_obtencion smalldatetime 4 16 0

False

False

False

obtenido_por int 4 10 0

False

False

False

Indexes

1
Key Name Columns Unique Type Description
PK__balances__7A9C383C balance

True

Triggers

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

True

True

AFTER DELETE

False

tU_balances

True

True

AFTER UPDATE

False

SQL Script

Copy
CREATE TABLE dbo.balances (
  balance int NOT NULL,
  identificador varchar(10) NULL,
  numero varchar(50) NULL,
  desde smalldatetime NULL,
  hasta smalldatetime NULL,
  fecha_obtencion smalldatetime NULL,
  obtenido_por int NULL,
  PRIMARY KEY NONCLUSTERED (balance) WITH (FILLFACTOR = 20)
)
ON [PRIMARY]
GO

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

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

    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* balances R/275 balance_cuentas ON PARENT DELETE RESTRICT */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="balances"
        CHILD_OWNER="", CHILD_TABLE="balance_cuentas"
        P2C_VERB_PHRASE="R/275", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_275", FK_COLUMNS="balance" */

    if exists (
      select * from deleted,balance_cuentas
      where
        /*  %JoinFKPK(balance_cuentas,deleted," = "," and") */
        balance_cuentas.balance = deleted.balance
    )
    begin
      select @errno  = 30001,
             @errmsg = 'Cannot DELETE balances because balance_cuentas 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.tU_balances on dbo.balances for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on balances */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @insbalance int,
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* balances R/277 informe_balances ON PARENT UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="balances"
      CHILD_OWNER="", CHILD_TABLE="informe_balances"
      P2C_VERB_PHRASE="R/277", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_277", FK_COLUMNS="balance" */

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

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* balances R/275 balance_cuentas ON PARENT UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="balances"
      CHILD_OWNER="", CHILD_TABLE="balance_cuentas"
      P2C_VERB_PHRASE="R/275", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_275", FK_COLUMNS="balance" */

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


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

GO

Depends On

3