This questions have asked few times before, unfortunately I did not get an answer to my questions.
Well I have two SQL (SQL SERVER 2008) tables, Emp
If you want to create a view from within a SP you need to use dynamic SQL.
Something like this.
create procedure ProcToCreateView
as
exec ('create view MyView as select 1 as Col')
The create view...
code has to be sent as a string parameter to exec
and by the looks of it you already have the code you need for the view so just embed it in between the '
.
I really have no idea why you need that. Perhaps you just need to know how to use a view from a SP
create procedure ProcToUseView
as
select Col
from MyView