create view ttargetview as select * from sourcetable
应该就行了。
但是问题又来了,如何在一个database中,把view创建到另一个database中?
例如我在'a'这个database中执行create view b.dbo.ttargetview as select * from b.dbo.sourcetable
报错:
Server: Msg 166, Level 15, State 1, Line 1
'CREATE VIEW' does not allow specifying the database name as a prefix to the object name.
怎么办?
最初由 shiyiming 发布
[B]create view ttargetview as select * from sourcetable
应该就行了。
但是问题又来了,如何在一个database中,把view创建到另一个database中?
例如我在'a'这个database中执行create view b.dbo.ttargetview as select * from b.dbo.sourcetable
报错:
Server: Msg 166, Level 15, State 1, Line 1
'CREATE VIEW' does not allow specifying the database name as a prefix to the object name.
怎么办? [/B]
你的意思是在本地数据库创建远程数据库的视图对吧? 不知道我理解得对不对哈!
如果失败:第一看你是否有管理远程服务器和创建视图权限
第二你是否已经通过本地服务器链接到远程服务器上
第三确认你的语句是否完全正确
第四确认远程服务器上是否已经有了此视图同名的视图