Database Reference
In-Depth Information
➤
Using a
Select Into
statement:
This is used to create and fill a table based on the result
set of a
Select
statement.
select 1 id, 'sample' name
into sample
The
Select
statement can be as sophisticated as you need to accomplish the required
transformation.
Note
Delete and Update
Delete
and
Update
statements allow you to remove or modify rows in a table that fit certain speci-
fied conditions. They can get pretty sophisticated and allow you fine control over your data
manipulation.
Delete
From dbo.sample
Where name like 's%'
Update dbo.sample
Set name='testing'
Where name='test'
You can expand the capabilities of your
Delete
and
Update
statements by adding joins in the
From
clause to base your change on values in other tables. We go over some advanced data manipu-
lation patterns specific to analytics in the next chapter.
Search WWH ::
Custom Search