Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 
SQL Server Transparent Data Encryption Alternative - Free Webinar
 

SQL Server INSERT Command Tutorial



By:

Overview

I need to be able to add data to my tables.  I have found the INSERT command, but I want to find out if you can provide me with some examples.  I am hoping to see some code examples to see if I can pick-up any tips or tricks.  Check out this tutorial to learn about the SQL Server INSERT command. 

Explanation

You are correct, the INSERT command is used in SQL Server to add records to a table. It is a fairly straightforward command that can be used in ad-hoc code and stored procedures. Let's cover the following topics in this tip:
  • Sample table
  • Simple INSERT statement
  • Verify the INSERT commands
  • INSERT command with variables
  • INSERT stored procedure
  • Automatically generating an INSERT statement in SQL Server Management Studio
  • INSERT INTO a SQL Server table with IDENTITY column
  • INSERT INTO a SQL Server table with a SELECT statement
  • INSERT INTO a new table with the SELECT INTO command in SQL Server

Last Update: 9/16/2012




More SQL Server Solutions











Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 


Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



    



Saturday, April 07, 2018 - 2:04:20 AM - Gregg Taylor Back To Top

 Jeremy,

Thank you very much for this very educational tutorial!  

 

Gregg Taylor

 


Learn more about SQL Server tools