# Sunday, August 29, 2004
« A Short History of Nearly Everything | Main | New Downloads »

OUTPUT Clause

This one gives you access to the inserted and deleted tables in normal SQL so you can write statements like:

DECLARE @changes TABLE (
    ProjectId int,
    Name nvarchar(max),
    Description nvarchar(max)
);

update dbo.Projects
set Billable = 1
output
    inserted.ProjectId,
    inserted.Name,
    inserted.Description
into @changes
where Billable = 0

WRITE Clause

Allows more efficient updates of varchar(max), nvarchar(max) and varbinary(max) columns. For example:

declare @update_text nvarchar(max)
set @update_text = ' ... this is added to the end'

update dbo.Projects
set    Description.write(@update_text, null, len(@update_text))
where  Name = 'Timesheet'

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, August 29, 2004 7:05:47 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Related posts:
Do you have great business intelligence skills?
Integration Services Design Principals
Physical Data Warehouse Design
Analysis Services Essential Reading
When should you do an incremental extract?
Post TechReady and Popfly Invites
Comments are closed.