日期:2014-05-18  浏览次数:20578 次

很简单的问题,但为什么这样不行?
use   Student
create   view   StuView
as
    select   *  
    from   select_course
    where   select_course.grade   is   not   null
go

新手上路,为什么上面的整体Comply不行,而去掉最一面的Use   Student就行呢?   感谢你的回复~

------解决方案--------------------
use Student
go --加上GO

create view StuView
as
select *
from select_course
where select_course.grade is not null
go
------解决方案--------------------
use Student
go
create view StuView
as
select *
from select_course
where select_course.grade is not null
go
------解决方案--------------------
use Student --说明要使用的表的名称,后加GO,分开执行代码
create view StuView
as
select *
from select_course
where select_course.grade is not null
go
------解决方案--------------------
use Student
go
create view StuView
as
select *
from select_course
where select_course.grade is not null
go
------解决方案--------------------
CREATE VIEW
创建一个虚拟表,该表以另一种方式表示一个或多个表中的数据。CREATE VIEW 必须是查询批处理中的第一条语句。


------解决方案--------------------
use Student
是当前使用哪个数据库的意思,加上go,
sql才会执行下面的语句
------解决方案--------------------
必须要go才行的.而且定义视图时,要求 create view必须是批处理的第一句呀.