Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
loke2014
Contributor
Contributor

Qlikview - SQL replace statement error

Hi,

In SQL 2012, I'm using the replace query as shown below with no problem. However, when I used in the script editor, it returned an error in Qlikview.

select

t.tpc_num,

replace(t.tpc_subject, ',',' '),

t.create_time,

t.closed_time,

s.status_name,

m.mpt_num,

c.item_type

FROM tpc t WITH(NOLOCK);

Please assist.

Thanks.

1 Solution

Accepted Solutions
Kushal_Chawda

may be like this

select

t.tpc_num,

replace(t.tpc_subject, ',',' ') as tpc_subject,

t.create_time,

t.closed_time,

s.status_name,

m.mpt_num,

c.item_type

FROM tpc t WITH(NOLOCK);

View solution in original post

5 Replies
m_woolf
Master II
Master II

Try loading the t.tpc_Subject field as is and then do the replace in a preceding load.

Kushal_Chawda

may be like this

select

t.tpc_num,

replace(t.tpc_subject, ',',' ') as tpc_subject,

t.create_time,

t.closed_time,

s.status_name,

m.mpt_num,

c.item_type

FROM tpc t WITH(NOLOCK);

maxgro
MVP
MVP

Are you sure the problem is in replace function?

I just tried with a replace as your and I didn't get any error.

Also I've seen you have some other table alias in your code (bold) s, m, c but the table are missing.

select

t.tpc_num,

replace(t.tpc_subject, ',',' '),

t.create_time,

t.closed_time,

s.status_name,

m.mpt_num,

c.item_type

FROM tpc t WITH(NOLOCK);

Peter_Cammaert
Partner - Champion III
Partner - Champion III

It's always great to get hold of the actual error message text.

BTW the QlikView scripting engine puts everything between (SQL) SELECT and the semicolon as-is in a packet buffer and sends it unparsed to the Relational Database. It would be weird for QlikView instead of the RDBMS parser to return an error for bad SQL syntax...

loke2014
Contributor
Contributor
Author

Hi,

Thanks for all the feedback.  Kush141087 gave me the correct working solution.