From the course: SQL Server 2008 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Writing INSERT statements

Writing INSERT statements - SQL Server Tutorial

From the course: SQL Server 2008 Essential Training

Start my 1-month free trial

Writing INSERT statements

Selecting information is all very well, but after a while we are going to need to start inserting some information into those databases. Now of course if you have SQL Server Management Studio you can do the kind of cheap and nasty way of doing it, which is right-click one of these tables, select the Edit Top 200 Rows, and either start clicking and selecting in here to change things, or you can scroll right down to the bottom and where the asterisk row is just start typing. But this is not really a very scalable way of doing some inserts. It's really just there for emergencies. We need to understand how to construct SQL statements to do this. Having said that, it is very useful to often look at this this way to familiarize yourself with what data you are about to enter. So I'm going to create a new query and I'll be using AdventureWorksLT, as we have been all along. I'm going to insert into the ProductCategory table here, simply because it's quite a small one. Again before I start…

Contents