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
as
begin
set nocount on
create tabel #temp(vol1 char(1),vol2 char(3))
insert into #temp values('1','234')
select * from #temp
end
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
( @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