Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/05/2010, 13:50
chicorio
 
Fecha de Ingreso: abril-2009
Mensajes: 67
Antigüedad: 15 años, 7 meses
Puntos: 0
Update mediante vista

Buenas quisiera actualizar dos tablas en un solo query lei que podia hacerlo mediante una vista pero me da este error

View or function 'BookMakersInc.dbo.EXT_VAgentInfoUpdate' is not updatable because the modification affects multiple base tables.


cree un sp que hace update a la vista no se si estoy bien


ALTER Procedure [dbo].[EXT_UpdateAgentInfo](@AgentID varchar(25),
@EMail varchar(4), @Active Char(1),@CasinoActive Char(1), @EnterBettingAdjustmentFlag Char(1),
@EnterTransactionFlag Char(1),@ChangeWagerLimitFlag Char(1),@ChangeCreditLimitFlag Char(1),
@ManageLinesFlag Char(1),@ChangeTempCreditFlag Char(1),@ChangeAgentNameFlag Char(1),
@ChangeEmailFlag Char (1), @ChangePasswordFlag Char(1), @ChangeCreditFlag Char(1),@ChangeMultibetFlag char(1))


As


Set nocount on


UPDATE [BookMakersInc].[dbo].[EXT_VAgentInfoUpdate]
SET
[Active] = @Active,
[CasinoActive] = @CasinoActive,
[EnterBettingAdjustmentFlag] = @EnterBettingAdjustmentFlag,
[EnterTransactionFlag] = @EnterTransactionFlag,
[ChangeWagerLimitFlag] = @ChangeWagerLimitFlag,
[ChangeCreditLimitFlag] = @ChangeCreditLimitFlag,
[ManageLinesFlag] = ManageLinesFlag,
[ChangeTempCreditFlag] = @ChangeTempCreditFlag,
[ChangeAgentNameFlag] = @ChangeAgentNameFlag,
[ChangeEmailFlag] = ChangeEmailFlag,
[ChangePasswordFlag] = @ChangePasswordFlag,
[ChangeCreditFlag] = @ChangeCreditFlag,
[ChangeMultibetFlag] = @ChangeMultibetFlag
Where [AgentID] = @AgentID



Esta es la vista




ALTER VIEW [dbo].[EXT_VAgentInfoUpdate]( Active, CasinoActive, EnterBettingAdjustmentFlag, EnterTransactionFlag, ChangeWagerLimitFlag, ChangeCreditLimitFlag,
ManageLinesFlag, ChangeTempCreditFlag, ChangeAgentNameFlag, ChangeEmailFlag, ChangePasswordFlag, ChangeCreditFlag,
ChangeMultibetFlag)
AS
SELECT Active, CasinoActive, EnterBettingAdjustmentFlag, EnterTransactionFlag, ChangeWagerLimitFlag, ChangeCreditLimitFlag,
ManageLinesFlag, ChangeTempCreditFlag, ChangeAgentNameFlag, ChangeEmailFlag, ChangePasswordFlag, ChangeCreditFlag,
ChangeMultibetFlag
FROM dbo.tbAgent AS a INNER JOIN
dbo.tbCustomer AS c ON a.AgentID = c.CustomerID INNER JOIN
dbo.EXT_AgentInfo AS e ON a.AgentID = e.Agentid COLLATE SQL_Latin1_General_CP1_CI_AS



GO