create function [dbo].[f_ceshi] ( @strWhere varchar(1000) ) returns table return ( --'select * from tabelName ' + @strWhere --²éѯÓï¾äµÄwhereÌõ¼þÊÇÍⲿ¼ÆËãºó´«½øÀ´µÄ£¬ÕâÀïµÄ²éѯÓï¾äÈçºÎд¡£²¢·µ»ØÐÅÏ¢¡£
)
»»³É¹ý³Ì °É
create proc sp_ceshi @strWhere varchar(1000) as exec('select * from tabelName ' + @strWhere) go ʲô°¡£¡Äãд´íÁË SQL code:
create function [dbo].[f_ceshi] ( @strWhere varchar(1000) ) returns @temp table (id int identity(1,1), name varchar(50)) as begin return end
SQL code: create function [dbo].[f_ceshi] ( @strWhere varchar(1000) ) returns VARCHAR(8000) AS BEGIN DECLARE @S VARCHAR(8000) SET @S='select * from tabelName ' + @strWhere return @S END
µÚÒ»¾ä: select ht.gfdm,gfdm.gfmc,gfdm.lb ,sum(jh.htdj*jh.htsl)as je from ht left join gfdm on ht.gfdm=gfdm.gfdm join jh on ht.htbh=jh.hth and ht.htbh not like'del%' and ht. ......