on 11-08-2011 8:42 PM
Jovenes expertos, me podrian ayudar necesito actualizar un campo de una tabla de usuario, que es el ultimo numero de cheque emitido, lo estoy tratando de hacer por medio del Transation Notificacion pero me da error en cuando utilizo el update @LISTCHEQUES me da error, disculpen la ignorancia al utilizar esta herramienta.
Les dejo el query que realice
IF @object_type = '3' and @transaction_type in ('A', 'U')
BEGIN
Select @Cheque = CONVERT(nvarchar,NextChckNo)
from ODSC
where NextChckNo = @list_of_cols_val_tab_del
Begin
UPDATE @LISTCHEQUES SET U_UlChEm = 'NextChCkNo'
Where TransType = '3' and DfltAcct = U_CtaBan
End
End
Espero me puedan ayudar.
De antemano muy agradecido
Saludos
Pon entre corchetes la tabla de usuario
[@LISTCHEQUES]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gracias Mauricio por tu ayuda, pero no me actualizo la tabla ni el campo que problema podria ser, el query al final lo deje de esta forma.
IF @object_type = '3' and @transaction_type in ('A', 'U')
BEGIN
declare @cheque int
Select @cheque = CONVERT(nvarchar,NextChckNo)
from ODSC
where NextChckNo = @list_of_cols_val_tab_del
Begin
UPDATE [@LISTCHEQUES] SET U_UlChEm = 'NextChCkNo'
End
End
Agradezco su ayuda.
Saludos
Intenta con
IF @object_type = '3' and @transaction_type in ('A', 'U')
BEGIN
declare @cheque int
Select @cheque = CONVERT(nvarchar,NextChckNo)
from ODSC
where NextChckNo = @list_of_cols_val_tab_del
Begin
UPDATE [@LISTCHEQUES] SET U_UlChEm = @cheque where.........
End
End
Agrega la condicion despues del where, de lo contrario utiliza un insert tal cual
Insert into [@LISTCHEQUES] (U_UIChEM) values (@cheque)
Buenos dias
Prueba este codigo
IF @object_type = '3' and @transaction_type in ('A', 'U')
BEGIN
DECLARE @Cheque INT
SET @Cheque=(SELECT CONVERT(Nvarchar(50), T0.NextChckNo) FROM dbo.ODSC T0 WHERE T0.NextChckNo=@list_of_cols_val_tab_del)
IF (@Cheque IS NOT NULL) OR (@Cheque != '')
BEGIN
UPDATE [dbo].[@LISTCHEQUES]
SET U_UlChEm = @cheque WHERE U_UlChEm IS NULL
END
END
Lo otro seria como dice Mauricio
IF @object_type = '3' and @transaction_type in ('A', 'U')
BEGIN
DECLARE @Cheque INT
SET @Cheque=(SELECT CONVERT(Nvarchar(50), T0.NextChckNo) FROM dbo.ODSC T0 WHERE T0.NextChckNo=@list_of_cols_val_tab_del)
IF (@Cheque IS NOT NULL) OR (@Cheque != '')
BEGIN
INSERT INTO [dbo].[@LISTCHEQUES] (U_UIChEM) VALUES (@cheque)
END
END
Saludos
Edited by: Floyola on Nov 9, 2011 8:43 AM
Gracias Mauricio este fue el ultimo que probe pero tampoco funciono.
IF @object_type = '57' and @transaction_type in ('A', 'U')
BEGIN
DECLARE @Cheque INT
SET @Cheque=(SELECT CONVERT(Nvarchar(50), T0.CheckNum) FROM dbo.OCHO T0 WHERE T0.CheckNum=@list_of_cols_val_tab_del)
IF (@Cheque IS NOT NULL) OR (@Cheque != '')
BEGIN
UPDATE [dbo].[@LISTCHEQUES]
SET U_UlChEm = @cheque WHERE U_UlChEm = '0'
INSERT INTO [dbo].[@LISTCHEQUES] (U_UlChEm) VALUES (@Cheque)
END
END
Saludos y gracias
Hice pruebas con el siguiente codigo
IF @object_type = '57' and @transaction_type in ('A', 'U')
BEGIN
DECLARE @Cheque INT
declare @code nvarchar (8)
declare @nombre nvarchar (30)
SET @Cheque=(select T0.CheckNum FROM dbo.OCHO T0
WHERE T0.CheckNum=@list_of_cols_val_tab_del)
IF (@Cheque!=0)
BEGIN
INSERT INTO [dbo].[@LISTCHEQUES] (code,name,U_UlChEm) VALUES (@cheque,@cheque,@Cheque)
END
END
Funciona, pero necesitas alimentar el campo CODE y NAME con valores que no se repitan, por eso le estoy insertando el mismo numero de cheque en los 3 campos
Que valores tienes en code y name? como alimentas esas columnas?
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.