Click to See Complete Forum and Search --> : how to get the datatype of a field in a table


venkytvs
February 2nd, 2000, 04:38 AM
Can anybody tell me how to get the datatype and size of a field in a table using SQL or in VB

Thanks in advance
Venky

February 2nd, 2000, 05:20 AM
I Don't know which database you're using but in SQL_SERVER 6.5 if you use the system stored procedure sp_columns and pass it a table name as a string then it will return you the information that you want in
TABLE_NAME,COLUMN_NAME,TYPE_NAME and LENGTH.
ie sp_columns 'table1' will return all the columns in table1 along with their data types and lengths of those datatypes
Hope this helps.