Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

UPDATE SQL

Hola,

Tengo una tabla en Qlikview y me gustaría realizar un update en una tabla sql (con los mismos campos).

Codigo de ejemplo: Esta tabla qv necesito guardarla en una table sql (ya pude conectarme sin problemas)
OLEDB CONNECT TO .........

Directory;
PAGOS:

LOAD @1 as Empresa,
@2 as TotalFacturado,
@3 as Pendiente,

FROM
[..\PAGOS\*.xls]
(
biff, no labels, table is HOJA1$)
WHERE(not IsNull(@1) And not IsNull(@2));

Muchas Gracias.

Saludos

1 Solution

Accepted Solutions
Not applicable
Author

Thank you very much to all.

I found the solution

I leave an example of the code

tip: Enable read / write database



// LOAD XLS
Directory;
LIQUIDACIONES:
LOAD @1 as Laboratorio,
    
@2 as TotalFacturado, 
    
@3 as ALaboratorio
    
FROM
[..\Fuentes\*.xls]
(
biff, no labels, table is hoja1$)
WHERE(not IsNull(@1) And not IsNull(@2) And not IsNull(@3 );


// INSERT SQL
For i= 0 to NoOfRows('LIQUIDACIONES') -1

         
LET V_Laboratorio = peek('Laboratorio',$(i),'LIQUIDACIONES');

         
LET V_TotalFacturado = peek('TotalFacturado',$(i),'LIQUIDACIONES');      

        
LET V_ALaboratorio = peek('ALaboratorio',$(i),'LIQUIDACIONES');  
            

         
SQL INSERT INTO Pagos(Laboratorio, TotalFacturado, ALaboratorio)
         VALUES('$(V_Laboratorio)','$(V_TotalFacturado)','$(V_ALaboratorio)');

NEXT

View solution in original post

9 Replies
Not applicable
Author

Please translate your question into English.

Not applicable
Author

I need to save the data in the following table in SQL.
I could now create the connection and see the sql table


Directory;
PAGOS:

LOAD @1 as Empresa,
@2 as TotalFacturado,
@3 as Pendiente,

FROM
[..\PAGOS\*.xls]
(
biff, no labels, table is HOJA1$)
WHERE(not IsNull(@1) And not IsNull(@2));


//INSERT SQL......

Not applicable
Author

Hi, If you want Insert the data from Excel file into Database you have different options other than Qlikview.

Qlikview is not cover all the ETL parts.

You can directly import the data from excel file into Database by using Db developer tools like TOAD, SQL Developer.

Or you can write shell script or batch file for this job.

agilos_mla
Partner - Creator III
Partner - Creator III

The only way you could use INSERT or UPDATE inn the QV script is by using a JDBC connection.

agilos_mla
Partner - Creator III
Partner - Creator III

A list of JDBC drivers and vendors can be found at: www.sqlsummit.com/JDBCVend.htm.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can use INSERT or UPDATE SQL through a standard ODBC/OLEDB Conection as long as you check "Open Databases in Read/Write Mode" on the Data Settings pane.

-Rob

Not applicable
Author

Thank you very much to all.

I found the solution

I leave an example of the code

tip: Enable read / write database



// LOAD XLS
Directory;
LIQUIDACIONES:
LOAD @1 as Laboratorio,
    
@2 as TotalFacturado, 
    
@3 as ALaboratorio
    
FROM
[..\Fuentes\*.xls]
(
biff, no labels, table is hoja1$)
WHERE(not IsNull(@1) And not IsNull(@2) And not IsNull(@3 );


// INSERT SQL
For i= 0 to NoOfRows('LIQUIDACIONES') -1

         
LET V_Laboratorio = peek('Laboratorio',$(i),'LIQUIDACIONES');

         
LET V_TotalFacturado = peek('TotalFacturado',$(i),'LIQUIDACIONES');      

        
LET V_ALaboratorio = peek('ALaboratorio',$(i),'LIQUIDACIONES');  
            

         
SQL INSERT INTO Pagos(Laboratorio, TotalFacturado, ALaboratorio)
         VALUES('$(V_Laboratorio)','$(V_TotalFacturado)','$(V_ALaboratorio)');

NEXT

bumin
Partner - Creator II
Partner - Creator II

Hi Rob,

is "Open Databases in Read/Write Mode" a setting in the SQL-Server parameter?

thanks

Bumin

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It's a setting on the Data Settings panel in the script editor. It actually generates the RW mode into the CONNECT String.

-Rob