Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QlikView Fields to Sql

Sub Inserta_en_SQL

dim strServer, strConexion, oConn,oRS

strServer="servername"

strConexion="provider=sqloledb;data source=" & strServer & ";initial catalog=dbMain"

Set oConn = CreateObject("ADODB.Connection")

oConn.Open strConexion, "sa", "password"

Set oRS =CreateObject("ADODB.Recordset")

sSQL="insert into tbUsuarios (intEmpresa,intSucursal,strUsuario,strConstrasena)  values (0,0,'Field?','123')"

ors.open sSQL, oconn

end sub

How can I put  a field or variable in an SQL sentence?.

It is possible?

Or read an QVD and store it into an sql database?.

Help and Thanks!!

5 Replies
Not applicable
Author

Hi the best method is create the txt file or csv file by using STORE command.

Create the shell script to insert the data into DB.

Here are the steps.

1. Create the shell script to insert the data from txt file into database.

2. Create the batch file to execute the shell script.

3. Write your Qlikview script in qvw

4. create the txt file by using STORE command

5. Execute the batch file to insert the data from txt file to DB by using EXECUTE command.

Not applicable
Author

Hello,

Sorry for my english, and my probelm resides in the procces to save the csv into a sql database.

1.I already create an qvw, this one transforms my qvd into a csv.

2.A .bat  reload this qvw to transforms the data into csv

3.Then i need to store this csv into an sql database, but here i dont know how to do it by code.

Im using a .bat to do the all the thigs, but the third one is still wrong.

So many thanks!

bumin
Partner - Creator II
Partner - Creator II

Hi

I mostly do it in script.

So if you read your data in a QVD, you can read your QVD and generate an SQL-Statement for each row

Example

--------------

ListeSQL:

load 

cmpcode, code, text(BIC)    as    BIC, iban,

'update oas_elmbanklist set iban=#'&iban&'#,swift=#'&BIC&'# where cmpcode=#'&cmpcode&'# and elmcode=#'&code&'#'

as sqlstring

resident Liste;

drop table Liste;

Clever_Anjos
Employee
Employee

All modern databases provides a cmd line util to import data.

SQL Server - bcp

Oracle - sqlplus

Use your qlikview script to generate a csv file, or even better a text flat file with your inserts and then

EXECUTE bcp/sqplpus

vikasmahajan

Hope this help you

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.