How to Modify Names in an SQL View?

  • Thread starter Thread starter WWGD
  • Start date Start date
  • Tags Tags
    Sql
Click For Summary

Discussion Overview

The discussion revolves around modifying names in an SQL view, specifically focusing on changing field names within a view rather than the view's name itself. Participants explore various methods and commands related to SQL views.

Discussion Character

  • Technical explanation, Conceptual clarification

Main Points Raised

  • One participant seeks guidance on how to change names in an SQL view, indicating a lack of clarity on the specific changes needed.
  • Another participant asks for clarification on whether the request pertains to changing the view's name or the column names, and inquires about the database being used.
  • A participant suggests that deleting and recreating the view may be a solution, referencing the ALTER command as a method for modification.
  • One participant expresses a specific interest in changing a field name within a view and thanks others for the provided links.
  • A later reply provides an example of using the ALTER VIEW command to modify a view, illustrating the SQL syntax involved.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the best approach to modify names in an SQL view, as different methods and interpretations of the request are presented.

Contextual Notes

There is a lack of specific details regarding the database system in use, which may affect the applicability of the suggested methods. Additionally, the discussion does not clarify whether certain assumptions about SQL syntax and commands are universally applicable.

Who May Find This Useful

Individuals working with SQL databases who are interested in modifying views or learning about SQL commands related to view management may find this discussion relevant.

WWGD
Science Advisor
Homework Helper
Messages
7,806
Reaction score
13,120
Does anyone know how to change names in an SQL view (i.e., a sort of a subset of a database. We may create it by saving a query and then doing a query on this saved query )?
Thanks.
 
Technology news on Phys.org
Hi, thanks. It is kind of hard for me to export the database here. I am interested in changing the name of a field within a view in SQL.
Thanks for the links.
 
You need to use 'ALTER VIEW' e.g.

ALTER VIEW HumanResources.EmployeeHireDate
AS
SELECT p.FirstName, p.LastName, e.HireDate
FROM HumanResources.Employee AS e JOIN Person.Person AS p
ON e.BusinessEntityID = p.BusinessEntityID
WHERE HireDate < CONVERT(DATETIME,'20020101',101) ;
GO
 
Thanks, avarma^2
 

Similar threads

  • · Replies 51 ·
2
Replies
51
Views
6K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 50 ·
2
Replies
50
Views
9K
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
1K