Query en SP

02/07/2007 - 20:53 por msnews.microsoft.com | Informe spam
Hola a todos, una consulta,
necesito poner la siguiente Query en un SP y no puedo, no me deja grabarlo,
desde el Query Analizer la consulta funciona perfecto, pero no la puedo
meter en un SP, y lo necesito para poder invocarla desde una planilla de
Excel

La Comprobación de sintaxis no me da error, pero al querer grabar el SP me
da lo siguiente:
"Microsoft SQL-DMO (ODBC SQLState: 42000)
Error 2714: El procedimiento aa_CCFir, número de grupo 1, ya existe en la
base de datos. Elija otro nombre de procedimiento"

El tema es que aunque le cambie el nombre, me sigue diciendo lo mismo.

Alguien sabe que puedo estar haciendo mal?

Abajo les copio el código que pongo dentro del SP

Saludos y muchas gracias de antemano
Pablo


CREATE PROCEDURE aa_CCFir AS

IF OBJECT_ID('USR_CCFIRA') IS NOT NULL
DROP TABLE USR_CCFIRA
GO
CREATE TABLE USR_CCFIRA
(USR_CCFIRA_FCHMOV datetime NOT NULL, USR_CCFIRA_NROFOR int NOT NULL,
USR_CCFIRA_CODFOR varchar(6) NOT NULL, USR_CCFIRA_CHEQUE int NOT NULL,
USR_CCFIRA_IMPORT float(18) NOT NULL,
PRIMARY KEY (USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT )
)
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
SELECT PVRMVC_CODFOR, PVRMVC_NROFOR, "0", PVRMVC_FCHVNC, PVRMVC_IMPNAC *-1
FROM PVRMVC
WHERE (PVRMVC_NROCTA='MFIRAR')and PVRMVC_CODFOR <> 'OP' and PVRMVC_CODFOR <>
'AOP'
ORDER BY PVRMVC_FCHMOV
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
select cjrmvi_codfor, cjrmvi_nrofor, CJRMVI_CHEQUE, CJRMVI_FCHAUX,
case CJRMVI_debhab when 'd' then cjrmvi_import else cjrmvi_import * -1 end
from cjrmvi, cjrmvh
where cjrmvh_nrocpv = 'mfirar' and cjrmvi_modfor = cjrmvh_modfor and
cjrmvi_codfor = cjrmvh_codfor and cjrmvi_nrofor = cjrmvh_nrofor and
((cjrmvi_codfor = 'op' and cjrmvi_debhab = 'h') or (cjrmvi_codfor =
'aop' and cjrmvi_debhab = 'd'))
order by cjrmvi_fchAUX
GO
SELECT *
FROM USR_CCFIRA
ORDER BY USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT

Preguntas similare

Leer las respuestas

#1 Gustavo Larriera (MVP)
02/07/2007 - 21:26 | Informe spam
Ejecuta lo mismo pero usando ALTER PROCEDURE. Obviamente ya está creado el
procedimiento.

Otra opcion es que uses DROP PROCEDURE aa_CCFir para eliminar el procimiento
y volverlo a crear.

Gustavo Larriera, Microsoft MVP
https://mvp.support.microsoft.com/p...o.Larriera
Este mensaje se proporciona tal como es, sin garantías de ninguna clase.



"msnews.microsoft.com" wrote:

Hola a todos, una consulta,
necesito poner la siguiente Query en un SP y no puedo, no me deja grabarlo,
desde el Query Analizer la consulta funciona perfecto, pero no la puedo
meter en un SP, y lo necesito para poder invocarla desde una planilla de
Excel

La Comprobación de sintaxis no me da error, pero al querer grabar el SP me
da lo siguiente:
"Microsoft SQL-DMO (ODBC SQLState: 42000)
Error 2714: El procedimiento aa_CCFir, número de grupo 1, ya existe en la
base de datos. Elija otro nombre de procedimiento"

El tema es que aunque le cambie el nombre, me sigue diciendo lo mismo.

Alguien sabe que puedo estar haciendo mal?

Abajo les copio el código que pongo dentro del SP

Saludos y muchas gracias de antemano
Pablo


CREATE PROCEDURE aa_CCFir AS

IF OBJECT_ID('USR_CCFIRA') IS NOT NULL
DROP TABLE USR_CCFIRA
GO
CREATE TABLE USR_CCFIRA
(USR_CCFIRA_FCHMOV datetime NOT NULL, USR_CCFIRA_NROFOR int NOT NULL,
USR_CCFIRA_CODFOR varchar(6) NOT NULL, USR_CCFIRA_CHEQUE int NOT NULL,
USR_CCFIRA_IMPORT float(18) NOT NULL,
PRIMARY KEY (USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT )
)
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
SELECT PVRMVC_CODFOR, PVRMVC_NROFOR, "0", PVRMVC_FCHVNC, PVRMVC_IMPNAC *-1
FROM PVRMVC
WHERE (PVRMVC_NROCTA='MFIRAR')and PVRMVC_CODFOR <> 'OP' and PVRMVC_CODFOR <>
'AOP'
ORDER BY PVRMVC_FCHMOV
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
select cjrmvi_codfor, cjrmvi_nrofor, CJRMVI_CHEQUE, CJRMVI_FCHAUX,
case CJRMVI_debhab when 'd' then cjrmvi_import else cjrmvi_import * -1 end
from cjrmvi, cjrmvh
where cjrmvh_nrocpv = 'mfirar' and cjrmvi_modfor = cjrmvh_modfor and
cjrmvi_codfor = cjrmvh_codfor and cjrmvi_nrofor = cjrmvh_nrofor and
((cjrmvi_codfor = 'op' and cjrmvi_debhab = 'h') or (cjrmvi_codfor =
'aop' and cjrmvi_debhab = 'd'))
order by cjrmvi_fchAUX
GO
SELECT *
FROM USR_CCFIRA
ORDER BY USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT



Respuesta Responder a este mensaje
#2 msnews.microsoft.com
02/07/2007 - 21:54 | Informe spam
ok, hice eso, pero ahora me dice que el objeto USR_CCFIRA (la tabla) ya
existe
y tampooc me lo guarda



"Gustavo Larriera (MVP)"
escribió en el mensaje
news:
Ejecuta lo mismo pero usando ALTER PROCEDURE. Obviamente ya está creado el
procedimiento.

Otra opcion es que uses DROP PROCEDURE aa_CCFir para eliminar el
procimiento
y volverlo a crear.

Gustavo Larriera, Microsoft MVP
https://mvp.support.microsoft.com/p...o.Larriera
Este mensaje se proporciona tal como es, sin garantías de ninguna clase.



"msnews.microsoft.com" wrote:

Hola a todos, una consulta,
necesito poner la siguiente Query en un SP y no puedo, no me deja
grabarlo,
desde el Query Analizer la consulta funciona perfecto, pero no la puedo
meter en un SP, y lo necesito para poder invocarla desde una planilla de
Excel

La Comprobación de sintaxis no me da error, pero al querer grabar el SP
me
da lo siguiente:
"Microsoft SQL-DMO (ODBC SQLState: 42000)
Error 2714: El procedimiento aa_CCFir, número de grupo 1, ya existe en la
base de datos. Elija otro nombre de procedimiento"

El tema es que aunque le cambie el nombre, me sigue diciendo lo mismo.

Alguien sabe que puedo estar haciendo mal?

Abajo les copio el código que pongo dentro del SP

Saludos y muchas gracias de antemano
Pablo


CREATE PROCEDURE aa_CCFir AS

IF OBJECT_ID('USR_CCFIRA') IS NOT NULL
DROP TABLE USR_CCFIRA
GO
CREATE TABLE USR_CCFIRA
(USR_CCFIRA_FCHMOV datetime NOT NULL, USR_CCFIRA_NROFOR int NOT NULL,
USR_CCFIRA_CODFOR varchar(6) NOT NULL, USR_CCFIRA_CHEQUE int NOT NULL,
USR_CCFIRA_IMPORT float(18) NOT NULL,
PRIMARY KEY (USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT )
)
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
SELECT PVRMVC_CODFOR, PVRMVC_NROFOR, "0", PVRMVC_FCHVNC, PVRMVC_IMPNAC
*-1
FROM PVRMVC
WHERE (PVRMVC_NROCTA='MFIRAR')and PVRMVC_CODFOR <> 'OP' and PVRMVC_CODFOR
<>
'AOP'
ORDER BY PVRMVC_FCHMOV
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
select cjrmvi_codfor, cjrmvi_nrofor, CJRMVI_CHEQUE, CJRMVI_FCHAUX,
case CJRMVI_debhab when 'd' then cjrmvi_import else cjrmvi_import * -1
end
from cjrmvi, cjrmvh
where cjrmvh_nrocpv = 'mfirar' and cjrmvi_modfor = cjrmvh_modfor and
cjrmvi_codfor = cjrmvh_codfor and cjrmvi_nrofor = cjrmvh_nrofor and
((cjrmvi_codfor = 'op' and cjrmvi_debhab = 'h') or (cjrmvi_codfor >> 'aop' and cjrmvi_debhab = 'd'))
order by cjrmvi_fchAUX
GO
SELECT *
FROM USR_CCFIRA
ORDER BY USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT



Respuesta Responder a este mensaje
#3 Gustavo Larriera (MVP)
02/07/2007 - 22:34 | Informe spam
Revisa el código que algo estás haciendo mal.

Por ejemplo, me llama mucho la atención que uses tantos GO en medio de un
procedimiento almacenado?

Gustavo Larriera, Microsoft MVP
https://mvp.support.microsoft.com/p...o.Larriera
Este mensaje se proporciona tal como es, sin garantías de ninguna clase.



"msnews.microsoft.com" wrote:

ok, hice eso, pero ahora me dice que el objeto USR_CCFIRA (la tabla) ya
existe
y tampooc me lo guarda



"Gustavo Larriera (MVP)"
escribió en el mensaje
news:
> Ejecuta lo mismo pero usando ALTER PROCEDURE. Obviamente ya está creado el
> procedimiento.
>
> Otra opcion es que uses DROP PROCEDURE aa_CCFir para eliminar el
> procimiento
> y volverlo a crear.
>
> Gustavo Larriera, Microsoft MVP
> https://mvp.support.microsoft.com/p...o.Larriera
> Este mensaje se proporciona tal como es, sin garantías de ninguna clase.
>
>
>
> "msnews.microsoft.com" wrote:
>
>> Hola a todos, una consulta,
>> necesito poner la siguiente Query en un SP y no puedo, no me deja
>> grabarlo,
>> desde el Query Analizer la consulta funciona perfecto, pero no la puedo
>> meter en un SP, y lo necesito para poder invocarla desde una planilla de
>> Excel
>>
>> La Comprobación de sintaxis no me da error, pero al querer grabar el SP
>> me
>> da lo siguiente:
>> "Microsoft SQL-DMO (ODBC SQLState: 42000)
>> Error 2714: El procedimiento aa_CCFir, número de grupo 1, ya existe en la
>> base de datos. Elija otro nombre de procedimiento"
>>
>> El tema es que aunque le cambie el nombre, me sigue diciendo lo mismo.
>>
>> Alguien sabe que puedo estar haciendo mal?
>>
>> Abajo les copio el código que pongo dentro del SP
>>
>> Saludos y muchas gracias de antemano
>> Pablo
>>
>>
>> CREATE PROCEDURE aa_CCFir AS
>>
>> IF OBJECT_ID('USR_CCFIRA') IS NOT NULL
>> DROP TABLE USR_CCFIRA
>> GO
>> CREATE TABLE USR_CCFIRA
>> (USR_CCFIRA_FCHMOV datetime NOT NULL, USR_CCFIRA_NROFOR int NOT NULL,
>> USR_CCFIRA_CODFOR varchar(6) NOT NULL, USR_CCFIRA_CHEQUE int NOT NULL,
>> USR_CCFIRA_IMPORT float(18) NOT NULL,
>> PRIMARY KEY (USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
>> USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT )
>> )
>> GO
>> INSERT INTO USR_CCFIRA
>> ( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
>> USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
>> SELECT PVRMVC_CODFOR, PVRMVC_NROFOR, "0", PVRMVC_FCHVNC, PVRMVC_IMPNAC
>> *-1
>> FROM PVRMVC
>> WHERE (PVRMVC_NROCTA='MFIRAR')and PVRMVC_CODFOR <> 'OP' and PVRMVC_CODFOR
>> <>
>> 'AOP'
>> ORDER BY PVRMVC_FCHMOV
>> GO
>> INSERT INTO USR_CCFIRA
>> ( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
>> USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
>> select cjrmvi_codfor, cjrmvi_nrofor, CJRMVI_CHEQUE, CJRMVI_FCHAUX,
>> case CJRMVI_debhab when 'd' then cjrmvi_import else cjrmvi_import * -1
>> end
>> from cjrmvi, cjrmvh
>> where cjrmvh_nrocpv = 'mfirar' and cjrmvi_modfor = cjrmvh_modfor and
>> cjrmvi_codfor = cjrmvh_codfor and cjrmvi_nrofor = cjrmvh_nrofor and
>> ((cjrmvi_codfor = 'op' and cjrmvi_debhab = 'h') or (cjrmvi_codfor > >> 'aop' and cjrmvi_debhab = 'd'))
>> order by cjrmvi_fchAUX
>> GO
>> SELECT *
>> FROM USR_CCFIRA
>> ORDER BY USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
>> USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT
>>
>>
>>



Respuesta Responder a este mensaje
#4 Ricardo Passians
03/07/2007 - 12:47 | Informe spam
Da la impresión que copiaste código desde el Query Analizer para armar el
SP. Chequea bien lo que deseas hacer primero y depura la lógica. Como te
dice Gustavo, no son necesarios esos "GO's" salvo el último si acaso.
Además no es típico estar creando tablas en un SP a menos que se trate de
una tabla temporal o que sea un script de creación de una BD.

Ricardo Passians

"msnews.microsoft.com" escribió en el mensaje
news:
ok, hice eso, pero ahora me dice que el objeto USR_CCFIRA (la tabla) ya
existe
y tampooc me lo guarda



"Gustavo Larriera (MVP)"
escribió en el mensaje
news:
Ejecuta lo mismo pero usando ALTER PROCEDURE. Obviamente ya está creado
el
procedimiento.

Otra opcion es que uses DROP PROCEDURE aa_CCFir para eliminar el
procimiento
y volverlo a crear.

Gustavo Larriera, Microsoft MVP
https://mvp.support.microsoft.com/p...o.Larriera
Este mensaje se proporciona tal como es, sin garantías de ninguna clase.



"msnews.microsoft.com" wrote:

Hola a todos, una consulta,
necesito poner la siguiente Query en un SP y no puedo, no me deja
grabarlo,
desde el Query Analizer la consulta funciona perfecto, pero no la puedo
meter en un SP, y lo necesito para poder invocarla desde una planilla de
Excel

La Comprobación de sintaxis no me da error, pero al querer grabar el SP
me
da lo siguiente:
"Microsoft SQL-DMO (ODBC SQLState: 42000)
Error 2714: El procedimiento aa_CCFir, número de grupo 1, ya existe en
la
base de datos. Elija otro nombre de procedimiento"

El tema es que aunque le cambie el nombre, me sigue diciendo lo mismo.

Alguien sabe que puedo estar haciendo mal?

Abajo les copio el código que pongo dentro del SP

Saludos y muchas gracias de antemano
Pablo


CREATE PROCEDURE aa_CCFir AS

IF OBJECT_ID('USR_CCFIRA') IS NOT NULL
DROP TABLE USR_CCFIRA
GO
CREATE TABLE USR_CCFIRA
(USR_CCFIRA_FCHMOV datetime NOT NULL, USR_CCFIRA_NROFOR int NOT NULL,
USR_CCFIRA_CODFOR varchar(6) NOT NULL, USR_CCFIRA_CHEQUE int NOT NULL,
USR_CCFIRA_IMPORT float(18) NOT NULL,
PRIMARY KEY (USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT )
)
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
SELECT PVRMVC_CODFOR, PVRMVC_NROFOR, "0", PVRMVC_FCHVNC, PVRMVC_IMPNAC
*-1
FROM PVRMVC
WHERE (PVRMVC_NROCTA='MFIRAR')and PVRMVC_CODFOR <> 'OP' and
PVRMVC_CODFOR <>
'AOP'
ORDER BY PVRMVC_FCHMOV
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
select cjrmvi_codfor, cjrmvi_nrofor, CJRMVI_CHEQUE, CJRMVI_FCHAUX,
case CJRMVI_debhab when 'd' then cjrmvi_import else cjrmvi_import * -1
end
from cjrmvi, cjrmvh
where cjrmvh_nrocpv = 'mfirar' and cjrmvi_modfor = cjrmvh_modfor and
cjrmvi_codfor = cjrmvh_codfor and cjrmvi_nrofor = cjrmvh_nrofor and
((cjrmvi_codfor = 'op' and cjrmvi_debhab = 'h') or (cjrmvi_codfor >>> 'aop' and cjrmvi_debhab = 'd'))
order by cjrmvi_fchAUX
GO
SELECT *
FROM USR_CCFIRA
ORDER BY USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT









Respuesta Responder a este mensaje
#5 msnews.microsoft.com
03/07/2007 - 13:50 | Informe spam
Ricardo, es una tabla temporal, que uso para tomar datos de otras dos tablas
totalmente distintas y mostrarlos ordenados
es verdad, copié el código del QA, puede generar algún problema hacer eso?
siempre lo hago,

no hay duda, el que sabe sabe, le quité los GO y me lo tomó
a propósito, aprovechando su generosidad les pregunto, para qué sirve
realmente el GO si lo use o no, en el QA, la query funciona igual?

muchachos, les mando un abrazo y muchísimas gracias por la ayuda

Pablo


"Ricardo Passians" escribió en el mensaje
news:%23pwIp%
Da la impresión que copiaste código desde el Query Analizer para armar el
SP. Chequea bien lo que deseas hacer primero y depura la lógica. Como te
dice Gustavo, no son necesarios esos "GO's" salvo el último si acaso.
Además no es típico estar creando tablas en un SP a menos que se trate de
una tabla temporal o que sea un script de creación de una BD.

Ricardo Passians

"msnews.microsoft.com" escribió en el mensaje
news:
ok, hice eso, pero ahora me dice que el objeto USR_CCFIRA (la tabla) ya
existe
y tampooc me lo guarda



"Gustavo Larriera (MVP)"
escribió en el mensaje
news:
Ejecuta lo mismo pero usando ALTER PROCEDURE. Obviamente ya está creado
el
procedimiento.

Otra opcion es que uses DROP PROCEDURE aa_CCFir para eliminar el
procimiento
y volverlo a crear.

Gustavo Larriera, Microsoft MVP
https://mvp.support.microsoft.com/p...o.Larriera
Este mensaje se proporciona tal como es, sin garantías de ninguna clase.



"msnews.microsoft.com" wrote:

Hola a todos, una consulta,
necesito poner la siguiente Query en un SP y no puedo, no me deja
grabarlo,
desde el Query Analizer la consulta funciona perfecto, pero no la puedo
meter en un SP, y lo necesito para poder invocarla desde una planilla
de
Excel

La Comprobación de sintaxis no me da error, pero al querer grabar el SP
me
da lo siguiente:
"Microsoft SQL-DMO (ODBC SQLState: 42000)
Error 2714: El procedimiento aa_CCFir, número de grupo 1, ya existe en
la
base de datos. Elija otro nombre de procedimiento"

El tema es que aunque le cambie el nombre, me sigue diciendo lo mismo.

Alguien sabe que puedo estar haciendo mal?

Abajo les copio el código que pongo dentro del SP

Saludos y muchas gracias de antemano
Pablo


CREATE PROCEDURE aa_CCFir AS

IF OBJECT_ID('USR_CCFIRA') IS NOT NULL
DROP TABLE USR_CCFIRA
GO
CREATE TABLE USR_CCFIRA
(USR_CCFIRA_FCHMOV datetime NOT NULL, USR_CCFIRA_NROFOR int NOT NULL,
USR_CCFIRA_CODFOR varchar(6) NOT NULL, USR_CCFIRA_CHEQUE int NOT NULL,
USR_CCFIRA_IMPORT float(18) NOT NULL,
PRIMARY KEY (USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT )
)
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
SELECT PVRMVC_CODFOR, PVRMVC_NROFOR, "0", PVRMVC_FCHVNC, PVRMVC_IMPNAC
*-1
FROM PVRMVC
WHERE (PVRMVC_NROCTA='MFIRAR')and PVRMVC_CODFOR <> 'OP' and
PVRMVC_CODFOR <>
'AOP'
ORDER BY PVRMVC_FCHMOV
GO
INSERT INTO USR_CCFIRA
( USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR, USR_CCFIRA_CHEQUE,
USR_CCFIRA_FCHMOV, USR_CCFIRA_IMPORT)
select cjrmvi_codfor, cjrmvi_nrofor, CJRMVI_CHEQUE, CJRMVI_FCHAUX,
case CJRMVI_debhab when 'd' then cjrmvi_import else cjrmvi_import * -1
end
from cjrmvi, cjrmvh
where cjrmvh_nrocpv = 'mfirar' and cjrmvi_modfor = cjrmvh_modfor and
cjrmvi_codfor = cjrmvh_codfor and cjrmvi_nrofor = cjrmvh_nrofor and
((cjrmvi_codfor = 'op' and cjrmvi_debhab = 'h') or (cjrmvi_codfor
>>>> 'aop' and cjrmvi_debhab = 'd'))
order by cjrmvi_fchAUX
GO
SELECT *
FROM USR_CCFIRA
ORDER BY USR_CCFIRA_FCHMOV, USR_CCFIRA_CODFOR, USR_CCFIRA_NROFOR,
USR_CCFIRA_CHEQUE, USR_CCFIRA_IMPORT













Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaSiguiente Respuesta Tengo una respuesta
Search Busqueda sugerida