Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting columns during a SELECT
Message
From
22/12/2008 11:51:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
22/12/2008 10:05:37
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
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:
01369194
Views:
10
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