Array
(
)

Conversão para sql server

Jordelino Santos
   - 01 jun 2010

Alguem sabe como converter essa instrução do firebird para sql server?
    select b.rdb$field_name as Campo                     
      from rdb$relation_constraints a                    
    inner join rdb$index_segments b                     
    on b.rdb$index_name = a.rdb$index_name
    where a.rdb$constraint_type = 'PRIMARY KEY' and  
    a.rdb$relation_name = :tableName

    and exists( select 1 from RDB$RELATION_FIELDS r
                        where r.RDB$RELATION_NAME = a.RDB$RELATION_NAME and
                             ( ( r.RDB$BASE_FIELD = b.rdb$field_name) or ( r.RDB$FIELD_NAME = b.rdb$field_name) ) ))

Valeu

Fabriciolimadba
   - 29 jul 2010

 

0
|
0

Emerson
   - 30 jul 2010

creio que seja:

select
  OBJECT_NAME(OBJECT_ID(N'SA1010')) as Tabela,
  c.name as Campo
from
  sysindexes i
inner join sysobjects o on
  o.id = OBJECT_ID(i.name) and objectproperty(o.id, 'IsPrimaryKey') = 1
inner join sysindexkeys k on
  k.id = i.id and k.indid = i.indid
inner join syscolumns c on
  c.id = i.id and c.colid = k.colid
where
  i.id = OBJECT_ID(N'CLIENTE')

0
|
0

Fabriciolimadba
   - 30 jul 2010

Hum... isso mesmo... pensei que quisesse apenas fazer a query rodar em sql. Não reparei nos nomes das tabelas..   Valeu Emerson.

0
|
0