Click here to Skip to main content
15,905,875 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi all,

I have a table with 2 columns named Depot_Id & Depot_Name, i have to make another table from the values inserted into Depot_Name as the columns of new table.

I dont have any idea for that...
kindly suggest me solution for this.

this is Depot Table:-

Depot_Id Depot_Name


1 A
2 B
3 C

Now i need another table in which column name shuold b A,B and C..
Posted
Updated 25-May-13 1:47am
v2
Comments
OriginalGriff 25-May-13 7:40am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
abhishekagrwl25 25-May-13 7:48am    
i have improved the ques, is this understandable to you..??

1 solution

You don't need to create another table to get only Depatment names. You can simle SELECT[^] these values using query:
SQL
SELECT DepName
FROM YourTable
ORDER BY DepName


But if really want to create new table, please, refer below links:
CREATE TABLE[^]
INSERT statement (T-SQL)[^]

SQL
INSERT INTO NewTable (DepName)
SELECT DepName
FROM YourTable
ORDER BY DepName
 
Share this answer
 
Comments
abhishekagrwl25 27-May-13 0:28am    
but i dont have to insert value...i have to make columns in table2 by the values inserted in table1

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900