Last active
July 22, 2019 03:33
-
-
Save maravilloso/5763097 to your computer and use it in GitHub Desktop.
Obtener nombre y código de tipo de todas las columnas de la base de datos (obviando las de sistema)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CAST(t.tabname AS VARCHAR(15)) AS tabla, | |
CAST(colname AS VARCHAR(15)) AS campo, | |
CASE | |
WHEN coltype >= 256 THEN cast(coltype-256 AS VARCHAR(4)) | |
ELSE cast(coltype AS VARCHAR(4)) | |
END AS tipo, | |
collength AS lon | |
FROM syscolumns c, systables t | |
WHERE c.tabid=t.tabid AND t.tabname[1,2]='fa' | |
ORDER BY 1, 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 = CHAR | |
1 = SMALLINT | |
2 = INTEGER | |
3 = FLOAT | |
4 = SMALLFLOAT | |
5 = DECIMAL | |
6 = SERIAL * | |
7 = DATE | |
8 = MONEY | |
9 = NULL | |
10 = DATETIME | |
11 = BYTE | |
12 = TEXT | |
13 = VARCHAR | |
14 = INTERVAL | |
15 = NCHAR | |
16 = NVARCHAR | |
17 = INT8 | |
18 = SERIAL8 1 | |
19 = SET | |
20 = MULTISET | |
21 = LIST | |
22 = ROW (unnamed) | |
23 = COLLECTION | |
40 = Variable-length opaque type 2 | |
41 = Fixed-length opaque type 2 | |
43 = LVARCHAR (client-side only) | |
45 = BOOLEAN | |
52 = BIGINT | |
53 = BIGSERIAL | |
Según: | |
http://publib.boulder.ibm.com/infocenter/idshelp/v115/topic/com.ibm.sqlr.doc/ids_sqr_025.htm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment