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

Sql Script Error

Hi at all,

I have loaded a table from a database called "PORDINE", in this table there is a field called "VARIANTI" in which there is indicated the dimension of different objects in this format:   "VDIM=340~1200~28".

So i created another table from this one with only this field and then i would like to create three new fields with the three different dimension: DIM_01 = 340, DIM_02 = 1200 and DIM_03 = 28.

I created a formula that does this job (i tried in the qlik application in a straight table) and i would like to add in the script in order to create the dimensions, but the script doesn't works.

Varianti:

SQL Select

VARIANTI,

IF(Left(VARIANTI,4) = 'VDIM',SubField(purgechar ( VARIANTI,'VDIM=' ),'~',3),'')            as DIM_03

From dbo.PORDINE;


The error message is the follow:

ErrorSource: Microsoft OLE DB Provider for SQL Server, ErrorMsg: Incorrect syntax near ','.

Anyone has an idea about how to fix it?

Andrea

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Sorry can you close the Preceding Load with semicolon like here

Varianti:

LOAD VARIANTI,

          IF(Left(VARIANTI,4) = 'VDIM',SubField(purgechar ( VARIANTI,'VDIM=' ),'~',3),'') as DIM_03;

SQL Select

                        VARIANTI

From dbo.PORDINE;

View solution in original post

3 Replies
vishsaggi
Champion III
Champion III

Try this:

Varianti:

LOAD VARIANTI,

           IF(Left(VARIANTI,4) = 'VDIM',SubField(purgechar ( VARIANTI,'VDIM=' ),'~',3),'') as DIM_03

SQL Select

                         VARIANTI

From dbo.PORDINE;

andrea90casa
Creator
Creator
Author

Hi Vishwarath

It give to me an error in the second part

Varianti:

LOAD VARIANTI,

           IF(Left(VARIANTI,4) = 'VDIM',SubField(purgechar ( VARIANTI,'VDIM=' ),'~',3),'') as DIM_03

SQL Select

                         VARIANTI

From dbo.PORDINE;

vishsaggi
Champion III
Champion III

Sorry can you close the Preceding Load with semicolon like here

Varianti:

LOAD VARIANTI,

          IF(Left(VARIANTI,4) = 'VDIM',SubField(purgechar ( VARIANTI,'VDIM=' ),'~',3),'') as DIM_03;

SQL Select

                        VARIANTI

From dbo.PORDINE;