How to Modify Names in an SQL View?

  • Thread starter Thread starter WWGD
  • Start date Start date
  • Tags Tags
    Sql
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 1K views
Science Advisor
Homework Helper
Messages
7,888
Reaction score
13,203
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.
 
Physics 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