Link to home
Start Free TrialLog in
Avatar of TAMSCODAN
TAMSCODANFlag for United States of America

asked on

Delete a SQL VIEW Object

How do i Delete a SQL View object once I create the view.

Once I run this query and it creates the view:

USE DATBS_A
GO
CREATE VIEW SUMMARY AS
SELECT person_no, assignment_no, start_date
FROM summary
WHERE role = 'Worker'

How can i remove the view so I can execute the same statement?
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

DROP VIEW SUMMARY
Or if all you want to do is modify it then:

ALTER VIEW SUMMARY AS
...
Avatar of TAMSCODAN

ASKER


USE DATBS_A
GO
DROP VIEW SUMMARY
GO
CREATE VIEW SUMMARY AS
SELECT person_no, assignment_no, start_date
FROM summary
WHERE role = 'Worker'


When i do this now it looks like the query is running ok, however I am not getting any results, wne I run the view over
what is the difference between the new and the old view
Basically that was one of my requirements to ensure it checks to see if there is an old and update it with the new. I got most of it done but dont seem to figure out why my data is not appearing. It doesnt appear at all, but only when i run hte SELECT statement by itself. if i run the entire thing, Query was done succesfully however i dont see the results.
There seems to be some confusion here:
CREATE VIEW: Creates the view it does not execute it.  In order to execute it you need to do something like this:
SELECT person_no, assignment_no, start_date
FROM SUMMARY
ASKER CERTIFIED SOLUTION
Avatar of auke_t
auke_t
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial