运行存储过程以创建临时表 [英] Running Stored Procedure to create temporary table

查看:366
本文介绍了运行存储过程以创建临时表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直绞尽脑汁试图让这段代码正常工作。我正在尝试创建一个应用程序来在MS SQL服务器上运行存储过程。存储过程旨在删除temoporary表,然后创建替换临时表。它将删除原始表,但不会创建新表。这是我的代码和SP的布局示例。任何帮助是极大的赞赏!!! Jason。

I have been racking my brains to try to get this code working. I am trying to create an app to run a stored procedure on MS SQL server. The stored procedure is designed to delete a temoporary table and then create a replacement temporary table. It will delete the original table but it will not create the new table. Here is my code and a sample of the layout of the SP. ANY help is greatly appreciated!!! Jason.

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号

推荐答案

存储过程在单独运行时有效吗?
The stored procedure works when run by itself?


@Rabbit


是的,如果我通过MSSQL管理工作室运行它可以实现我想要的功能。当我从应用程序运行它时,它会删除临时表,但它不会创建新表。我在app中的连接字符串中使用相同的userID和PW,用于登录以从管理工作室运行SP。
@Rabbit
Yes, if I run it through MSSQL managment studio it does what I want. When I run it from the application it drops the temp table but it does not create the new table. I am using the same userID and PW in the connection string in the app that I am using to login to run the SP from managment studio.


我认为没有理由不应该这样做如果通过管理工作室工作,则工作。


尝试在存储过程中添加一些调试行,让它在表中插入一些记录,看看它是如何进展的通过sp。
I see no reason why it shouldn''t work if it works in through the management studio.

Try adding a few debug lines into the stored procedure and have it insert a few records into a table to see how it''s progressing through the sp.


这篇关于运行存储过程以创建临时表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆