Hi, is there a way to retrieve the data type of table columns? the information in SYSCOLUMN are not enough, because they don't tell whether the column is CHAR or INT or DATE.
Even in SYSOBJECT I couldnt find such info.
The only way to get this info is DESCRIBE TABLENAME, but I need to inquire the data type inside a procedure, so I need it as select statement.
Request clarification before answering.
Ah, found it, the view SYSCOLUMNS has the full answer!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, for current versions, system view SYSTABCOL would be the natural choice - note, it returns variable-sized types including their declared width, such as "char(1)" or "varchar(128)".
Using SYSCOLUMNS tends to be error-prone IMHO as there might be two such views, one owned by SYS and the other by dbo...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.