根据oracle的主键列生成SQLserver的主键

  • 根据oracle的主键列生成MsSQLServer的主键列
  1. select 'alter table  ' || cu.table_name ||'  add constraint  '||' PK_'||cu.table_name||'_'||cu.column_name ||' primary key ('||cu.column_name||')' from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' 


  • 查询oracle的主键列
  1. select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P'   





原文地址:https://www.cnblogs.com/scown/p/6187248.html