CREATE proc Testn
AS 
declare @TmpRs table(ID decimal)
insert into @TmpRs select ID from cus
Select * from @TmpRs 
go
-----------------------------
--调用
exec testn
drop proc testn
---------------------
/*
ID
1
2
3
4
5
6
7
*/

解决方案 »

  1.   

    应该是你的表:tblbank中没有值吧
      

  2.   

    存储器返回一个表就可以了.
    RETURNS @CheckStat Table(
                                                    ID                      int identity(1,1),
                                                   TypeID               int,
                                                   PlaceID              int,
                                                   AreaID                int)
      

  3.   

    tblbank表中是有值的,直接在查询分析器里执行exec test也没问题,可以看到记录,但我在外部程序中调用却找不到记录,如我在VB中调用:    Dim cmd As New ADODB.Command
        Dim Rs As New ADODB.Recordset
        
        cmd.ActiveConnection = g_DB  'g_DB 是一个全局连接Connection对象,已经打开
        cmd.CommandText = "TEST"
        cmd.CommandType = adCmdStoredProc
        Set Rs = cmd.Execute
        MsgBox Rs.RecordCount    '这里出错,提示:对象关闭...
    '如果我在存储过程中不对表变量进行insert into 操作,Rs.RecordCount可以正常返回为0