Tem como saber este campo e Primary Key?
Ola pessoal, sera que existem uma propriedade que me retorne True caso o campo seja primary key ex:
if Sys_Campos.FieldByName(´cCampo´).AsString then
ShowMessage(´Este campo e Primary key´)
:wink:
if Sys_Campos.FieldByName(´cCampo´).AsString then
ShowMessage(´Este campo e Primary key´)
:wink:
Rodrigo Ferreira
Curtidas 0
Respostas
Infante
30/04/2003
Tem Sim.
se vc estiver utilizando interbase e firebird o código abaixo servirá, transforme ele numa função.
este código busca a informação no schema do BD
.......................................................................
select rdb$field_name,RDB$FIELD_POSITION
from RDB$index_segments
where rdb$index_name IN ( select RDB$index_name
from RDB$relation_constraints
where rdb$constraint_type = ´PRIMARY KEY¬´ and
RDB$Field_name = ´Nome do Campo que deseja Verificar´
se vc estiver utilizando interbase e firebird o código abaixo servirá, transforme ele numa função.
este código busca a informação no schema do BD
.......................................................................
select rdb$field_name,RDB$FIELD_POSITION
from RDB$index_segments
where rdb$index_name IN ( select RDB$index_name
from RDB$relation_constraints
where rdb$constraint_type = ´PRIMARY KEY¬´ and
RDB$Field_name = ´Nome do Campo que deseja Verificar´
GOSTEI 0
Rodrigo Ferreira
30/04/2003
Valeu ! :wink:
GOSTEI 0