Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

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?
0
TAMSCODAN
Asked:
TAMSCODAN
1 Solution
 
Anthony PerkinsCommented:
DROP VIEW SUMMARY
0
 
Anthony PerkinsCommented:
Or if all you want to do is modify it then:

ALTER VIEW SUMMARY AS
...
0
 
TAMSCODANAuthor Commented:

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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
p_nutsCommented:
what is the difference between the new and the old view
0
 
TAMSCODANAuthor Commented:
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.
0
 
Anthony PerkinsCommented:
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
0
 
auke_tCommented:
The view seems to have the same name as the table. This isn't possible!

CREATE VIEW
vw_SUMMARY
AS
SELECT person_no, assignment_no, start_date
FROM summary
WHERE role = 'Worker'

--and if you want to remove the view again:

drop view vw_summary
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now