substr(item_desc,1, (INDEX(item_desc, ' ')- 1)) put a space between trhe quotes if the INDEX function. INDEX returns and integer, subtract one to get the end of word.
If the item_desc field is empty, this -1 can cause out of range problems, so don't subtract it and leave a space on the end.
Is there a way to check for a char that occurs many times in the field? For example, I have a field with many '-' in it. I need to substr the data between the 4th and 5th '-'.
This is a "quick and dirty" solution. I understand there is dynamic SQL possibilities in stored procedures, but I have not worked with them yet.
In bteq, try the following:
.set titledashes off;
.export report file=temp.sql;
select 'drop table '||trim(tvmname)||';' title ''
from dbc.tables
where databasename = 'mydbase'
and tablename = 'mytable'
and tablekind='t';
.export reset;
.if activitycount = 0 then .goto done;
database mydbase;
.run file=temp.sql;
.label done;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.