For the sake of this tip, let's use this sample customers table as shown below. Be sure to create this table in your development environment in order to complete the remaining portions of this tip.
Let's explain this code a little to make sure it makes sense throughout the remainder of this tip. Here are the points of interest:
Here is the code to create in your development environment to learn about the SQL Server INSERT statement:
CREATE TABLE dbo.Customer (CustomerID INT IDENTITY(1,1) NOT NULL, FirstName VARCHAR(25) NOT NULL, LastName VARCHAR(25) NOT NULL, PhoneNumber VARCHAR(15) NOT NULL, EmailAddress VARCHAR(25) NULL, Priority INT NOT NULL, CreateDate DATETIME NOT NULL)ON [PRIMARY] GO ALTER TABLE [dbo].[Customer] ADD CONSTRAINT [DF_Customer_CreateDate] DEFAULT (getdate()) FOR [CreateDate] GO
With this explanation out of the way, let's jump into writing your first INSERT statement.