How to get data type of database column using asp

mans4444
mans4444 used Ask the Experts™
on
Hello everybody!
I’m developing a solution in classic asp and msSql and I need to capture the data type of the column (whether char/integer/etc).  Any suggestions as to how it can be done? Any help welcome…
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
datatype = oRS.Fields("fieldname").Type

it returns a numeric value. some databases have their own types, so there's no complete list of what each number means.
This is the basics at least for the databases I have worked with.

Case 2,3: Long
Case 17: Integer
Case 4,5,6,131: Single or Double
Case 11: Boolean
Case 7,135: Date
Case 129,130,200,201,202,203: String

Commented:
additional: I have found typenumbers 128,204,205 to be BLOB. But is SQL Server datatype "timestamp" also returns 128
mans4444,
    thanks for returning :)

hongjun

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial