Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add a column to SQL View (sql 2008r2)

Posted on 2014-01-22
2
Medium Priority
?
1,239 Views
Last Modified: 2014-01-23
I have a view that I want to add a new column to and be able to enter static values for reference. Thanks for any assistance.

 Example of current view to add new column
0
Comment
Question by:srodgers45
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
Vijaya Reddy Pinnapa Reddy earned 2000 total points
ID: 39802603
Syntax to add news columns to View
ALTER VIEW dbo.viewname
AS
SELECT originalcolumnlist, ColA+ColB AS col1, ColC+ColD as col2, ColE+ColF as col3, ColG+ColH as col4
FROM yourtable
0
 

Author Closing Comment

by:srodgers45
ID: 39803648
Thank you for the help.
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question