mpsilva
Posts: 1
|
Posted: 07/21/2010, 2:52 AM |
|
Hello,
I have a procedure created in SQL 2005 and that works fine in SQL but I am having trouble using it in the CCS.
I use the procedure to select a table fields tblFactura to then insert the table tblHistorico. The next step would be to update the table fields tblFactura. When I set to custom update
Custom Insert Type: Procedure and Custom Inser: ActualizaHistorico, the procedure only updates the table tblFactura but does not update the table tblHistorico. If I set the Customs update the procedure does not work
Can I call the procedure in the event "After update"? How should I call the procedure in the event "After update"?
This is the Stored Procedure
USE [DBFactura]
GO
/****** Object: StoredProcedure [dbo].[ActualizaHistorico] Script Date: 07/21/2010 10:28:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ActualizaHistorico]
-- Add the parameters for the stored procedure here
@Empresa int,
@NumeroFactura varchar(50),
@Valor money,
@EstadoMercadoria int,
@DataFactura datetime,
@OrdemCompra int,
@Observacao varchar(Max),
@facturaId int,
@EstadoFactura int,
@userid int
AS
BEGIN
INSERT INTO dbo.tblHistorico
SELECT userid, DataReceocaoDTI, EstadoFactura, idFactura,Observacao
FROM dbo.tblFactura
WHERE idFactura=@Facturaid
UPDATE dbo.tblFactura
SET
Empresa=@Empresa,
NumeroFactura=@NumeroFactura,
DataReceocaoDTI=GETDATE(),
EstadoFactura=@EstadoFactura,
Observacao=@Observacao,
Valor=@Valor,
EstadoMercadoria=@EstadoMercadoria,
DataFactura=@DataFactura,
OrdemCompra=@OrdemCompra,
userid=@userid
WHERE idfactura=@facturaId
END
Regard's
|
|
|
RoyHobbs99223
Posts: 37
|
Posted: 10/30/2012, 9:43 AM |
|
Did you ever get an answer on how to call a stored procedure from CCS?
|
|
|
Vasiliy
Posts: 378
|
Posted: 10/30/2012, 7:31 PM |
|
Call ExecuteNonquery right from CCS After Update, if errors.count = 0.
Btw, why SP with bunch of params if your code can be executed from CCS directly?
_________________
Vasiliy |
|
|
|