dbTalk Databases Forums  

Incorrect syntax near the keyword 'open'.

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Incorrect syntax near the keyword 'open'. in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rogers
 
Posts: n/a

Default Incorrect syntax near the keyword 'open'. - 08-10-2007 , 01:31 PM






ALTER VIEW [dbo].[VW_OutBreak]

AS

open symmetric key CIS_Symmetric_Key decryption by certificate CISCertificate;

SELECT

cast(DecryptByKey(OB_PersonCompleting)AS varchar(100)) AS PersonCompleting,

cast(DecryptByKey(OB_PersonTitle) AS varchar(100)) AS PersonTitle,

cast(DecryptByKey(OB_Phone) AS varchar(100)) AS Phone,

FROM BreakOut

GOT ERROR:
Msg 156, Level 15, State 1, Procedure VW_OutBreak, Line 4
Incorrect syntax near the keyword 'open'.

Any idea how can I resolve

Thanks


Reply With Quote
  #2  
Old   
Tibor Karaszi
 
Posts: n/a

Default Re: Incorrect syntax near the keyword 'open'. - 08-11-2007 , 03:11 AM






You can't have code in a view. A view is limited to a SELECT statement, nothing else. Consider a
stored procedure or a multi-statement table-valued user defined function.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi


"Rogers" <naissani (AT) hotmail (DOT) com> wrote

ALTER VIEW [dbo].[VW_OutBreak]

AS

open symmetric key CIS_Symmetric_Key decryption by certificate CISCertificate;

SELECT

cast(DecryptByKey(OB_PersonCompleting)AS varchar(100)) AS PersonCompleting,

cast(DecryptByKey(OB_PersonTitle) AS varchar(100)) AS PersonTitle,

cast(DecryptByKey(OB_Phone) AS varchar(100)) AS Phone,

FROM BreakOut

GOT ERROR:
Msg 156, Level 15, State 1, Procedure VW_OutBreak, Line 4
Incorrect syntax near the keyword 'open'.

Any idea how can I resolve

Thanks


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.