Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
luis_bisval
Contributor III
Contributor III

Convertir query SQL en archivo QVD

Buenas tardes.

Estimados, espero estén muy bien, en está oportunidad solicito de su ayuda para que me orienten de como hacer en el Script de QV para crear un archivo QVD con el siguiente query SQL.

OLEDB CONNECT TO

SELECT  rotCode,  DP.dmdCode,  dmdOrder,  cusCode,  jrnCode,  dmdSystemDate,  dmdDate,

  convert(varchar,dmdDate,105) AS Fecha,

  DATEPART(year, dmdDate) as Año,

    DATEPART(month, dmdDate) as Mes,

  DATEPART(WEEK, dmdDate) as Semana,

  DATEPART(WEEKDAY, dmdDate) as Dia_Semana,

    DATEPART(day, dmdDate) as Dia,

    dptNetAmount,

  dptQuantity

from Demand as D

Join DemandProduct as DP

  on D.dmdCode = DP.dmdCode

where dmdOrder = 1 and dmdSystemDate > (select convert (char (10), getdate(), 112));

Actualmente este query me trae correctamente la información.

Agradezco de antemano su colaboración.

1 Solution

Accepted Solutions
sorrakis01
Specialist
Specialist

Hola Luis,

TuTabla:

OLEDB CONNECT TO

SELECT  rotCode,  DP.dmdCode,  dmdOrder,  cusCode,  jrnCode,  dmdSystemDate,  dmdDate,

  convert(varchar,dmdDate,105) AS Fecha,

  DATEPART(year, dmdDate) as Año,

    DATEPART(month, dmdDate) as Mes,

  DATEPART(WEEK, dmdDate) as Semana,

  DATEPART(WEEKDAY, dmdDate) as Dia_Semana,

    DATEPART(day, dmdDate) as Dia,

    dptNetAmount,

  dptQuantity

from Demand as D

Join DemandProduct as DP

  on D.dmdCode = DP.dmdCode

where dmdOrder = 1 and dmdSystemDate > (select convert (char (10), getdate(), 112));

STORE TuTabla into Tutabla.qvd(qvd)

Saludos

View solution in original post

3 Replies
sorrakis01
Specialist
Specialist

Hola Luis,

TuTabla:

OLEDB CONNECT TO

SELECT  rotCode,  DP.dmdCode,  dmdOrder,  cusCode,  jrnCode,  dmdSystemDate,  dmdDate,

  convert(varchar,dmdDate,105) AS Fecha,

  DATEPART(year, dmdDate) as Año,

    DATEPART(month, dmdDate) as Mes,

  DATEPART(WEEK, dmdDate) as Semana,

  DATEPART(WEEKDAY, dmdDate) as Dia_Semana,

    DATEPART(day, dmdDate) as Dia,

    dptNetAmount,

  dptQuantity

from Demand as D

Join DemandProduct as DP

  on D.dmdCode = DP.dmdCode

where dmdOrder = 1 and dmdSystemDate > (select convert (char (10), getdate(), 112));

STORE TuTabla into Tutabla.qvd(qvd)

Saludos

luis_bisval
Contributor III
Contributor III
Author

Muchas gracias Jordi, ahora se que hay que darle el nombre antes de la conexión OLEDB, lo deje así y funcionó perfecto.

Diario:

OLEDB CONNECT TO

SELECT rotCode, DP.dmdCode, dmdOrder, cusCode, jrnCode, dmdSystemDate, dmdDate,

  convert(varchar,dmdDate,105) AS aclDate,

  DATEPART(year, dmdDate) as aclYear,

    DATEPART(month, dmdDate) as aclMonth,

  DATEPART(WEEK, dmdDate) as aclWeek,

  DATEPART(WEEKDAY, dmdDate) as aclWeekday,

    DATEPART(day, dmdDate) as aclDay,

    dptNetAmount,

  dptQuantity

from Demand as D

Join DemandProduct as DP

  on D.dmdCode = DP.dmdCode

where dmdOrder = 1 and dmdSystemDate > (select convert (char (10), getdate(), 112));

Store Mensual into DemandD.qvd (qvd);

DROP Table Diario;

sorrakis01
Specialist
Specialist

Genial Luis,

Saludos.