AzubiProjekt/SQL/1_tables/tblArmors.sql
2021-09-24 14:16:37 +02:00

68 lines
2.3 KiB
Transact-SQL

/* ************************************************************************* *
*
* Datei: tblArmors.sql
*
* Aufgabe: Tabelle tblArmors anlegen
*
* Aenderungen:
* 2021-09-23, MWN, erstellt.
*
* ************************************************************************* */
if not exists (select * from sys.tables where object_id = object_id (N'tblArmors')) begin
-- Protokollausgabe
print 'Anlegen der Tabelle <' + db_name() + '.dbo.tblArmors>'
-- drop table tblArmors
create table tblArmors (
-- Primaerschluessel
constraint [PK_tblArmors] 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
, [category] nvarchar(250) NOT NULL
, [cost] int NOT NULL
, [currency] nvarchar(250) NOT NULL
, [armorbonus] int NOT NULL
, [maxDexBonus] int NOT NULL
, [ArmorCheckPenalty] int NOT NULL
, [ArcaneSpellFailureChance] int NOT NULL
, [speed30] int NOT NULL
, [speed20] int NOT NULL
, [weight] int NOT NULL
, [hasMetal] bit NOT NULL
, [special] nvarchar(max) NOT NULL
)
if not exists (select * from sys.tables where object_id = object_id ('tblArmors')) begin
print ''
print '************************************'
print 'Fehler beim Erstellen der Tabelle tblArmors'
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('tblArmors') and objectproperty(id, N'IsUserTable') = 1) begin
print 'alter table tblArmors add nSeqDataXLink bigint null'
alter table tblArmors add nSeqDataXLink bigint null
end
end -- [if not exists (Tabelle)...]*/
go
-- :EOF: