建站代码网

热门标签

一个通用查询的存储过程

set ANSI_NULLS onset QUOTED_IDENTIFIER ONGO-- =============================================-- Author: <Author,,shunzi >-- Create date: <Create 2007-03-22,,>-- Description: <Description,,>-- =============================================ALTER PROCEDURE [dbo].[Sh_Comm_query] @queryfield nvarchar(1000), --查询字段 @TableName nvarchar(100), --查询表名 @querywhere nvarchar(1000), --查询条件不带where @orderstring nvarchar(1000) --排序条件带order by ASdeclare @sql nvarchar(1000)BEGIN set @sql='Select '[email protected]+' from '[email protected]+' where '+ @querywhere+' '+ @orderstring+'' ---print @sql exec sp_executesql @sqlEND
这样做不知道效率怎么样??看过的朋友给点意见,

X