Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I already have a table (EMP_DETAILS), which is containing EMP_ID (Primary Key), FIRST_NAME, LAST_NAME, AGE, ADDRESS, SALARY, DEPT_ID (Foreign Key). I want to create a view of this table.

I already created a view for the table, but when I created that table I missed one column (FIRST_NAME).

I want to add that column in this existing view with out drop this. I already try to replace this but it had shown some nothing.

Can anybody please help me out from this.

I have another question:
How I join the above table view with the another table view
(DEP_DETAILS){DEPT_ID (Primary Key), DEPT_NAME}

Can you please help me to giving the actual syntax.
Posted
Comments
DamithSL 16-Dec-14 9:58am    
what is your database server? which tool/software you have use for creating view?
DamithSL 16-Dec-14 10:03am    
database is oracle?
DamithSL 16-Dec-14 10:09am    
oracle or sql server!

Use ALTER VIEW with the correct select query you want : http://msdn.microsoft.com/en-us/library/ms173846.aspx[^]

Use the query builder to create the select statement you want with the joins you need then create a view for that select statement.
 
Share this answer
 
Comments
Bittu14 16-Dec-14 10:03am    
I did not get you. About your second answer.
Mehdi Gholam 16-Dec-14 10:07am    
http://www.mssqltips.com/sqlservertip/1086/sql-server-management-studio-query-designer/
Bittu14 16-Dec-14 10:16am    
I can't under stand it. Can you please give me another link to me for better understand.
Mehdi Gholam 16-Dec-14 10:18am    
Use the query designer to join your tables and views and select the data you want.
Bittu14 16-Dec-14 10:58am    
I tried the query

[ ALTER VIEW BISA1.EMPLOYEE_DETAILS_VIEW AS
SELECT EMP_ID, FIRST_NAME, LAST_NAME, AGE, ADDRESS, SALARY, DEPT_ID
FROM EMP_DETAILS;]

but it will give some error.
as per your comment you are working with sql server 2008 with oracle sql developer. there is a better microsoft product called sql server management studio express[^], it is free.
you can right click on view and design it directly
 
Share this answer
 
Comments
Bittu14 17-Dec-14 5:04am    
I know this process. But I want to change it through SQL query.

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