Link guia para hacer update: https://www.youtube.com/watch?v=UgjVfhlk_QA
Para la tabla Challenge:
CREATE PROCEDURE [dbo].[SP_UpdateChallenge]
-- Add the parameters for the stored procedure here
@ID INT,
@Name VARCHAR(50),
@StartDate DATE,
@EndDate DATE
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE dbo.Challenge SET ID = @ID, Name = @Name, StartDate = @StartDate, EndDate = @EndDate
WHERE ID = @ID
END
GO
Para la Tabla Positions:
CREATE PROCEDURE [dbo].[SP_UpdatePositions]
-- Add the parameters for the stored procedure here
@ID INT,
@ET_Time TIME(7),
@FK_Races INT,
@FK_Runners INT,
@Position INT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE dbo.Positions SET ID = @ID,ET_Time = @ET_Time,FK_Races = @FK_Races,FK_Runners = @FK_Runners,Position = @FK_Runners
WHERE ID = @ID
END
GO
Para tabla punishments:
CREATE PROCEDURE [dbo].[SP_UpdatePunishments]
-- Add the parameters for the stored procedure here
@ID INT,
@Points INT,
@FK_Races INT,
@FK_PunishmentType INT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE dbo.Punishments SET ID=@ID,Points=@Points,FK_Races=@FK_Races,FK_PunishmentType=@FK_PunishmentType
WHERE ID = @ID
END
GO
Para tabla Races:
CREATE PROCEDURE [dbo].[SP_UpdateRaces]
-- Add the parameters for the stored procedure here
@ID INT,
@Name VARCHAR(50),
@Description TEXT,
@pDate DATE,
@FK_Challenge int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE dbo.Races SET ID=@ID,Name=@Name,Description=@Description,Date=@pDate,FK_Challenge=@FK_Challenge
WHERE ID = @ID
END
Para tabla Runners:
CREATE PROCEDURE [dbo].[SP_UpdateRunners]
-- Add the parameters for the stored procedure here
@ID INT,
@Name VARCHAR(50),
@Genre INT,
@Email VARCHAR(50),
@Code VARCHAR(50),
@Aka VARCHAR(50),
@Bday DATE
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE dbo.Runners SET ID=@ID,Name=@Name,Genre=@Genre,Email=@Email,Code=@Code,Aka=@Aka,BirthDay=@Bday
WHERE ID = @ID
END
GO
Para tabla intermedia de RunnersByChanllenge:
CREATE PROCEDURE [dbo].[SP_UpdateRunnersByChallenge]
-- Add the parameters for the stored procedure here
@ID INT,
@Number VARCHAR(50),
@AcumTime time(7),
@AcumPoints INT,
@AcumPunishPts INT,
@FK_Challenge INT,
@FK_Runners INT,
@FK_Status INT,
@AcumTimeAuthosized TIME(7),
@AcumPointsAuthorized INT,
@AcumPunishPtsAuthorized INT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE dbo.RunnersXChallenge SET ID = @ID,Number = @Number,AcumTime = @AcumTime,AcumPoints = @AcumPoints,AcumPunishPts = @AcumPunishPts,
FK_Challenge= @FK_Challenge,FK_Runners =@FK_Runners,FK_Status = @FK_Status,AcumTimeAuthorized = @AcumTimeAuthosized,
AcumPointsAuthorized = @AcumPointsAuthorized,AcumPunishPtsAuthorized = @AcumPunishPtsAuthorized
WHERE ID = @ID
END
GO
No hay comentarios:
Publicar un comentario