Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting columns during a SELECT
Message
 
À
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:
01369207
Vues:
7
No,
no need of GO. GO is just a batch separator in SSMS (QA). It is not a T-SQL command.

>>No,
>>The only difference is what data you will get from SELECT.
>>With the code I posted you will get old data, with moving UPDATE before SELECT you will get updated data.
>>
>
>Right, but that is exactly what I need. The sentinel Mark I am updating is supposed to mark the records that have been retrieved. Now I am wondering how I seperate these two operations. Doesn't the "Update" need a "GO" in there before the "SELECT" Occurs; but it is inside the BEGIN and END?
>
>
>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  s.Track_Id,
>		s.CompanyID,
>		s.TruckID,
>		t.TruckCode,
>		s.DriverID,
>		s.Truck_Ip,
>		s.IsTip,
>		s.Spot_Message,
>		s.Route_Day,
>		s.Route_Number,
>		s.Municipality,
>		s.Upload_Id,
>		s.Spot_Latitude,
>		s.Spot_Longitude,
>		s.Spot_Heading,
>		s.Spot_Speed,
>		s.Spot_Altitude,
>		s.Spot_Time,
>		s.Spot_Status,
>		s.Sentinel,
>		s.Record_Status,
>		s.Record_Status_dt
>	FROM TrackSpot s, TruckAccess t
>
>	WHERE s.TruckID = t.TruckID
>		AND s.SentinelMark = @SentinelMark
>
>END
>GO
>
>
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
Répondre
Fil
Voir

Click here to load this message in the networking platform