本文介绍了如何在sql中创建索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ALTER 功能 dbo.getThisPVFooterAmount( @ PVoucherHeaderId int , @ FooterAccountId int ) RETURNS money AS BEGIN return (从 trans_PurchaseVoucherDetails ( nolock ) 其中 PurchaseVoucherHeader_Id = @ PVoucherHeaderId 和 Record_Type = ' F' 和帐户_Id = @ FooterAccountId) END
我有这个功能。如何在PurchaseVoucherHeader_Id上创建索引,Record_Type,Account_Id ????
解决方案仅限对于相同的参数 - 确定性的函数 - 总是返回相同结果的函数可以被索引。
hi CREATE INDEX index_name ON table_name(column_name)
ALTER FUNCTION dbo.getThisPVFooterAmount ( @PVoucherHeaderId int ,@FooterAccountId int) RETURNS money AS BEGIN return (select Amount from trans_PurchaseVoucherDetails with (nolock) where PurchaseVoucherHeader_Id=@PVoucherHeaderId and Record_Type ='F' And Account_Id =@FooterAccountId ) END
I have this function. how to create index on PurchaseVoucherHeader_Id,Record_Type,Account_Id ????
解决方案 Hi, Only functions that always return the same result for the same parameters—functions that are deterministic—can be indexed.hi CREATE INDEX index_name ON table_name (column_name)更多推荐
如何在sql中创建索引
发布评论