Once you have executed the three commands it is time to verify the results. How can we accomplish this? We have to issue SELECT statements to review the data. You did not think you were going to get exposed to another command, did you?
In the code below, we are retrieving all of the columns and all of the rows from the dbo.Customers table.
SELECT CustomerID, FirstName, LastName, PhoneNumber, EmailAddress, Priority, CreateDate FROM dbo.Customer; GO
Here are the results:
As you can see in the first example above, the first row has the following:
In the second example above, the second row has the following:
In the third example above, the third row has the following:
As you can see from the code and data above, all three rows were properly inserted into the dbo.Customer table. Although they are all correct, I would generally recommend using the syntax from the first example because it is the most complete and there is little guesswork as to the final values.
For more information about the SELECT command, check out the SQL Server SELECT tutorial.
Now that we have covered three basic examples, let's see how else we can use the INSERT command.