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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 View

Author  Topic 

marjune
Starting Member

2 Posts

Posted - 2010-05-28 : 04:30:53
hi, i'm newbie with creating view and i don't know the right syntax for dropping the view if exist then create again!!!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-28 : 04:33:23
USE AdventureWorks ;
GO
IF OBJECT_ID ('hiredate_view', 'V') IS NOT NULL
DROP VIEW hiredate_view ;
GO
CREATE VIEW hiredate_view
AS
SELECT c.FirstName, c.LastName, e.EmployeeID, e.HireDate
FROM HumanResources.Employee e JOIN Person.Contact c on e.ContactID = c.ContactID ;
GO

http://msdn.microsoft.com/de-de/library/ms187956(SQL.90).aspx


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2010-05-28 : 18:19:09
Or, you can alter the view instead of dropping it.
Go to Top of Page
   

- Advertisement -