开发者

Selecting a Function Value Shows nvarchar(4000) on an Index

I have a view that 开发者_开发知识库I'm trying to setup an Index for. One of the select columns for the view executes a user-defined function that has a return value of varchar(250). However, when I try to setup an Index on that column, I see a size of nvarchar(4000). Why is that and will that cause a problem if I continue to setup my index?


Does running sp_refreshview 'YourViewName' resolve the issue? (I think you will need to change the view to use WITH SCHEMABINDING as well)


i think your main suggestion here is going to be to ditch the scalar udf. they're an awful performance drag. is there a legitimate business reason for the udf?

pull the code out of the scalar function and place it inside of the view directly and see if that alleviates your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜