SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 If Exist issue
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

itmasterw
Yak Posting Veteran

90 Posts

Posted - 02/13/2013 :  09:09:45  Show Profile  Reply with Quote
I am writen something like this:
IF Not EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vMems_URTT_st]'))
Begin
Create view vMems_URTT_st as select * from [Mem_URT_TX] --customize
End
But I am getting a red line under the Create statement say In corect syntax 'Create View'

How can I write this?

Thank you

ITM

James K
Flowing Fount of Yak Knowledge

3719 Posts

Posted - 02/13/2013 :  09:26:02  Show Profile  Reply with Quote
SQL Server drives nuts with you this behavior, doesn't it? You could try this:
IF Not EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vMems_URTT_st]'))
Begin
EXEC('Create view vMems_URTT_st as select * from [Mem_URT_TX] --customize')
End
Go to Top of Page

itmasterw
Yak Posting Veteran

90 Posts

Posted - 02/13/2013 :  09:49:35  Show Profile  Reply with Quote
Thank you
That did it

ITM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000