Describe AS/400 command

845 pts.
Tags:
AS/400
AS/400 commands
Hi,
'Describe select * from tablename'.
We can use this statement from the DB2 command line , which results the complete definition of the table.
Could you please tell me the same, which I can use from STRSQL, as describe is throwing an error.
Thanks in advance


Software/Hardware used:
iseries

Answer Wiki

Thanks. We'll let you know when a new response is added.

Select * from (Tablename)
Then F4
Then F$ on the ‘Select fields’ line

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    50,605 pointsBadges:
    report
  • HABBIE
    Can i get a straight answer,thus this Describe statement will work with STRSQL? If not is there any other option to get the table definitions using STRSQL .
    845 pointsBadges:
    report
  • HABBIE
    What should I do with that F4 on that select statement. could u please elaborate .
    845 pointsBadges:
    report
  • philpl1jb

    Straight Answer.  The Describe command you are using is a custom statement.  We don't know what it calls but one way to see the column list in Interactive SQL would be

    to type SELECT * FROM myfile

    Press F4 (Prompt)

    Move cursor to Select fields line and press F4 (Prompt)

    You will see a list of the columns in the file you put in the initial command and can select the columns to work with.

     

    50,605 pointsBadges:
    report
  • HABBIE
    Thanks for ur answer Philp.
    But I am expecting something other. My thing is I should get the table/file definitions (column names,length,datatype,etc) & i need to save all those information on a separate file.
    just like describe stmt on Db2clp thus.it gives information of a file completely. The same thing I am trying with Native Iseries STRSQL to fetch the table/file  defnitions.
    845 pointsBadges:
    report
  • philpl1jb

    Then perhaps you didn't look here: http://stackoverflow.com/questions/580735/description-of-columns-in-a-db2-table

    select
    t
    .table_schema as Library
    ,t.table_name
    ,t.table_type
    ,c.column_name
    ,c.ordinal_position
    ,c.data_type
    ,c.character_maximum_length as Length
    ,c.numeric_precision as Precision
    ,c.numeric_scale as Scale
    ,c.column_default
    ,t.is_insertable_into
    from sysibm.tables t
    join sysibm.columns c
    on t.table_schema = c.table_schema
    and t.table_name = c.table_name
    where t.table_schema = 'MYLIB'
    and t.table_name = 'MYTABLE'
    order by t.table_name, c.ordinal_position

     

    50,605 pointsBadges:
    report
  • HABBIE
    I found the answer what I am looking for. 
    Select * from syscolumns where table_owner='username'.
    This will list all the columns from all the tables along with their definitions that are created under this user.
    we can give this from STRSQL itself.
    845 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following