Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating View in Stored Procedures 1

Status
Not open for further replies.

Phwrd

MIS
Apr 19, 2000
18
0
0
US

Trying to create a view in a stored procedure:

CREATE PROCEDURE [DATE2] AS
create view pdt (pxid,pdate)
as
(select distinct patid,postdt from main
union
select distinct patid,postdt from archives)

This pops an invalid syntax near keyword 'view' error.
Tried insering a 'go' between create proc and create view, pops an invalid syntax error near 'go'.

Am i just lost today or what ? Thanks !
Pat
 
Two things
1) you cannot create a view using CREATE PROCEDURE
2) you cannot pass parameters to a view

-----------
-----------CREATE PROCEDURE [DATE2] AS
create view pdt --------(pxid,pdate)
as
(select distinct patid,postdt from main
union
select distinct patid,postdt from archives)

Hope this helps

Chris Dukes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top