我们如何在事务中与其他查询一起创建 VIEW?

发布于 2024-12-14 02:28:22 字数 106 浏览 2 评论 0原文

我有一个查询生成器,我需要检查视图是否存在并重新创建它。另外我想在创建视图之前创建一个表。我怎样才能在事务中完成这些工作。

注意:create view 必须是批处理中的第一个语句。

I have a query generator, I need to check existence of a view and recreate it. In addition I want to create a table before of view creation. How can I do these works in a transaction.

note: create view must be the first statement in a batch.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

记忆之渊 2024-12-21 02:28:22

使用 GO 分隔您的语句

begin transaction    

create table xx ....

go

create view v_xx
as 
....

go

commit transaction

Separate your statements with GO

begin transaction    

create table xx ....

go

create view v_xx
as 
....

go

commit transaction
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文