December 23, 2008 at 4:36 am
hello
i want to make a store procedure from aquery,
how should i do that?
December 23, 2008 at 4:46 am
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/
December 23, 2008 at 4:46 am
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
December 23, 2008 at 5:01 am
Thanks alo Gail
but where i should write it?
December 23, 2008 at 5:06 am
nazaninahmady_sh (12/23/2008)
Thanks alo Gailbut 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
December 23, 2008 at 5:14 am
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?
December 23, 2008 at 5:17 am
in SSMS, expand ur database->Programmability->Stored Procedures
You'll find ur SP there.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply