cancel
Showing results for 
Search instead for 
Did you mean: 

Do string functions work with variables?

arpitasethi
Explorer
0 Kudos

Dear Experts,

I want to use string functions for variables, i.e., I would have the string stored in a local nvarchar variable and this is what I would pass for string manipulations.

I tried this in the SQL editor and it gives me errors.

 

Select 'Hello' as str from dummy;

SELECT  LEFT (:str, 1) "left" FROM DUMMY;

It says feature not supported.

Mostly, I want to use functions like :

c1 := select substr(:spl_char, 1, 1) from dummy;

select replace(:help_string, ' ', :c1) from dummy;

The idea is to use the string as an array... Is there a better way?

Please suggest.

Thanks alot for helping so far!!

Arpita 

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184768
Active Contributor
0 Kudos

Hi Arpita,

I don't think SQL editor will identify the variable. There is no way to declare it in SQL editor. So in SQL editor LEFT / substr / replace will work on actual values.

This will work in SQL script. Secondly in SQL script you don't need to perform a SELECT from dummy. You can use the string functions directly.

Regards,

Ravi