?
Solved

Select result from stored procedures in MS SQL

Posted on 1998-05-22
3
Medium Priority
?
178 Views
Last Modified: 2010-04-06
Hi!
I've read that I can use stored procedures to speed up my
application. I made stored procedure like this:

create procedure MySelectProc @aDog int as
select * from Dogs where HeadID=@aDog
go

I placed TStoredProc on my TDataModule, set up properties, loaded all fields in the fields editor. When I do

MyExec..ParamByName('aDog').AsInteger := aDog;
MyExec.Open;

I don't recieve any set. MyExec is empty. ISQL/W gives to me result what I want

exec MySelectProc @aDog=10

Why I can't get my stored procedure result set.

(Delphi 3.0, MS SQL 6.5)
0
Comment
Question by:hansmtbank
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Expert Comment

by:ronit051397
ID: 1347459
As far as I know, in Stored procedures you have to create a temporary table and put the results in there.
0
 

Author Comment

by:hansmtbank
ID: 1347460
How do I do this?
Is this only one way to get results? It may be slow, and I can use  TQuery in my application.

TStoredProc + temporary table are slower than TQuery?
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 100 total points
ID: 1347461
1. For SQL Servers use only TStoredProc and TQuery not TTable, recommanded by me    and Borland.
2. TQuery is faster and more reliable then TTable when it deals with SQL Servers and             large tables.
3. Use TQueries when you are doing simple and light 'Selectes'.
4. Use Stored procedures for heavy actions such as reports.
    After you genereted a result set in the stored procedure, do the following:
    - Create a table, SQL command: CREATE TABLE "SomeName"....
    - Fill that table with the results.
    - Put a TQuery and write in the sql:select * from "SomeName"...
    - If you want it to be temporary, then at some stage call the SQL command:
      DROP TABLE "SomeName"....
Don't write a Stored Procedure when you need to do a simple select, use TQuery instead. Use Stored procedures only when you need to write complex SQL programs.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question