on 10-01-2015 3:49 PM
I know there is a way of returning all the metadata for a table including all the column types, but we have a slightly oddball situation where for one table depending upon the DB one column could either be a varchar or integer, therefore we need to validate a data-entry form to ensure strings are not entered where the data-type is integer
Is there any way, via SQL, to check the data-type just for a particular column?
Thanks
This data can be found in the system catalog using the SYSCOLUMNS view.
Query on sample database:
SELECT
coltype
FROM
SYS.SYSCOLUMNS
WHERE
tname = 'Contacts' // Table name
AND creator = 'GROUPO' // Table owner
AND cname = 'PHONE' // Column name
Result:
coltype
=====
char
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.