/* ************************************************************************* * * * Datei: tblAlignments.sql * * Aufgabe: Tabelle tblAlignments anlegen * * Aenderungen: * 2021-09-23, MWN, erstellt. * * ************************************************************************* */ if not exists (select * from sys.tables where object_id = object_id (N'tblAlignments')) begin -- Protokollausgabe print 'Anlegen der Tabelle <' + db_name() + '.dbo.tblAlignments>' -- drop table tblAlignments create table tblAlignments ( -- Primaerschluessel constraint [PK_tblAlignments] primary key ([key]) , [key] int identity(1, 1) not null -- ---------------------------------------------------------------------- -- Parameter -- ---------------------------------------------------------------------- , [description] nvarchar(250) NOT NULL ) -- Alle 9 Alignments einfügen insert into tblAlignments ([description]) values (N'Lawful Good'), (N'Neutral Good'), (N'Chaotic Good'), (N'Lawful Neutral'), (N'Neutral'), (N'Chaotic Neutral'), (N'Lawful Evil'), (N'Neutral Evil'), (N'Chaotic Evil') if not exists (select * from sys.tables where object_id = object_id ('tblAlignments')) begin print '' print '************************************' print 'Fehler beim Erstellen der Tabelle tblAlignments' 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('tblAlignments') and objectproperty(id, N'IsUserTable') = 1) begin print 'alter table tblAlignments add nSeqDataXLink bigint null' alter table tblAlignments add nSeqDataXLink bigint null end end -- [if not exists (Tabelle)...]*/ go -- :EOF: