Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*==============================================================*/
- /* DBMS name: Microsoft SQL Server 2008 */
- /* Created on: 07.05.2018 14:20:30 */
- /*==============================================================*/
- if exists (select 1
- from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
- where r.fkeyid = object_id('wiadomosc') and o.name = 'FK_WIADOMOS_RELATIONS_DZIAL')
- alter table wiadomosc
- drop constraint FK_WIADOMOS_RELATIONS_DZIAL
- go
- if exists (select 1
- from sysobjects
- where id = object_id('dzial')
- and type = 'U')
- drop table dzial
- go
- if exists (select 1
- from sysindexes
- where id = object_id('wiadomosc')
- and name = 'Relationship_1_FK'
- and indid > 0
- and indid < 255)
- drop index wiadomosc.Relationship_1_FK
- go
- if exists (select 1
- from sysobjects
- where id = object_id('wiadomosc')
- and type = 'U')
- drop table wiadomosc
- go
- /*==============================================================*/
- /* Table: dzial */
- /*==============================================================*/
- create table dzial (
- id_dzial int not null,
- nazwa_dzial varchar(50) not null,
- constraint PK_DZIAL primary key nonclustered (id_dzial)
- )
- go
- /*==============================================================*/
- /* Table: wiadomosc */
- /*==============================================================*/
- create table wiadomosc (
- id_wiadomosc int not null,
- id_dzial int not null,
- Imie varchar(50) not null,
- Nazwisko varchar(50) not null,
- "E-mail" varchar(50) not null,
- telefon varchar(50) not null,
- tresc varchar(500) not null,
- constraint PK_WIADOMOSC primary key nonclustered (id_wiadomosc)
- )
- go
- /*==============================================================*/
- /* Index: Relationship_1_FK */
- /*==============================================================*/
- create index Relationship_1_FK on wiadomosc (
- id_dzial ASC
- )
- go
- alter table wiadomosc
- add constraint FK_WIADOMOS_RELATIONS_DZIAL foreign key (id_dzial)
- references dzial (id_dzial)
- go
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement