Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Changing Names in an SQL View

  1. May 18, 2015 #1

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    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.
     
  2. jcsd
  3. May 18, 2015 #2

    jedishrfu

    Staff: Mentor

  4. May 18, 2015 #3

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    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.
     
  5. Jun 3, 2015 #4
    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
     
  6. Jun 3, 2015 #5

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Thanks, avarma^2
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Changing Names in an SQL View
  1. SQL relationships (Replies: 3)

  2. Sql join? (Replies: 4)

  3. SQL Help (Replies: 2)

Loading...