Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting columns during a SELECT
Message
 
À
22/12/2008 11:51:07
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
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:
01369206
Vues:
8
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform