Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Types

Status
Not open for further replies.

larsbop

Programmer
Aug 19, 2003
1
DK
I need to export the name of certain user tables along with the names of their columns and which type the column contains ie. varchar / ingeger and so on. I can figure out the table and column names - but how do i retrieve information about the data-types in each column ?

My query so far:

-------------------------
select obj.Name as Tbl,Col.Name as Col
from sysobjects obj, syscolumns col
where obj.xtype='U' and obj.Name like 'netop%' and obj.id=col.id
-------------------------

Thx. in advance
 
It would probably depend on which RDBMS you are using. In Oracle, you would look at dba_tab_columns, all_tab_columns, or user_tab_columns for this information.
 
It looks like you're using SQL Server. Use the information_schema views:

Code:
select table_name, column_name, data_type, character_maximum_length
from information_schema.columns
where table_name like 'netop%'

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top