make store procedure

  • hello

    i want to make a store procedure from aquery,

    how should i do that?

  • I'm not sure that I understand what you want. If you want to run a select query and use a stored procedure in the from clause, then you can't do that. Instead you can have a user defined function that returns table, and base the select statement on that function. If you meant something else pleas explain it, so it will be easier to help you.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • CREATE PROCEDURE < Procedure Name >

    AS

    < Put query here >

    Look up CREATE PROCEDURE in Books Online.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks alo Gail

    but where i should write it?

  • nazaninahmady_sh (12/23/2008)


    Thanks alo Gail

    but where i should write it?

    In a New Query box in SSMS... So in the same place as where you have the query. So in SSMS, open a new query box with CTRL-N, copy the described code in it, execute the code and you're done.

    Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2

  • Thank you

    i created it, but where is it saved? i mean from where i can see and modify this Store Procedure again it future?

  • in SSMS, expand ur database->Programmability->Stored Procedures

    You'll find ur SP there.



    Pradeep Singh

Viewing 7 posts - 1 through 6 (of 6 total)

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