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 912955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:28:19+00:00 2026-05-15T17:28:19+00:00

I have a scenario where I combine two tables into one (using UNION) and

  • 0

I have a scenario where I combine two tables into one (using UNION) and also JOIN data from some other tables.

I can do this either with a VIEW or a UDF/User Defined Function.

Considering that I have no view so far at all in my database, but quite a few UDF’s for fulltext search and the like, I’m tempted to use a UDF for this scenario as well to keep it “clean”.

However, this is entirely subjective and I wondered if there is a better objective reason to go for either a VIEW or a UDF in this scenario.

I did compare query plans for both and they are the exact same so I don’t believe there is a performance penalty or advantage for using either one.

Is there other reason to choose one over the other or does it not matter?

  • 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-15T17:28:20+00:00Added an answer on May 15, 2026 at 5:28 pm

    I would always use features in order of sophistication. A view is relatively straightforward in terms of performance profile and security management. I would probably use it first.

    I’m assuming you are talking about an inline table-valued UDF, which will pretty much have identical performance characteristics. Security on a UDF is a little different and you cannot have instead of triggers to be able to do “inserts” on the view. A benefit of the UDF would be that you can force parameters to be supplied, thereby ensuring usage patterns are as expected, whereas a view can be queried without any criteria (perhaps accidentally).

    If you did end up wanting to have a UDF for parameterization, you could layer it on top of the view (so no code duplication) and you should find that the performance is not affected significantly, because the optimizer can combine views and inline TVF fairly successfully.

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

Sidebar

Related Questions

Scenario I have a windows service written in C# that performs some processing based
Scenario: I have a generic list of Audits and a generic list of AuditImages.
The Scenario Currently I have a C# Silverlight Application That uses the domainservice class
My scenario is this: I have a base NHibernate query to run of the
I have two objects and I want to merge them: public class Foo {
I have a brain-teaser for all you SQL Server 2008 Reporting gurus out there
I have a table that stores the page hits on a web application, storing
I've been trying to write a mySQL-statement for the scenario below, but I just
I am trying to figure out if it is possible to create a foreign

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.