Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2010
    Posts
    14

    Smile Unanswered: changing structure of the table

    HI guys, i want to know how to change the structure of the table. for example, we have a table name as employee_details and we have three columns named as employee_name, employee_id, employee_dept

    employee_detais
    employee_name \ employee_id \ employee_dept



    now, i want to change the structure of the table, something like


    employee_id \ employee_name \ employee_dept



    is there any query or way by which we cam do this?

    Thank you guys

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by sahendramansingh View Post
    is there any query or way by which we cam do this?
    yes, although i strongly advise against it
    Code:
    SELECT employee_id 
         , employee_name 
         , employee_dept
      INTO temp_details
      FROM employee_details
    GO
    DROP TABLE employee_details
    GO
    EXEC sp_rename 'temp_details', 'employee_details'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •