locked
Please help me ... SaveChanges() method is crashing on my code RRS feed

  • Question

  • User-1582807108 posted

    I am trying to do a usual adding of a record in table using codes 1 through 9 below but being
    stopped by a surprise error that says in Fiddler:

    "ExceptionMessage=Cannot insert explicit value for identity column in table 'Authorize' when IDENTITY_INSERT is set to OFF."

    Wondering how I can possibly solve this problem?

    The debugger shows the crash is happening in Line# 7 below:

    1   public static string AddAuthorize(string userName, string password,
    2                                    int customerId)
    3   {
    4       var dataAuthorize = new MarinaEntities();
    5       Authorize authorCust = new Authorize { UserName = userName, Password = password,   CustomerID = customerId };
    6       dataAuthorize.Authorizes.Add(authorCust);
    7       dataAuthorize.SaveChanges();
    8       return "Success Authorizing"; //TODO: return error message if encountered
    9   }

    I am trying to do something that I was hoping would be a breeze but right now I am going around in circles and do not
    know what is going on I tried various solutions ...

    For example I tried adding the attribute  [DatabaseGenerated(DatabaseGeneratedOption.Identity)] below which did not
    solve the problem.

    namespace MarinaData
    {
        public class Authorize
        {
            [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
            public int ID { get; set; }
            public string UserName { get; set; }
            public string Password { get; set; }
        }
    }

    I even tried and tested things  by opening the table from SQL Server Management Studio and added the record
    manually and SQL Server accepted it without any complain  which just makes me wonder even more why my code crashes.

    I even  tried setting the IDENTITY_INSERT for the table Authorize to ON in SQL Server ... but still the error persists.

    What I have not tried yet is a suggestion that says "you need a [Key] attribute on at least one field in your metadata. Or
    create an identity/PK column (int/guid), and then update the metadata." ... I apologize that  I am a little bit new in
    Entity Framework  and still trying to get myself up to speed .. so to be honest I really  do not know how to try out the
    quoted suggestion, it would be nice to be able to try it though.

    All suggestions are much appreciated .. thanks for all the help you could give.

    Gratefully,
    Ric

    P.S.

    My connectionstring MarinaEntities:

      <connectionStrings>
        <add name="MarinaEntities" connectionString="metadata=res://*/DataLayer.MarinaData.csdl|res://*/DataLayer.MarinaData.ssdl|res://*/DataLayer.MarinaData.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=C:\Projects\Web API Marina by Ric\MarinaDatabase\Marina.mdf;integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>

    MarinaEntities has a table in it defined thus:

    CREATE TABLE [dbo].[Authorize] (
        [ID]         INT          IDENTITY (1, 1) NOT NULL,
        [UserName]   VARCHAR (50) NOT NULL,
        [Password]   VARCHAR (14) NOT NULL,
        [CustomerID] INT          NOT NULL,
        CONSTRAINT [PK__Authoriz__3214EC27E084886E] PRIMARY KEY CLUSTERED ([ID] ASC),
        CONSTRAINT [FK_Authorize_Customer] FOREIGN KEY ([CustomerID]) REFERENCES [dbo].[Customer] ([ID])
    );



    The error  stack trace is shown below:
    System.Data.Entity.Infrastructure.DbUpdateException was unhandled by user code
      HResult=-2146233087
      Message=An error occurred while updating the entries. See the inner exception for details.
      Source=EntityFramework
      StackTrace:
           at System.Data.Entity.Internal.InternalContext.SaveChanges()
           at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
           at System.Data.Entity.DbContext.SaveChanges()
           at MarinaData.DataLayer.AuthorizeManager.AddAuthorize(String userName, String password, Int32 customerId) in c:\Projects\Web API Marina Ric\Web API 2 for Marina Ric\MarinaData\AuthorizeManager.cs:line 20
           at Web_API_2_for_Marina_by_Ric.Controllers.AuthorizeController.AddAuthorize(AuthorizeDTO authorizeDTO) in c:\Projects\Web API Marina Ric\Web API 2 for Marina Ric\Web API 2 for Marina Ric\Controllers\AuthorizeController.cs:line 60
           at lambda_method(Closure , Object , Object[] )
           at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
           at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
           at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
      InnerException: System.Data.Entity.Core.UpdateException
           HResult=-2146233087
           Message=An error occurred while updating the entries. See the inner exception for details.
           Source=EntityFramework
           StackTrace:
                at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
                at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<Update>b__2(UpdateTranslator ut)
                at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult, Func`2 updateFunction)
                at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update()
                at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__35()
                at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
                at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
                at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass2a.<SaveChangesInternal>b__27()
                at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
                at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
                at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
                at System.Data.Entity.Internal.InternalContext.SaveChanges()
           InnerException: System.Data.SqlClient.SqlException
                HResult=-2146232060
                Message=Cannot insert explicit value for identity column in table 'Authorize' when IDENTITY_INSERT is set to OFF.
                Source=.Net SqlClient Data Provider
                ErrorCode=-2146232060
                class="16"
                LineNumber=1
                Number=544
                Procedure=""
                Server=(LocalDB)\MSSQLLocalDB
                State=1
                StackTrace:
                     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
                     at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
                     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
                     at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
                     at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
                     at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
                     at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
                     at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
                     at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
                     at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<NonQuery>b__0(DbCommand t, DbCommandInterceptionContext`1 c)
                     at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
                     at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(DbCommand command, DbCommandInterceptionContext interceptionContext)
                     at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteNonQuery()
                     at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary`2 identifierValues, List`1 generatedValues)
                     at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
                InnerException:

    Tuesday, June 23, 2015 5:39 PM

Answers

  • User2024324573 posted

    You are using Database-First approach, and trying to migrate using code-first it won't work. 

    You need to go either approach, in database-first in your EDMX if you add something and try to save it, it will be saved but if you update the model from the database it will go away. 

    To keep up with DB-first you need to add the table to the database first and then try to save. 

    Could you provide the Database scripts for Authorize table

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 23, 2015 8:06 PM
  • User1644755831 posted

    Hello Ric1ca,

    GO CREATE TABLE [dbo].[Authorize]( [ID] [int] IDENTITY(1,1) NOT NULL, [UserName] [varchar](50) NOT NULL, [Password] [varchar](14) NOT NULL, [CustomerID] [int] NOT NULL, PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

    Your Table script looks ok. I assumed you used database first approach. If you make any changes to the database then you would have to update the model. 

    Please see: http://www.asp.net/mvc/overview/getting-started/database-first-development/changing-the-database

    When you add the new Authorize you will not need to add id it will be created automatically since its identity.

    Hope this helps.

    With Regards,

    Krunal Parekh

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 25, 2015 12:59 AM

All replies

  • User2024324573 posted

    What I have not tried yet is a suggestion that says "you need a [Key] attribute on at least one field in your metadata. Or
    create an identity/PK column (int/guid), and then update the metadata." ... I apologize that  I am a little bit new in
    Entity Framework  and still trying to get myself up to speed .. so to be honest I really  do not know how to try out the
    quoted suggestion, it would be nice to be able to try it though.

    please try with the Key  annotation attribute before the ID property as 

    [Key]
    public int ID {get;set;}

    Then migrate the database and run the code again.

    Tuesday, June 23, 2015 5:55 PM
  • User-1582807108 posted


    Hello and thanks for your response  ...  I'm not so good at this yet but I'll try to describe below  what I have ...  first I changed the my Authorize class adding the [Key] attribute  to read as shown in the code below:

    namespace MarinaData
    {
        public class Authorize
        {
            [Key]
            public int ID { get; set; }
            public string UserName { get; set; }
            public string Password { get; set; }
    
        }
    }

    Some additional code which could show more background info is the code below (i.e. the MarinaEntities class which I mentioned in first post)

    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated from a template.
    //
    //     Manual changes to this file may cause unexpected behavior in your application.
    //     Manual changes to this file will be overwritten if the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------
    
    namespace MarinaData.DataLayer
    {
        using System;
        using System.Data.Entity;
        using System.Data.Entity.Infrastructure;
        using System.Data.Entity.Core.Objects;
        using System.Linq;
        
        public partial class MarinaEntities : DbContext
        {
            public MarinaEntities()
                : base("name=MarinaEntities")
            {
            }
        
            protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {
                throw new UnintentionalCodeFirstException();
            }
        
            public virtual DbSet<Location> Locations { get; set; }
            public virtual DbSet<Authorize> Authorizes { get; set; }
            public virtual DbSet<Boat> Boats { get; set; }
            public virtual DbSet<Customer> Customers { get; set; }
            public virtual DbSet<Dock> Docks { get; set; }
            public virtual DbSet<Lease> Leases { get; set; }
            public virtual DbSet<LeaseType> LeaseTypes { get; set; }
            public virtual DbSet<Slip> Slips { get; set; }
        
            public virtual ObjectResult<SelectCustomer_Result> SelectCustomer()
            {
                return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<SelectCustomer_Result>("SelectCustomer");
            }
        
            public virtual ObjectResult<SelectCustomer2_Result> SelectCustomer2()
            {
                return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<SelectCustomer2_Result>("SelectCustomer2");
            }
        
            public virtual int sp_alterdiagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
            {
                var diagramnameParameter = diagramname != null ?
                    new ObjectParameter("diagramname", diagramname) :
                    new ObjectParameter("diagramname", typeof(string));
        
                var owner_idParameter = owner_id.HasValue ?
                    new ObjectParameter("owner_id", owner_id) :
                    new ObjectParameter("owner_id", typeof(int));
        
                var versionParameter = version.HasValue ?
                    new ObjectParameter("version", version) :
                    new ObjectParameter("version", typeof(int));
        
                var definitionParameter = definition != null ?
                    new ObjectParameter("definition", definition) :
                    new ObjectParameter("definition", typeof(byte[]));
        
                return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_alterdiagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
            }
        
            public virtual int sp_creatediagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
            {
                var diagramnameParameter = diagramname != null ?
                    new ObjectParameter("diagramname", diagramname) :
                    new ObjectParameter("diagramname", typeof(string));
        
                var owner_idParameter = owner_id.HasValue ?
                    new ObjectParameter("owner_id", owner_id) :
                    new ObjectParameter("owner_id", typeof(int));
        
                var versionParameter = version.HasValue ?
                    new ObjectParameter("version", version) :
                    new ObjectParameter("version", typeof(int));
        
                var definitionParameter = definition != null ?
                    new ObjectParameter("definition", definition) :
                    new ObjectParameter("definition", typeof(byte[]));
        
                return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_creatediagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
            }
        
            public virtual int sp_dropdiagram(string diagramname, Nullable<int> owner_id)
            {
                var diagramnameParameter = diagramname != null ?
                    new ObjectParameter("diagramname", diagramname) :
                    new ObjectParameter("diagramname", typeof(string));
        
                var owner_idParameter = owner_id.HasValue ?
                    new ObjectParameter("owner_id", owner_id) :
                    new ObjectParameter("owner_id", typeof(int));
        
                return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_dropdiagram", diagramnameParameter, owner_idParameter);
            }
        
            public virtual ObjectResult<sp_helpdiagramdefinition_Result> sp_helpdiagramdefinition(string diagramname, Nullable<int> owner_id)
            {
                var diagramnameParameter = diagramname != null ?
                    new ObjectParameter("diagramname", diagramname) :
                    new ObjectParameter("diagramname", typeof(string));
        
                var owner_idParameter = owner_id.HasValue ?
                    new ObjectParameter("owner_id", owner_id) :
                    new ObjectParameter("owner_id", typeof(int));
        
                return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagramdefinition_Result>("sp_helpdiagramdefinition", diagramnameParameter, owner_idParameter);
            }
        
            public virtual ObjectResult<sp_helpdiagrams_Result> sp_helpdiagrams(string diagramname, Nullable<int> owner_id)
            {
                var diagramnameParameter = diagramname != null ?
                    new ObjectParameter("diagramname", diagramname) :
                    new ObjectParameter("diagramname", typeof(string));
        
                var owner_idParameter = owner_id.HasValue ?
                    new ObjectParameter("owner_id", owner_id) :
                    new ObjectParameter("owner_id", typeof(int));
        
                return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagrams_Result>("sp_helpdiagrams", diagramnameParameter, owner_idParameter);
            }
        
            public virtual int sp_renamediagram(string diagramname, Nullable<int> owner_id, string new_diagramname)
            {
                var diagramnameParameter = diagramname != null ?
                    new ObjectParameter("diagramname", diagramname) :
                    new ObjectParameter("diagramname", typeof(string));
        
                var owner_idParameter = owner_id.HasValue ?
                    new ObjectParameter("owner_id", owner_id) :
                    new ObjectParameter("owner_id", typeof(int));
        
                var new_diagramnameParameter = new_diagramname != null ?
                    new ObjectParameter("new_diagramname", new_diagramname) :
                    new ObjectParameter("new_diagramname", typeof(string));
        
                return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_renamediagram", diagramnameParameter, owner_idParameter, new_diagramnameParameter);
            }
        
            public virtual int sp_upgraddiagrams()
            {
                return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_upgraddiagrams");
            }
        }
    }
    

    Next thing I tried to do was to do the migration so I tried to google the thing to get some idea what I need to do and I
    found something that said that I needed to Enable-Migrations from the NuGet Package Management Console ... which
    I tried to do but ending up with an error:

    "Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel."

    With the error directly above I decided to try another way around the problem and as we speak I am now reading  the
    article in https://msdn.microsoft.com/en-ca/data/jj591621.aspx   section  "Generating & Running Migrations"  ...  in short it
    is the migration thing that is giving me problem right now and I do not know if I am getting closer to the end of the tunnel
    or drifting away from it ... I am trying trying hard to find my way and groping in the dark ... but in case I am drifting too far
    please feel free to guide this lost traveler ... thanks again

    Gratefully,
    Ric



    Tuesday, June 23, 2015 7:59 PM
  • User2024324573 posted

    You are using Database-First approach, and trying to migrate using code-first it won't work. 

    You need to go either approach, in database-first in your EDMX if you add something and try to save it, it will be saved but if you update the model from the database it will go away. 

    To keep up with DB-first you need to add the table to the database first and then try to save. 

    Could you provide the Database scripts for Authorize table

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 23, 2015 8:06 PM
  • User-1582807108 posted

    Thanks for your response ... based on your advise I have decided to re-create the entire database from scratch  to get  the whole picture I am providing here not just the one table but all the tables Authorize object included ... the relationships are simple one to many with the ID field always as the primary key for each table .. thanks again

    USE [C:\PROJECTS\WEB API MARINA BY RIC\MARINADATABASE\MARINA.MDF]
    GO
    /****** Object:  Table [dbo].[Authorize]    Script Date: 2015-06-23 8:04:04 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Authorize](
    	[ID] [int] IDENTITY(1,1) NOT NULL,
    	[UserName] [varchar](50) NOT NULL,
    	[Password] [varchar](14) NOT NULL,
    	[CustomerID] [int] NOT NULL,
    PRIMARY KEY CLUSTERED 
    (
    	[ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Boat]    Script Date: 2015-06-23 8:04:04 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Boat](
    	[ID] [int] IDENTITY(1000,1) NOT NULL,
    	[RegistrationNumber] [varchar](20) NOT NULL,
    	[Manufacturer] [varchar](50) NOT NULL,
    	[ModelYear] [int] NOT NULL,
    	[Length] [int] NOT NULL,
    	[CustomerID] [int] NOT NULL,
     CONSTRAINT [PK_Boat] PRIMARY KEY CLUSTERED 
    (
    	[ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Customer]    Script Date: 2015-06-23 8:04:04 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Customer](
    	[ID] [int] IDENTITY(1000,1) NOT NULL,
    	[FirstName] [varchar](30) NOT NULL,
    	[LastName] [varchar](30) NOT NULL,
    	[Phone] [varchar](14) NOT NULL,
    	[City] [varchar](30) NOT NULL,
     CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED 
    (
    	[ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Dock]    Script Date: 2015-06-23 8:04:04 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Dock](
    	[ID] [int] Identity(1,1) NOT NULL,
    	[Name] [varchar](50) NOT NULL,
    	[LocationId] [int] NOT NULL,
    	[WaterService] [bit] NOT NULL,
    	[ElectricalService] [bit] NOT NULL,
    PRIMARY KEY CLUSTERED 
    (
    	[ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Lease]    Script Date: 2015-06-23 8:04:04 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Lease](
    	[ID] [int] Identity(1000,1) NOT NULL,
    	[StartDate] [datetime] NOT NULL,
    	[EndDate] [datetime] NOT NULL,
    	[SlipID] [int] NOT NULL,
    	[CustomerID] [int] NOT NULL,
    	[LeaseTypeID] [int] NOT NULL,
    PRIMARY KEY CLUSTERED 
    (
    	[ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    /****** Object:  Table [dbo].[LeaseType]    Script Date: 2015-06-23 8:04:04 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[LeaseType](
    	[ID] [int] Identity(1,1) NOT NULL,
    	[Name] [varchar](50) NOT NULL,
    	[StandardRateAmount] [decimal](18, 2) NOT NULL,
    PRIMARY KEY CLUSTERED 
    (
    	[ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Location]    Script Date: 2015-06-23 8:04:04 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Location](
    	[ID] [int] Identity(1,1) NOT NULL,
    	[Name] [varchar](50) NOT NULL,
    PRIMARY KEY CLUSTERED 
    (
    	[ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Slip]    Script Date: 2015-06-23 8:04:04 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Slip](
    	[ID] [int] Identity(1000,1) NOT NULL,
    	[Width] [int] NOT NULL,
    	[Length] [int] NOT NULL,
    	[DockID] [int] NOT NULL,
    PRIMARY KEY CLUSTERED 
    (
    	[ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    ALTER TABLE [dbo].[Boat]  WITH CHECK ADD  CONSTRAINT [FK_Boat_Customer] FOREIGN KEY([CustomerID])
    REFERENCES [dbo].[Customer] ([ID])
    GO
    ALTER TABLE [dbo].[Boat] CHECK CONSTRAINT [FK_Boat_Customer]
    
    GO
    SET IDENTITY_INSERT [dbo].[Location] ON 
    
    GO
    INSERT [dbo].[Location] ([ID], [Name]) VALUES (1, N'Inland Lake')
    GO
    INSERT [dbo].[Location] ([ID], [Name]) VALUES (2, N'Sab Diego')
    GO
    SET IDENTITY_INSERT [dbo].[Location] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Dock] ON 
    
    GO
    INSERT [dbo].[Dock] ([ID], [Name], [LocationId], [WaterService], [ElectricalService]) VALUES (1, N'Dock A', 1, 1, 1)
    GO
    INSERT [dbo].[Dock] ([ID], [Name], [LocationId], [WaterService], [ElectricalService]) VALUES (2, N'Dock B', 1, 1, 0)
    GO
    INSERT [dbo].[Dock] ([ID], [Name], [LocationId], [WaterService], [ElectricalService]) VALUES (3, N'Dock C', 1, 0, 1)
    GO
    SET IDENTITY_INSERT [dbo].[Dock] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Slip] ON 
    
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1000, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1001, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1002, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1003, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1004, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1005, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1006, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1007, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1008, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1009, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1010, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1011, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1012, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1013, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1014, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1015, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1016, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1017, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1018, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1019, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1020, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1021, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1022, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1023, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1024, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1025, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1026, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1027, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1028, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1029, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1030, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1031, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1032, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1033, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1034, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1035, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1036, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1037, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1038, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1039, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1040, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1041, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1042, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1043, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1044, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1045, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1046, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1047, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1048, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1049, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1050, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1051, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1052, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1053, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1054, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1055, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1056, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1057, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1058, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1059, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1060, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1061, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1062, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1063, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1064, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1065, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1066, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1067, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1068, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1069, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1070, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1071, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1072, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1073, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1074, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1075, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1076, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1077, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1078, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1079, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1080, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1081, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1082, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1083, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1084, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1085, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1086, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1087, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1088, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1089, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1090, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1091, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1092, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1093, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1094, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1095, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1096, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1097, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1098, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1099, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1100, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1101, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1102, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1103, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1104, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1105, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1106, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1107, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1108, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1109, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1110, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1111, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1112, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1113, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1114, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1115, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1116, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1117, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1118, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1119, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1120, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1121, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1122, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1123, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1124, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1125, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1126, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1127, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1128, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1129, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1130, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1131, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1132, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1133, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1134, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1135, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1136, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1137, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1138, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1139, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1140, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1141, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1142, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1143, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1144, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1145, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1146, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1147, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1148, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1149, 12, 28, 3)
    GO
    SET IDENTITY_INSERT [dbo].[Slip] OFF
    GO
    SET IDENTITY_INSERT [dbo].[LeaseType] ON 
    
    GO
    INSERT [dbo].[LeaseType] ([ID], [Name], [StandardRateAmount]) VALUES (1, N'Daily', CAST(25.50 AS Decimal(18, 2)))
    GO
    INSERT [dbo].[LeaseType] ([ID], [Name], [StandardRateAmount]) VALUES (2, N'Weekly', CAST(145.50 AS Decimal(18, 2)))
    GO
    INSERT [dbo].[LeaseType] ([ID], [Name], [StandardRateAmount]) VALUES (3, N'Monthly', CAST(500.00 AS Decimal(18, 2)))
    GO
    INSERT [dbo].[LeaseType] ([ID], [Name], [StandardRateAmount]) VALUES (4, N'Yearly', CAST(5000.00 AS Decimal(18, 2)))
    GO
    SET IDENTITY_INSERT [dbo].[LeaseType] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Customer] ON 
    
    GO
    INSERT [dbo].[Customer] ([ID], [FirstName], [LastName], [Phone], [City]) VALUES (1000, N'John', N'Doe', N'555-545-1212', N'Phoenix')
    GO
    SET IDENTITY_INSERT [dbo].[Customer] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Lease] ON 
    
    GO
    INSERT [dbo].[Lease] ([ID], [StartDate], [EndDate], [SlipID], [CustomerID], [LeaseTypeID]) VALUES (1000, CAST(N'2007-09-12 00:00:00.000' AS DateTime), CAST(N'2008-09-12 00:00:00.000' AS DateTime), 1030, 1000, 4)
    GO
    SET IDENTITY_INSERT [dbo].[Lease] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Boat] ON 
    
    GO
    INSERT [dbo].[Boat] ([ID], [RegistrationNumber], [Manufacturer], [ModelYear], [Length], [CustomerID]) VALUES (1000, N'AR8373-223-2', N'Yamaha', 2005, 18, 1000)
    GO
    SET IDENTITY_INSERT [dbo].[Boat] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Authorize] ON 
    
    GO
    INSERT [dbo].[Authorize] ([ID], [UserName], [Password], [CustomerID]) VALUES (1, N'jdoe', N'p@ssword', 1000)
    GO
    SET IDENTITY_INSERT [dbo].[Authorize] OFF
    GO
    
    
    
    


    Gratefully,
    Ric


    USE [C:\PROJECTS\WEB API MARINA BY VAL MABUTAS\MARINADATABASE\MARINA.MDF]
    GO
    /****** Object:  Table [dbo].[Authorize]    Script Date: 2015-06-23 8:47:59 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Authorize](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [UserName] [varchar](50) NOT NULL,
        [Password] [varchar](14) NOT NULL,
        [CustomerID] [int] NOT NULL,
    PRIMARY KEY CLUSTERED
    (
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Boat]    Script Date: 2015-06-23 8:47:59 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Boat](
        [ID] [int] IDENTITY(1000,1) NOT NULL,
        [RegistrationNumber] [varchar](20) NOT NULL,
        [Manufacturer] [varchar](50) NOT NULL,
        [ModelYear] [int] NOT NULL,
        [Length] [int] NOT NULL,
        [CustomerID] [int] NOT NULL,
     CONSTRAINT [PK_Boat] PRIMARY KEY CLUSTERED
    (
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Customer]    Script Date: 2015-06-23 8:47:59 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Customer](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [FirstName] [varchar](30) NOT NULL,
        [LastName] [varchar](30) NOT NULL,
        [Phone] [varchar](14) NOT NULL,
        [City] [varchar](30) NOT NULL,
     CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
    (
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Dock]    Script Date: 2015-06-23 8:47:59 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Dock](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [Name] [varchar](50) NOT NULL,
        [LocationId] [int] NOT NULL,
        [WaterService] [bit] NOT NULL,
        [ElectricalService] [bit] NOT NULL,
     CONSTRAINT [PK__Dock__3214EC271B9CE93D] PRIMARY KEY CLUSTERED
    (
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Lease]    Script Date: 2015-06-23 8:47:59 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Lease](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [StartDate] [datetime] NOT NULL,
        [EndDate] [datetime] NOT NULL,
        [SlipID] [int] NOT NULL,
        [CustomerID] [int] NOT NULL,
        [LeaseTypeID] [int] NOT NULL,
     CONSTRAINT [PK__Lease__3214EC2770F2849D] PRIMARY KEY CLUSTERED
    (
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    /****** Object:  Table [dbo].[LeaseType]    Script Date: 2015-06-23 8:47:59 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[LeaseType](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [Name] [varchar](50) NOT NULL,
        [StandardRateAmount] [decimal](18, 2) NOT NULL,
     CONSTRAINT [PK__LeaseTyp__3214EC270C84B2A7] PRIMARY KEY CLUSTERED
    (
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Location]    Script Date: 2015-06-23 8:47:59 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Location](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [Name] [varchar](50) NOT NULL,
     CONSTRAINT [PK__Location__3214EC27633DDF5F] PRIMARY KEY CLUSTERED
    (
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object:  Table [dbo].[Slip]    Script Date: 2015-06-23 8:47:59 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Slip](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [Width] [int] NOT NULL,
        [Length] [int] NOT NULL,
        [DockID] [int] NOT NULL,
     CONSTRAINT [PK__Slip__3214EC27F83FD41E] PRIMARY KEY CLUSTERED
    (
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    SET IDENTITY_INSERT [dbo].[Authorize] ON

    GO
    INSERT [dbo].[Authorize] ([ID], [UserName], [Password], [CustomerID]) VALUES (1, N'jdoe', N'p@ssword', 1000)
    GO
    SET IDENTITY_INSERT [dbo].[Authorize] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Boat] ON

    GO
    INSERT [dbo].[Boat] ([ID], [RegistrationNumber], [Manufacturer], [ModelYear], [Length], [CustomerID]) VALUES (1000, N'AR8373-223-2', N'Yamaha', 2005, 18, 1000)
    GO
    SET IDENTITY_INSERT [dbo].[Boat] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Customer] ON

    GO
    INSERT [dbo].[Customer] ([ID], [FirstName], [LastName], [Phone], [City]) VALUES (1000, N'John', N'Doe', N'555-545-1212', N'Phoenix')
    GO
    SET IDENTITY_INSERT [dbo].[Customer] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Dock] ON

    GO
    INSERT [dbo].[Dock] ([ID], [Name], [LocationId], [WaterService], [ElectricalService]) VALUES (1, N'Dock A', 1, 1, 1)
    GO
    INSERT [dbo].[Dock] ([ID], [Name], [LocationId], [WaterService], [ElectricalService]) VALUES (2, N'Dock B', 1, 1, 0)
    GO
    INSERT [dbo].[Dock] ([ID], [Name], [LocationId], [WaterService], [ElectricalService]) VALUES (3, N'Dock C', 1, 0, 1)
    GO
    SET IDENTITY_INSERT [dbo].[Dock] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Lease] ON

    GO
    INSERT [dbo].[Lease] ([ID], [StartDate], [EndDate], [SlipID], [CustomerID], [LeaseTypeID]) VALUES (1000, CAST(N'2007-09-12 00:00:00.000' AS DateTime), CAST(N'2008-09-12 00:00:00.000' AS DateTime), 1030, 1000, 4)
    GO
    SET IDENTITY_INSERT [dbo].[Lease] OFF
    GO
    SET IDENTITY_INSERT [dbo].[LeaseType] ON

    GO
    INSERT [dbo].[LeaseType] ([ID], [Name], [StandardRateAmount]) VALUES (1, N'Daily', CAST(25.50 AS Decimal(18, 2)))
    GO
    INSERT [dbo].[LeaseType] ([ID], [Name], [StandardRateAmount]) VALUES (2, N'Weekly', CAST(145.50 AS Decimal(18, 2)))
    GO
    INSERT [dbo].[LeaseType] ([ID], [Name], [StandardRateAmount]) VALUES (3, N'Monthly', CAST(500.00 AS Decimal(18, 2)))
    GO
    INSERT [dbo].[LeaseType] ([ID], [Name], [StandardRateAmount]) VALUES (4, N'Yearly', CAST(5000.00 AS Decimal(18, 2)))
    GO
    SET IDENTITY_INSERT [dbo].[LeaseType] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Location] ON

    GO
    INSERT [dbo].[Location] ([ID], [Name]) VALUES (1, N'Inland Lake')
    GO
    INSERT [dbo].[Location] ([ID], [Name]) VALUES (2, N'Sab Diego')
    GO
    SET IDENTITY_INSERT [dbo].[Location] OFF
    GO
    SET IDENTITY_INSERT [dbo].[Slip] ON

    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1000, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1001, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1002, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1003, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1004, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1005, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1006, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1007, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1008, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1009, 8, 16, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1010, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1011, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1012, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1013, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1014, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1015, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1016, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1017, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1018, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1019, 8, 18, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1020, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1021, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1022, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1023, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1024, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1025, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1026, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1027, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1028, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1029, 8, 20, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1030, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1031, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1032, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1033, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1034, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1035, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1036, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1037, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1038, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1039, 10, 22, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1040, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1041, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1042, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1043, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1044, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1045, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1046, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1047, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1048, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1049, 10, 24, 1)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1050, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1051, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1052, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1053, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1054, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1055, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1056, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1057, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1058, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1059, 8, 16, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1060, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1061, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1062, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1063, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1064, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1065, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1066, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1067, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1068, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1069, 8, 18, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1070, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1071, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1072, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1073, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1074, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1075, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1076, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1077, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1078, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1079, 8, 20, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1080, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1081, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1082, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1083, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1084, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1085, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1086, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1087, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1088, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1089, 10, 22, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1090, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1091, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1092, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1093, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1094, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1095, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1096, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1097, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1098, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1099, 10, 24, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1100, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1101, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1102, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1103, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1104, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1105, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1106, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1107, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1108, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1109, 10, 26, 2)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1110, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1111, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1112, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1113, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1114, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1115, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1116, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1117, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1118, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1119, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1120, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1121, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1122, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1123, 10, 22, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1124, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1125, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1126, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1127, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1128, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1129, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1130, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1131, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1132, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1133, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1134, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1135, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1136, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1137, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1138, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1139, 10, 24, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1140, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1141, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1142, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1143, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1144, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1145, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1146, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1147, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1148, 12, 28, 3)
    GO
    INSERT [dbo].[Slip] ([ID], [Width], [Length], [DockID]) VALUES (1149, 12, 28, 3)
    GO
    SET IDENTITY_INSERT [dbo].[Slip] OFF
    GO
    ALTER TABLE [dbo].[Authorize]  WITH CHECK ADD  CONSTRAINT [FK_Authorize_Customer] FOREIGN KEY([CustomerID])
    REFERENCES [dbo].[Customer] ([ID])
    GO
    ALTER TABLE [dbo].[Authorize] CHECK CONSTRAINT [FK_Authorize_Customer]
    GO
    ALTER TABLE [dbo].[Boat]  WITH CHECK ADD  CONSTRAINT [FK_Boat_Customer1] FOREIGN KEY([CustomerID])
    REFERENCES [dbo].[Customer] ([ID])
    GO
    ALTER TABLE [dbo].[Boat] CHECK CONSTRAINT [FK_Boat_Customer1]
    GO
    ALTER TABLE [dbo].[Dock]  WITH CHECK ADD  CONSTRAINT [FK_Dock_Location] FOREIGN KEY([LocationId])
    REFERENCES [dbo].[Location] ([ID])
    GO
    ALTER TABLE [dbo].[Dock] CHECK CONSTRAINT [FK_Dock_Location]
    GO
    ALTER TABLE [dbo].[Lease]  WITH CHECK ADD  CONSTRAINT [FK_Lease_Customer] FOREIGN KEY([CustomerID])
    REFERENCES [dbo].[Customer] ([ID])
    GO
    ALTER TABLE [dbo].[Lease] CHECK CONSTRAINT [FK_Lease_Customer]
    GO
    ALTER TABLE [dbo].[Lease]  WITH CHECK ADD  CONSTRAINT [FK_Lease_LeaseType] FOREIGN KEY([LeaseTypeID])
    REFERENCES [dbo].[LeaseType] ([ID])
    GO
    ALTER TABLE [dbo].[Lease] CHECK CONSTRAINT [FK_Lease_LeaseType]
    GO
    ALTER TABLE [dbo].[Lease]  WITH CHECK ADD  CONSTRAINT [FK_Lease_Slip] FOREIGN KEY([SlipID])
    REFERENCES [dbo].[Slip] ([ID])
    GO
    ALTER TABLE [dbo].[Lease] CHECK CONSTRAINT [FK_Lease_Slip]
    GO
    ALTER TABLE [dbo].[Slip]  WITH CHECK ADD  CONSTRAINT [FK_Slip_Dock] FOREIGN KEY([DockID])
    REFERENCES [dbo].[Dock] ([ID])
    GO
    ALTER TABLE [dbo].[Slip] CHECK CONSTRAINT [FK_Slip_Dock]
    GO

    Tuesday, June 23, 2015 10:56 PM
  • User1644755831 posted

    Hello Ric1ca,

    GO CREATE TABLE [dbo].[Authorize]( [ID] [int] IDENTITY(1,1) NOT NULL, [UserName] [varchar](50) NOT NULL, [Password] [varchar](14) NOT NULL, [CustomerID] [int] NOT NULL, PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

    Your Table script looks ok. I assumed you used database first approach. If you make any changes to the database then you would have to update the model. 

    Please see: http://www.asp.net/mvc/overview/getting-started/database-first-development/changing-the-database

    When you add the new Authorize you will not need to add id it will be created automatically since its identity.

    Hope this helps.

    With Regards,

    Krunal Parekh

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 25, 2015 12:59 AM