如题
sql 怎么判断字段必须存在表A或者表B中呢? 

解决方案 »

  1.   

    主键or外键?楼主还是要sql语句?
      

  2.   

     select * from table_name where 字段=object_id('table_name')
      

  3.   

    感觉这里使用sql语句的if ,else判断比较好
      

  4.   

    mysql:
    show columns from tab where field = 'id';
    oracle:
    select table_columns from tab where column_name = 'id';
    如果没写错应该是这样的。你执行后看看有没有返回就知道了