当前位置: 代码迷 >> Sql Server >> sql语法有关问题,求解答
  详细解决方案

sql语法有关问题,求解答

热度:49   发布时间:2016-04-24 09:04:41.0
sql语法问题,求解答
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'if exists (select 1    from sys.sysreferences r join sys.sysobjects o on (o.id =' at line 1
/*==============================================================*/
/* DBMS name:      Microsoft SQL Server 2005                    */
/* Created on:     2015/5/17 22:54:34                           */
/*==============================================================*/


(提示错误)if exists (select 1
   from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
   where r.fkeyid = object_id('sname') and o.name = 'FK_SNAME_RELATIONS_班级')
alter table sname
   drop constraint FK_SNAME_RELATIONS_班级
go

if exists (select 1
   from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
   where r.fkeyid = object_id('专业方向') and o.name = 'FK_专业方向_RELATIONS_院系')
alter table 专业方向
   drop constraint FK_专业方向_RELATIONS_院系

------解决思路----------------------
贴出来的语句没有错误
------解决思路----------------------
拿 SQL Server 脚本到 MySQL 运行?
------解决思路----------------------
拿 SQL Server 脚本到 MySQL 运行?
  相关解决方案