在SQLDataProvider中执行SP
我有一个带有 sqldataprovider 的 DNN 模块安装 Zip,创建的第一个过程创建了一个更改表并添加一些列的过程。但它所做的只是创建过程。我还需要它来运行和创建列,或者 datasqlprovider 中的其他存储过程失败,因为列不存在。所以我有这个:
-- Create stored procedure
CREATE procedure {databaseOwner}[AlterLeads]
As
ALTER TABLE namaocs.dbo.lead
ADD Downloaded bit
ALTER TABLE namaocs.dbo.lead
ADD DateTime DATETIME
ALTER TABLE namaocs.dbo.lead
ADD UserId INT
GO
它很好地创建了存储过程,我只需要它实际运行来创建列,以便其他存储过程成功运行。有什么想法吗?
I have a DNN Module Install Zip with a sqldataprovider and the first procedure created created a procedure that alters a table and adds some columns. But all it does is create the procedure. I also need it to run and create the columns or the other stored procedures in the datasqlprovider fail because the columns are not there. so I have this:
-- Create stored procedure
CREATE procedure {databaseOwner}[AlterLeads]
As
ALTER TABLE namaocs.dbo.lead
ADD Downloaded bit
ALTER TABLE namaocs.dbo.lead
ADD DateTime DATETIME
ALTER TABLE namaocs.dbo.lead
ADD UserId INT
GO
It creates the stored procedure fine, I just need it to actually run to create the columns so the other stored procedures run successfully. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有理由为此创建存储过程。存储过程适用于您想要多次运行的事情。您只需运行这三个语句一次。只需去掉前三行,这样就只剩下 ALTER 语句了。
There's no reason to create a Stored Procedure for this. A Stored Procedure is for something you'll want to run multiple times. You only need to run these three statements once. Just get rid of the first three lines so that you just have the ALTER statements.