icic. mind teaching me to use stored proc? i only have one query and i need to pass in two args. thanks. just give me the basic syntax.
Main Topics
Browse All Topicsi have a query that joins many tables. it takes 5secs to execute in query analyzer. however, when i open a recordset using that sql string, it times out after a long time of waiting. how come?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
CREATE PROCEDURE dbo.ProcName
@Param1 int,
@Param2 varchar(255)
AS
SELECT *
FROM Table1 AS One
INNER JOIN Table2 AS Two
ON One.column = Two.column
INNER JOIN Table3 AS Three
ON One.column = Three.column
WHERE
Two.column = @Param1 AND
Three.column = @Param2
GO
This is probably not what you query is doing, but you get the idea? If you want to paste your SQL query in here, I'll produce the SP for you.
Your using Query Analyser, so I'm hoping you're also using SQL Server? If you are, then navigate to your Database, and instead of selecting Tables, select Stored Procedures. Ther'll be some in there anyway, but they're system ones. Just right click, and create a new one.
Type something similar to what I have above, and if it's correct, It'll allow it be created.
Once you have an SP, use this SQL inside your ASP Page:
strSQL = "EXECUTE {SP_Name} " & intValue & ", '" & strValue & "'"
And then open your Recordset exactly the same way as before.
Business Accounts
Answer for Membership
by: AlfaNoMorePosted on 2003-05-20 at 01:22:43ID: 8549104
Probably because it gets parsed by SQL first, then executed. If you used a Stored Procedure (easy, don't worry), then these are pre-parsed, so only execute, making them about 5-20 times quicker (depending on complexity)