General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Why do i get exp_1, exp_2, etc. as col headers in sql output
The last in a series of sql statements writes to a table called final. In final, my column headers are listed as exp_1, exp_2, etc. on up to 9. I don't know why the original column names are not listed. Forcing an override with, for example 'select surveyans.mintro as mintro, fixes the problem. But what is the source of the problem.
The SQL is:
lc_responseid= '00000_0BG0ZFNPS'
SELECT surhdr.csurid, surhdr.mintro, surhdr.csurdescrip, surques.csurqno, surques.csurqtxt, ;
surques.csurqmid,surques.csurqtyp, surques.csection, surques.csecqno FROM SURHDR, SURQUES ;
WHERE SURHDR.CSURID=SURQUES.CSURID INTO TABLE surveydef
SELECT surveydef.csurid,surveydef.mintro,surveydef.csurdescri,surveydef.csurqno,surveydef.csurqtxt, ;
surveydef.csurqmid,surveydef.csurqtyp,surveydef.csection,surveydef.csecqno,surans.cansid,surans.cansans, ;
surans.cansansm,surans.canstyp ;
FROM surveydef, SURANS WHERE surveydef.CSURQNO=SURANS.CSURQNO INTO TABLE surveyans
select resphdr.cresphdrid,resphdr.drespdate,resphdr.cadminid,resphdr.cagentid,resphdr.csurid, ;
resphdr.crespnamid,resphdr.crespcoid,resphdr.mnotes,resphdr.cinterid,resphdr.crespconam, ;
resphdr.crespfname,resphdr.cresplname,respdtl.cresponse,respdtl.mresponse,respdtl.csurqno, ;
respdtl.csection ;
from resphdr, respdtl ;
where resphdr.cresphdrid=respdtl.cresphdrid and resphdr.cresphdrid = lc_responseid ;
into table responses
select surveyans.mintro, surveyans.csurdescri,surveyans.csurqtxt,surveyans.csurqmid,surveyans.csurqtyp,;
surveyans.csecqno,surveyans.cansid,surveyans.cansans,surveyans.cansansm,surveyans.canstyp ;
from surveyans outer join responses on surveyans.csurqno = responses.csurqno into table final
*Please not that if i replace the sql above that creates the final table with the same statement except for: select * from surveyans ...(rest same), it works fine
TIA
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only