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

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

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

  -- drop table tblDeities
  create table tblDeities (

      -- Primaerschluessel
      constraint [PK_tblDeities] primary key ([key])
    ,	[key]					int					identity(1, 1) not null

	 -- ----------------------------------------------------------------------
      -- Allgemeine Parameter
      -- ----------------------------------------------------------------------
	,	[created]				DateTime			NOT NULL
	,	[lastModified]			DateTime			NOT NULL
                          
      -- ----------------------------------------------------------------------
      -- Parameter
      -- ----------------------------------------------------------------------
    ,	[name]					nvarchar(250)		NOT NULL
	,	[alignmentLink]			int					NOT NULL
	,	[portfolio]				nvarchar(250)		NOT NULL
	,	[description]			nvarchar(max)		NOT NULL
	,	[favoredWeaponLink]		int					NOT NULL


	
  ) 
  
  if not exists (select * from sys.tables where object_id = object_id ('tblDeities')) begin
    print ''
    print '************************************'
    print 'Fehler beim Erstellen der Tabelle tblDeities'
    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('tblDeities') and objectproperty(id, N'IsUserTable') = 1) begin
    print 'alter table tblDeities add nSeqDataXLink bigint null'
    alter table tblDeities add nSeqDataXLink bigint null
  end

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

-- :EOF:
