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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:34:29+00:00 2026-05-26T19:34:29+00:00

I am occasionally forced to use MS-SQL, so my knowledge of it is basic.

  • 0

I am occasionally forced to use MS-SQL, so my knowledge of it is basic. I’m sure the following problem is piece of cake for an MS-SQL expert, but for me this looks really like a nasty bug:

Say I have a simple table containing a person’s last name, first name, and email, like this:

CREATE TABLE dbo.people
(
lastName varchar(50) NULL,
firstName varchar(50) NULL,
email varchar(50) NULL
)

Now I’m going to create a view so I have some pre-concated fields, like this:

CREATE VIEW v_people AS
SELECT
    people.*,
    people.lastName + ' ' + people.firstName AS concatName
FROM people

Now I notice that I forgot the Phone number field, and alter the original table, but ONLY the table, NOT the view:

ALTER TABLE dbo.people ADD
phone varchar(50) NULL

Cool, also works. But what now happened to the view is quite horrible: The view field ‘concatName’ does not contain the concated names, but the Phone Numbers, even if the view fields are STILL the same amount and names!

It seems that MS-SQL is just moving the data columns within the view without updating the column definitions. Quite horrible scenario, if you forget to update views that depends on tables you alter…

Do I have overseen something, or am I really responsible for always checking / altering all the views if I just add a new table column? Is there a way to let the MS-SQL server at least throw a warning about depending views?

I noticed that it does not happen if the view is constructed like this:

CREATE VIEW v_people AS
SELECT
    people.lastName + ' ' + people.firstName AS concatName,
    people.*
FROM people

But for me this just looks like a nasty workaround….

Any hints?

  • 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-26T19:34:30+00:00Added an answer on May 26, 2026 at 7:34 pm

    You need to call sp_refreshview 'YourView' after altering the definition of tables selected from with *.

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

Sidebar

Related Questions

Okay, so this is not the first time I've had this problem, but it
Occasionally, on a ASP (classic) site users will get this error: [DBNETLIB][ConnectionRead (recv()).]General network
I'm forced to use JUnit 3. If I were using JUnit 4, I would
I have coworkers who occasionally use typedef to avoid typing. For example: typedef std::list<Foobar>
I'm using jQuery UI Select Menu and occasionally have some issues. This is located
I have some code in my application that looks something like this: char *hash
Occasionally I've seen code wrapping email messages to make sure a single line is
Occasionally, seemingly randomly, about once a week, I get the following error in the
When I developed a piece of (academic) software using Java, I was forced to
OK, so I have isolated this down to a very specific problem. I was

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.