- GO
- CREATE TABLE [dbo].[StreetType] (
- [StreetTypeID] INT IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED ([StreetTypeID] ASC),
- [StreetType] NVARCHAR (150) NOT NULL
- );
-
- GO
- CREATE TABLE [dbo].[Address] (
- [AddressID] INT IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED ([AddressID] ASC),
- [StreetNumber] NVARCHAR (9) NULL,
- [StreetName] NVARCHAR (80) NULL,
- [StreetTypeID] INT NULL,
- [SuburbID] INT NULL,
- CONSTRAINT [FK_dbo.Address_dbo.StreetType_StreetTypeID] FOREIGN KEY ([StreetTypeID]) REFERENCES [dbo].[StreetType] ([StreetTypeID]),
- CONSTRAINT [FK_dbo.Address_dbo.Suburb_SuburbID] FOREIGN KEY ([SuburbID]) REFERENCES [dbo].[Suburb] ([SuburbID])
- );
-
- GO
- CREATE TABLE [dbo].[ConnectType] (
- [ConnectTypeId] INT IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED ([ConnectTypeId] ASC),
- [ConnectType] NVARCHAR (40) NOT NULL
- );
-
- GO
- CREATE TABLE [dbo].[Contact] (
- [ContactID] INT IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED ([ContactID] ASC),
- [ShentonAccCode] NVARCHAR (12) NULL,
- [ContactTypeID] INT NOT NULL,
- [ContactName] NVARCHAR (150) NOT NULL,
- [AddressID] INT NULL,
- [AnnDate] DATE NULL,
- CONSTRAINT [FK_dboContact_dboAddress_AddressID] FOREIGN KEY ([AddressID]) REFERENCES [dbo].[Address] ([AddressID]),
- CONSTRAINT [FK_dboContact_dboContactType_ContactTypeID] FOREIGN KEY ([ContactTypeID]) REFERENCES [dbo].[ContactType] ([ContactTypeID])
- );
-
- GO
- CREATE TABLE [dbo].[ContactPosition] (
- [ContactPositionID] INT IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED ([ContactPositionID] ASC),
- [Position] NVARCHAR (90) NOT NULL
- );
-
- GO
- CREATE TABLE [dbo].[ContactStaff] (
- [ContactStaffID] INT IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED ([ContactStaffID] ASC),
- [ContactID] INT NOT NULL,
- [Name] NVARCHAR (150) NOT NULL,
- [ContactPositionID] INT NULL CONSTRAINT [FK_dbo.ContactStaff_dbo.Contact_ContactID] FOREIGN KEY ([ContactID]) REFERENCES [dbo].[Contact] ([ContactID]),
- CONSTRAINT [FK_dbo.ContactStaff_dbo.ContactPosition_PositionID] FOREIGN KEY ([ContactPositionID]) REFERENCES [dbo].[ContactPosition] ([ContactPositionID])
- );
-
- GO
- CREATE TABLE [dbo].[ContactStaffDetails] (
- [ContactStaffDetailsId] INT IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED ([ContactStaffDetailsId] ASC),
- [ContactID] INT NOT NULL,
- [ContactStaffID] INT NOT NULL,
- [ContactTypeID] INT NOT NULL,
- [ContactDetail] NVARCHAR (200) NULL,
- CONSTRAINT [FK_dbo.ContactStaffDetails_dbo.Contact_ContactID] FOREIGN KEY ([ContactID]) REFERENCES [dbo].[Contact] ([ContactID]),
- CONSTRAINT [FK_dbo.ContactStaffDetails_dbo.ContactStaff_ContactStaffID] FOREIGN KEY ([ContactStaffID]) REFERENCES [dbo].[ContactStaff] ([ContactStaffID]),
- CONSTRAINT [FK_dbo.ContactStaffDetails_dbo.ContactType_ContactTypeID] FOREIGN KEY ([ContactTypeID]) REFERENCES [dbo].[ContactType] ([ContactTypeID])
- );
-
- GO
- CREATE TABLE [dbo].[ContactType] (
- [ContactTypeID] INT IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED ([ContactTypeID] ASC),
- [ContactType] NVARCHAR (50) NOT NULL
- );
-
-
- GO
- CREATE TABLE [dbo].[Suburb] (
- [SuburbID] INT IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED ([SuburbID] ASC),
- [Suburb] NVARCHAR (90) NOT NULL,
- [State] NVARCHAR (8) NOT NULL,
- [PostCode] NVARCHAR (6) NOT NULL
- );
-
- GO
- CREATE NONCLUSTERED INDEX [IX_Address_SuburbID]
- ON [dbo].[Address]([SuburbID] ASC);
-
- GO
- CREATE NONCLUSTERED INDEX [IX_Contact_AnnDate]
- ON [dbo].[Contact]([AnnDate] ASC);
-
- GO
- CREATE NONCLUSTERED INDEX [IX_Contact_ContactName]
- ON [dbo].[Contact]([ContactName] ASC);
-
- GO
- CREATE NONCLUSTERED INDEX [IX_ContactTypeID]
- ON [dbo].[Contact]([ContactTypeID] ASC);
-
- GO
- CREATE NONCLUSTERED INDEX [IX_ContactPosition_Position]
- ON [dbo].[ContactPosition]([Position] ASC);
-
- GO
- CREATE NONCLUSTERED INDEX [IX_ContactStaffDetails_Contact]
- ON [dbo].[ContactStaffDetails]([ContactID] ASC);
-
- GO
- CREATE NONCLUSTERED INDEX [IX_ContactStaffDetails_ContactStaff]
- ON [dbo].[ContactStaffDetails]([ContactStaffID] ASC);
-
-
- GO
- CREATE NONCLUSTERED INDEX [IX_Suburb_PostCode]
- ON [dbo].[Suburb]([PostCode] ASC);
-
- GO
- CREATE NONCLUSTERED INDEX [IX_Suburb_State]
- ON [dbo].[Suburb]([State] ASC);
-
- GO
- CREATE NONCLUSTERED INDEX [IX_Suburb_Suburb]
- ON [dbo].[Suburb]([Suburb] ASC);
I am only very new to this type of development. I have been working through training on ASP.NET and feel semi confident to start on my first mini project. Yesterday I made a simple example with staff and vehicles and managed to get this completed and working how I thought it should. Feeling a little bolder I decided to set up a slightly more complex model this morning to see how it works. So I created SQL statements and then checked it all looked correct. Click build in Visual Studio and it threw a few errors. No stress went in and corrected all the errors. Deleted the created data base and reran to build again...No errors, build says its fine...but no database visible. I know I have done something silly but I don't even know what to look for.
In case it is something in my SQL, which I sincerely doubt: