Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3238104
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:48:55+00:00 2026-05-17T17:48:55+00:00

When creating a user defined function is it bad to just automatically use the

  • 0

When creating a user defined function is it “bad” to just automatically use the largest string possible?

For example, given the following UDF, I’ve used nvarchar(max) for my input string, where I know perfectly well that the function currently isn’t going to need to accept nvarchar(max) and maybe I’m just forward thinking too much, but I supposed that there would always be the possibility that maybe an nvarchar(max) would be passed to this function.

By doing something “bad” I’m wondering that by declaring that this function could possibly receive and actual nvarchar(max) am I doing anything to possibly cripple performance?

CREATE FUNCTION [dbo].[IsMasNull] (@value nvarchar(max)) 
RETURNS BIT
AS
BEGIN
    RETURN 
        CASE 
            WHEN @value IS NULL THEN 1
            WHEN CHARINDEX(char(0), @value) > 0 THEN 1
            ELSE 0
        END
END
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:48:56+00:00Added an answer on May 17, 2026 at 5:48 pm

    NVARCHAR(MAX) will affect performance if its a database column. As a parameter to a stored procedure it should make no difference. If at all there is a degraded performance its because of the sheer size of the data and not the datatype.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the SQL::Statement::Functions documentation: Creating User-Defined Functions ... More complex functions can make use
I'm totally stuck on creating a user defined function in Excel VBA for the
I'm creating a CLR user defined function in Sql Server 2005 to do some
Why is it that for user defined types when creating an array of objects
Has anyone had success creating a custom list component which accepts a user defined
I need a user defined function to insert a new record and return the
I'm interested in creating a system where the user can define the steps in
Is there some kind of tool for creating user interfaces using ATL for C/C++?
I'm creating a User Interface using PyQt4 module . the problem i'am facing is
I'm creating a user form that requires the functionality for people to come back

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.