【问题标题】:Sybase # tablesSybase # 表
【发布时间】:2018-11-09 14:21:36
【问题描述】:

我正在尝试调试填充#table 的存储过程(比如说proc1),比如说#reserves。该过程没有针对#reserves 的插入语句,但仍有一些数据被填充到表中,这些数据作为结果集发送到输出。

Proc1 在内部调用 Proc2,它也声明了 #reserves 并填充了一些数据。我的问题是 - Proc2.#reserves 有没有办法将数据发送到 Proc1.#reserves?

以下是示例程序

Create Proc1
As
Begin

Create Table #Reserves
(
id int not null,
value int not null
)

Exec Proc2

Select id,
value 
from #Reserves
End

Create Proc2
AS
Begin

Create Table #Reserves
(
id int not null,
value int not null
)

Insert into #reserves
(id, value)
Select 1 as id,2 as value

End

【问题讨论】:

    标签: sybase sap-ase


    【解决方案1】:

    每个 proc 都在创建自己的 #Reserves 版本(这在 ASE 中是可行的;如果在退出 proc2 之前查询 tempdb 的 sysobjects 表,您应该会看到 name like '#Reserves%' 的 2 个条目。

    如果您希望proc2 填充由proc1 创建的#Reserves,请考虑将proc2 修改为仅在#Reserves 不存在时创建它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多