Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting columns during a SELECT
Message
From
22/12/2008 12:52:42
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01369088
Message ID:
01369208
Views:
9
Of course you are right:)
Cetin

>Isn't inserted and deleted tables only available in TRIGGER?
>I read this in BOL and never tst to see if they are available in SP :-(
>
>>Tim,
>>PMFJI. If you need to return the updated records, why don't you simply select them from inserted table? Something like this:
>>
>>CREATE PROCEDURE dbo.GetSpotsByCompanyIDWithRange
>>(
>>	@CompanyID UniqueIdentifier,
>>	@StartRange DateTime,
>>	@EndRange DateTime,
>>	@Sentinel Bit,
>>	@SentinelMark VarChar
>>) 
>>AS
>>BEGIN
>>	SET NOCOUNT ON;
>>	-- Set the Sentinel Mark, Status, And Status Time
>>UPDATE TrackSpot
>>	SET SentinelMark = @SentinelMark,
>>		Record_Status_dt = @SetTime,
>>		Record_Status = "Sentinel Marked"
>>	WHERE s.CompanyID = @CompanyID
>>		AND Spot_Time >= @StartRange
>>		AND Spot_Time <= @EndRange
>>		AND Sentinel = @Sentinel
>>
>>  
>>  SELECT * from inserted -- return the inserted rows
>>  -- I didn't list fields for simplicity
>>END
>>
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform