Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Retrive column name from the table instead of column value which is having leading space. - response (5) by dnoeth

$
0
0

Your query should fail because you compare to "" instead of '' and there's no blank netween SAMPLE and 1.
Quote FLD_NM in your select, two single quotes result in one single quote, this should work:


SET Q1 = 'INSERT INTO DLWORK_DB01.TEMP1(COLUMNNAME) SELECT(''' || FLD_NM || ''') FROM '|| ' DLWORK_DB01.CLOSURE_CODE' ||
 ' WHERE ' || ' SUBSTR('||FLD_NM ||',1,1) = '''' SAMPLE 1' ;
  

 
You might also switch to TOP 1 or better EXISTS, which might provide better performance.
 
Dieter


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>