/* ************************************************************************* *
 *
 * Datei:       tblDeity2Domain.sql
 *
 * Aufgabe:     Tabelle tblDeity2Domain anlegen
 *           
 * Aenderungen: 
 *              2021-09-23, MWN, erstellt.
 *
 * ************************************************************************* */

if not exists (select * from sys.tables where object_id = object_id (N'tblDeity2Domain')) begin

  -- Protokollausgabe
  print 'Anlegen der Tabelle <' + db_name() + '.dbo.tblDeity2Domain>'

  -- drop table tblDeity2Domain
  create table tblDeity2Domain (

      -- Primaerschluessel
      constraint [PK_tblDeity2Domain] primary key ([key])
    ,	[key]					int					identity(1, 1) not null
         
      -- ----------------------------------------------------------------------
      -- Allgemeine Parameter
      -- ----------------------------------------------------------------------
	,	[created]				DateTime			NOT NULL
	,	[lastModified]			DateTime			NOT NULL
                           
      -- ----------------------------------------------------------------------
      -- Parameter
      -- ----------------------------------------------------------------------
    ,	[deityLink]				int					NOT NULL
	,	[domainLink]			int					NOT NULL

  )

  if not exists (select * from sys.tables where object_id = object_id ('tblDeity2Domain')) begin
    print ''
    print '************************************'
    print 'Fehler beim Erstellen der Tabelle tblDeity2Domain'
    print '************************************'
    print ''
  end

end /*else begin  -- [if not exists (Tabelle)...]

  -- Hinzufuegen einer Spalte
  if not exists (select * from syscolumns where name = 'nSeqDataXLink' and id = object_id('tblDeity2Domain') and objectproperty(id, N'IsUserTable') = 1) begin
    print 'alter table tblDeity2Domain add nSeqDataXLink bigint null'
    alter table tblDeity2Domain add nSeqDataXLink bigint null
  end

end  -- [if not exists (Tabelle)...]*/
go

-- :EOF:
