exec sp_pkeys table1----得到表的主键

解决方案 »

  1.   

    sp_fkeys MLCultureInfo结果中的
    FKTable_Name即为关联的表的名称,FKColumn_Name即为关联表的字段名!
      

  2.   

    sp_fkeys MLCultureInfo
    这个语句怎么用啊? 怎样加上表的名字 @table_name 啊。
    我尝试过,报错。至于用 exec sp_fkeys @table_name='sale_fact'
    系统报错:Server: Msg 8145, Level 16, State 2, Procedure sp_fkeys, Line 0
    @table_name is not a parameter for procedure sp_fkeys.
      

  3.   

    我回答过!查询表@c的所有关联的外键:
    select object_name(parent_obj),* from sysobjects 
      where parent_obj=object_id(@c) and type='F'查询表@c的所有外键:
    select object_name(parent_obj),* from sysobjects 
      where id=object_id(@c) and type='F'我不确定,你自己试一试!
      

  4.   

    看不懂。
    用系统存储过程应该方便点吧,但我不会用 sp_fkeys