Is there a non-platform-specific SQL way of determining what data type a given field is?
That information is specific to each database. Every product stores its meta data differently. For example, SQL Server stores meta data in the system tables, which are all named according to its own standards.
This query returns all the table columns and data types in a SQL Server database:
SELECT so.name AS TableName, sc.name AS ColName,st.name AS 'Data Type'FROM syscolumns sc INNER JOIN sysobjects so ON sc.id = so.id INNER JOIN systypes st ON sc.xtype = st.xtypeWHERE (so.xtype = 'U')
If you want a generic procedure, you’ll have to use different queries and put in logic to check the current database.