Re: Incorrect syntax near the keyword 'open'.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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@xxxxxxxxxxx> wrote in message news:Of11ty32HHA.5796@xxxxxxxxxxxxxxxxxxxxxxx
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

.