ComoAcharCampos.txt
1 |
Sqls para auxilar na tarefa encontrar campos em um banco dadaos desconhecido. |
---|---|
2 |
|
3 |
|
4 |
|
5 |
----Sql SERVER |
6 |
SELECT |
7 |
T.name AS Tabela, |
8 |
C.name AS Coluna |
9 |
FROM |
10 |
sys.sysobjects AS T (NOLOCK) |
11 |
INNER JOIN sys.all_columns AS C (NOLOCK) ON T.id = C.object_id AND T.XTYPE = 'U' |
12 |
WHERE |
13 |
C.NAME LIKE '%NomeDoCampo%' |
14 |
ORDER BY |
15 |
T.name ASC |
16 |
|
17 |
|
18 |
----Postgress |
19 |
|
20 |
SELECT * |
21 |
FROM information_schema.columns |
22 |
where information_schema.columns.column_name = 'referencia' |
23 |
|
24 |
|
25 |
|
26 |
-----Oracle |
27 |
|
28 |
SELECT * |
29 |
FROM |
30 |
USER_TABLES TABELA, |
31 |
USER_TAB_COLUMNS COLUNAS |
32 |
WHERE |
33 |
-- JOINS |
34 |
TABELA.TABLE_NAME = COLUNAS.TABLE_NAME |
35 |
AND COLUNAS.COLUMN_NAME LIKE '%ESTADUAL%' |
36 |
|
37 |
|
38 |
-----fireBird |
39 |
|
40 |
select rdb$relation_name, rdb$field_name |
41 |
from rdb$relation_fields |
42 |
order by rdb$relation_name, rdb$field_name; |