Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to update Views in SQL ?

Author  Topic 

Ann_SQL
Starting Member

1 Post

Posted - 2009-01-24 : 02:38:39
i am a beginner in SQL.
I have created a SQL View using the below script

CREATE VIEW view_cat AS
SELECT *
FROM Categories
WHERE CategoryName
in('Seafood')

Then i tried to update the view using the below script.

Create view [view_cat] AS
SELECT *
FROM Categories
WHERE CategoryName
in('Seafood') and [description]='tuna'

But it is not working. i am getting the error
"There is already an object named 'view_cat' in the database."
i also tried using replace view. That is also not working.

Please advise.

Thanks and Regards,




Ann

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2009-01-24 : 03:17:55
try ALTER instead of CREATE


elsasoft.org
Go to Top of Page
   

- Advertisement -