Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Delete a SQL VIEW Object

Posted on 2010-09-12
7
Medium Priority
?
322 Views
Last Modified: 2012-05-10
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
Comment
Question by:TAMSCODAN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 33657436
DROP VIEW SUMMARY
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 33657438
Or if all you want to do is modify it then:

ALTER VIEW SUMMARY AS
...
0
 
LVL 3

Author Comment

by:TAMSCODAN
ID: 33657472

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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 13

Expert Comment

by:p_nuts
ID: 33658264
what is the difference between the new and the old view
0
 
LVL 3

Author Comment

by:TAMSCODAN
ID: 33658340
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 33658485
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
 
LVL 9

Accepted Solution

by:
auke_t earned 2000 total points
ID: 33659882
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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how the fundamental information of how to create a table.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question