当前位置: 代码迷 >> Sql Server >> 关于执行多条drop view,create view语句的有关问题
  详细解决方案

关于执行多条drop view,create view语句的有关问题

热度:15   发布时间:2016-04-27 14:17:26.0
关于执行多条drop view,create view语句的问题
有如下语句:
SQL code
drop view tablenamegocreate view tablename as    select * .....    ......drop view tablename2gocreate view tablename2 as    select * .....    ......

单独执行一段语句,如

SQL code
drop view tablenamegocreate view tablename as    select * .....    ......

没有任何问题,但是一起执行的时候总提示我drop附近或者create附近有语法错误,到底怎么一回事?

------解决方案--------------------
go
drop view tablename
go
create view tablename as
select * .....
......

go
drop view tablename2
go
create view tablename2 as
select * .....

这个你试试

------解决方案--------------------
SQL code
drop view tablenamegocreate view tablename as [...]godrop view tablename2gocreate view tablename2 as [...]go
------解决方案--------------------
drop view tablename

go

create view tablename as
select * .....
......

go

drop view tablename2

go

create view tablename2 as
select * .....
......

go
  相关解决方案