cancel
Showing results for 
Search instead for 
Did you mean: 

Ouput a string in a calculated column(Sqlscript)

tiago_queiroga
Explorer
0 Kudos

Hi there.

I am having issues with something that appears to be really simple.

I just want to add a calculated column in a projection and print a string in this row.

Like the example below:       

                  var_sales = CE_PROJECTION(:var_in,

                                    [                 

                                       "COMPANY",

                                       CE_CALC('SOME TEXT', varchar(100)) AS "TYPE"                                                                                                        

                                    ]

                  );

The odd thing is that if I put a INTEGER on 'SOME TEXT' it will work, but I need a string to be output.

In the graphical mode is really simple to do it, I just need to print the string in single quotes. But I have to do it in sqlscript because I am calling a procedure before it.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Quotes in SQLScript get tricky. The ' denotes the expression so you need to add another '' (triple quotes) to specify a string inside the expression. The following will compile.

var_sales = CE_PROJECTION(:var_in,

                                    [                

                                       "COMPANY",

                                       CE_CALC('''SOME TEXT''', varchar(100)) AS "TYPE"                                                                                                       

                                    ]

                  );

tiago_queiroga
Explorer
0 Kudos

Thank you very much John, it works.

Answers (0)