create proc sp_test
as
begin
set nocount on
create tabel #temp(vol1 char(1),vol2 char(3))
insert into #temp values('1','234')
select * from #temp
end

解决方案 »

  1.   

    create proc sp_test
    as
    begin
    set nocount on
    create tabel ##temp(vol1 char(1),vol2 char(3))
    insert into ##temp values('1','234')
    end--调用:
    exec sp_test
    select * from ##temp
    drop table ##temp
      

  2.   

    在存储过程的最后加上SELECT即可。
      

  3.   

    CREATE FUNCTION fn_CustomerNamesInRegion
                     ( @RegionParameter nvarchar(30) )
    RETURNS table
    AS
    RETURN (
            SELECT CustomerID, CompanyName
            FROM Northwind.dbo.Customers
            WHERE Region = @RegionParameter
           )
    GO
    -- Example of calling the function for a specific region
    SELECT *
    FROM fn_CustomerNamesInRegion(N'WA')
    GO