Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting columns during a SELECT
Message
De
22/12/2008 11:51:07
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
22/12/2008 10:05:37
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01369088
Message ID:
01369194
Vues:
9
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform