创建视图出错,请指教??

yinxj2006 2006-06-28 04:22:46

CREATE VIEW dbo.MenuView
AS
SELECT t1.MenuId, t1.MenuCaption, t1.MenuParent, t2.MenuCaption AS MenuParentCaption
FROM dbo.MenuInfo t1 LEFT OUTER JOIN
dbo.MenuInfo t2 ON t1.MenuParent = t2.MenuId
WHERE (t1.MenuId <> t1.MenuParent)

SET QUOTED_IDENTIFIER OFF

SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_NULLS ON
提示:'CREATE VIEW' 必须是批查询中的第一条语句。这是什么意思呀?怎么解决??
...全文
156 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
marco08 2006-06-28
  • 打赏
  • 举报
回复
GO
GO
GO
78984598 2006-06-28
  • 打赏
  • 举报
回复
视图间加GO
paoluo 2006-06-28
  • 打赏
  • 举报
回复
每個視圖創建完成後加上一個GO



Create View V1
As
...
GO
Create View V2
As
...
GO
yinxj2006 2006-06-28
  • 打赏
  • 举报
回复
当我同时创建多个视图时才出现那个提示??那是怎么回事呀??
hyrongg 2006-06-28
  • 打赏
  • 举报
回复
CREATE VIEW dbo.MenuView
AS
SELECT t1.MenuId, t1.MenuCaption, t1.MenuParent, t2.MenuCaption AS MenuParentCaption
FROM dbo.MenuInfo t1 LEFT OUTER JOIN
dbo.MenuInfo t2 ON t1.MenuParent = t2.MenuId
WHERE (t1.MenuId <> t1.MenuParent)
GO
liangpei2008 2006-06-28
  • 打赏
  • 举报
回复
--这样呢?
GO
CREATE VIEW dbo.MenuView
AS
SELECT t1.MenuId, t1.MenuCaption, t1.MenuParent, t2.MenuCaption AS MenuParentCaption
FROM dbo.MenuInfo t1 LEFT OUTER JOIN
dbo.MenuInfo t2 ON t1.MenuParent = t2.MenuId
WHERE (t1.MenuId <> t1.MenuParent)

SET QUOTED_IDENTIFIER OFF

SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_NULLS ON

27,581

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧