Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting columns during a SELECT
Message
 
To
22/12/2008 11:51:07
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:
01369206
Views:
9
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
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform