dbo.templates

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:34 PM
Last Modified 4/3/2016 12:31:43 AM

Columns

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

True

False

False

template_name varchar 100 0 0

False

False

False

start_template varchar 100 0 0

False

False

False

item_template varchar 100 0 0

False

False

False

end_template varchar 100 0 0

False

False

False

start_html text 0 0

False

False

False

item_html text 0 0

False

False

False

end_html text 0 0

False

False

False

Indexes

1
Key Name Columns Unique Type Description
PK__templates__35BCFE0A template_id

True

Triggers

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

True

True

AFTER DELETE

False

tU_templates

True

True

AFTER UPDATE

False

SQL Script

Copy
CREATE TABLE dbo.templates (
  template_id int NOT NULL,
  template_name varchar(100) NULL,
  start_template varchar(100) NULL,
  item_template varchar(100) NULL,
  end_template varchar(100) NULL,
  start_html text NULL,
  item_html text NULL,
  end_html text NULL,
  PRIMARY KEY NONCLUSTERED (template_id) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER trigger dbo.tD_templates on dbo.templates for DELETE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* DELETE trigger on templates */
begin
  declare  @errno   int,
           @errmsg  varchar(255)
    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* templates R/77 docs ON PARENT DELETE SET NULL */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="templates"
        CHILD_OWNER="", CHILD_TABLE="docs"
        P2C_VERB_PHRASE="R/77", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_77", FK_COLUMNS="template_default" */

    update docs
      set
        /* %SetFK(docs,NULL) */
        docs.template_default = NULL
      from docs,deleted
      where
        /* %JoinFKPK(docs,deleted," = "," and") */
        docs.template_default = deleted.template_id

    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* templates R/74 show_doc ON PARENT DELETE SET NULL */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="templates"
        CHILD_OWNER="", CHILD_TABLE="show_doc"
        P2C_VERB_PHRASE="R/74", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_74", FK_COLUMNS="template_id" */

    update show_doc
      set
        /* %SetFK(show_doc,NULL) */
        show_doc.template_id = NULL
      from show_doc,deleted
      where
        /* %JoinFKPK(show_doc,deleted," = "," and") */
        show_doc.template_id = deleted.template_id


    /* 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_templates on dbo.templates for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on templates */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @instemplate_id int,
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* templates R/77 docs ON PARENT UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="templates"
      CHILD_OWNER="", CHILD_TABLE="docs"
      P2C_VERB_PHRASE="R/77", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_77", FK_COLUMNS="template_default" */

  if
    /* %ParentPK(" or",update) */
    update(template_id)
  begin
    update docs
      set
        /* %SetFK(docs,NULL) */
        docs.template_default = NULL
      from docs,deleted
      where
        /* %JoinFKPK(docs,deleted," = "," and") */
        docs.template_default = deleted.template_id
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* templates R/74 show_doc ON PARENT UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="templates"
      CHILD_OWNER="", CHILD_TABLE="show_doc"
      P2C_VERB_PHRASE="R/74", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_74", FK_COLUMNS="template_id" */

  if
    /* %ParentPK(" or",update) */
    update(template_id)
  begin
    update show_doc
      set
        /* %SetFK(show_doc,NULL) */
        show_doc.template_id = NULL
      from show_doc,deleted
      where
        /* %JoinFKPK(show_doc,deleted," = "," and") */
        show_doc.template_id = deleted.template_id
  end


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

GO

Depends On

3