ALTER PROCEDURE FindeAllOrderCompanyNO
@companyNO varchar(50),
@supplierNO varchar(50),
@settlement int,
@endDateTime datetime,
@sign bit,
@ticketingTime datetime
AS
declare @sql varchar(max)
SET NOCOUNT ON;
set @sql =' select * from vw_tickDetail_tickorders_tickAirLines where CompanyNO in (select CompanyNO from TicketOrders GROUP by CompanyNO) and GetTicketTime<'''+cast(@endDateTime as varchar(20))+''' and GetTicketTime>='''+cast(@ticketingTime as varchar(20))+''' and GetTicketSign='''+cast(@sign as varchar(20))+''' '
if @companyNO is not null and @companyNO!=''
set @sql +=' and CompanyNO [email protected]+''''
if @supplierNO is not null and @supplierNO!=''
set @sql +=' and [email protected]+''''
if @settlement !='' and @settlement >-1
set @sql +=' and [email protected]+''
print @sql
exec (@sql)
RETURN
各位大侠,用什么办法可以使这个存储的效率更高点
------解决方案--------------------
仅看你的代码,没什么好办法。
你想实现什么样的功能,看看有没有其它途径。
------解决方案--------------------
把这个sql打出来看看。我们再分析
------解决方案--------------------
只有一个select查询,代码没什么可以优化了,
你在表上建索引优化吧