Filtro para criação de tabela
Citação de Kindrazki em 15 de maio de 2013, 15:11Caso for preciso criar alguma tabela no banco,
para automatizar o processo foi elaborada a seguinte rotina:
[i]Firebird[/i]:
[code]
# Procura se a tabela [i]xxxx[/i] já existe
sql Select count(*) as TABELA from lower(rdb$relations) where rdb$relation_name = 'xxxx';# Se não existir, cria
if $c{TABELA} == 0 ;
sql_exec Create table xxxx(campo1 integer, campo2 integer, primary key (campo1));
end_if ;
[/code]
Caso for preciso criar alguma tabela no banco,
para automatizar o processo foi elaborada a seguinte rotina:
[i]Firebird[/i]:
[code]
# Procura se a tabela [i]xxxx[/i] já existe
sql Select count(*) as TABELA from lower(rdb$relations) where rdb$relation_name = 'xxxx';
# Se não existir, cria
if $c{TABELA} == 0 ;
sql_exec Create table xxxx(campo1 integer, campo2 integer, primary key (campo1));
end_if ;
[/code]
Citação de Kindrazki em 17 de maio de 2013, 10:32para postgre:
[code]sql select count(*) as tabela from information_schema.tables where lower(table_name) = 'xxxx';[/code]Para sybase:
[code]sql Select count(*) as TABELA from systable where lower(table_name) = 'xxxx' ;[/code]
para postgre:
[code]sql select count(*) as tabela from information_schema.tables where lower(table_name) = 'xxxx';[/code]
Para sybase:
[code]sql Select count(*) as TABELA from systable where lower(table_name) = 'xxxx' ;[/code]
Citação de Kindrazki em 14 de agosto de 2013, 17:03Para db2:
[code]
sql select count(*) as TABELA from sysibm.systables where lower(name) = 'xxxx';
[/code]
Para db2:
[code]
sql select count(*) as TABELA from sysibm.systables where lower(name) = 'xxxx';
[/code]