Creating a view on stored procedure

  • hi

    I have to create a view

    for the output of a table and stored procedure1

    it is explained below.

    table name - test1

    stored procedure - sp_test1

    sp_test1 will result in displaying results.

    the number of output columns from the stored procedure matches with the table columns also.

    How to create a view for the above situation?

    Please help

  • You can't create a view with a stored procedure in it.

    You can create a proc that will do what you want, but not a view.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Yep, GSquared is true.

  • in fact you can, it's not a direct way and not recommended for production databases

    try this:

    create view who as

    select * from openrowset('SQLOLEDB','Trusted_connection=yes;Data Source=(local)','exec sp_who') who

    go

    select * from who

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply