Setting NOCOUNT ON in UDFs

  • I know NOCOUNT should be set on in Stored Procs for performance reasons. Does this hold true for UDFs as well?

    I searched SSC as well as on google and didn't find anything definitive.

    Thanks for your assistance!

  • For inline table-value UDFs, no (because you can't). For the rest, yes.

    Edit: Nope. I was wrong. Can't set it.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Thank you, GSquared.

    I should have just tried it myself and seen the error message. I sometimes just make things harder for myself just for fun. 🙂

  • With these settings it is always interesting to see what happens

    if you perform "set nocount on" before you create the udf ....

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Won't matter. It's a connection property, not an object property.

    Since you'll mainly be calling UDFs from within procs, if you set nocount on in the proc, that'll handle it.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply