Writing UPDATE statements


show more Writing UPDATE statements provides you with in-depth training on Business. Taught by Simon Allardice as part of the SQL Server 2008 Essential Training show less
please wait ...

Writing UPDATE statements

Well just about as often as inserting information you're going to need to update information too. Let say the example that I was looking at, I know that I've got a problem with one of these rows. This last row here a ProductCategoryID 55 should have had a ParentProductCategoryID of 1 instead of 2. So let's see how to go ahead and do a simple example like that. We will use the word UPDATE and we're going to pick the table name, which is in this case SalesLT.ProductCategory. And just as SELECT has a FROM and INSERT has INTO, UPDATE has a SET.

We're going to SET. We want to say what the values that we want to change are. In this case it was actually ParentProductCategoryID. IntelliSense is smart enough to know that if we're working with the ProductCategory table these are the only options that we have. And then I can say and in this case I'm going to do quite a specific change SET ParentProductCategoryID equal to 1. But if I were to run this code right now it would ...

Writing UPDATE statements
Video duration: 4m 38s 6h 54m Beginner

Viewers:

Writing UPDATE statements provides you with in-depth training on Business. Taught by Simon Allardice as part of the SQL Server 2008 Essential Training

Subjects:
Business Developer IT
Software:
SQL Server
Author:
please wait ...