Sql Server 函数的操作实例!(执行多条语句,返回Select查询后的临时表)
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= CREATE FUNCTION csj_csj(@id as int) RETURNS @temp table --这里返回一个自己创建的表,里面的字段根据自己的需要设 ( [id] int, [zd] varchar(100), [xl] varchar(100) ) AS BEGIN insert into @temp select id,zd,xl from deb -- 把查询出的Sql语句插入到临时表中,注意字段一致 return --这里别忘了return,不然不给查询! END GO