A cool feature of SQL is that I can use a SELECT statement and pass
values into an INSERT -- great for moving a few records between tables.
Question, is there a way to use a SELECT to pass values into a stored
procedure?
--
The Texeme Construct http://you-read-it-here-first.com 3 1063
Hi John,
AFAIK, no (unfortunately).
--
Dave Sexton
"John Bailo" <ja*****@texeme.comwrote in message
news:ic******************************@speakeasy.ne t...
>
A cool feature of SQL is that I can use a SELECT statement and pass values
into an INSERT -- great for moving a few records between tables.
Question, is there a way to use a SELECT to pass values into a stored
procedure?
--
The Texeme Construct http://you-read-it-here-first.com
ye,of cource you can do that
sample SP shows as below:
CREATE PROCEDURE ShowAFile
@FileNo nvarchar(50)
as
select c.FileNO,
c.Name,
c.Sex ,
c.Birthday,
e.RaceName,
c.Political,
c.PriQualify,
c.PriGradSchool,
c.PriGradDate,
c.Qualify,
c.GradSchool,
c.GradDate,
b.DutyName ,
f.TitleName,
d.JobName,
a.DeptName,
c.WorkDate,
c.EnterDate,
c.OrgDate间,
c.Origin,
c.Resume
from Departments a,Duties b,Files c,Jobs d,Races e,Titles f
where a.DeptID=c.DeptID and b.DutyID=c.DutyID and d.JobID=c.JobID and
e.RaceID=c.RaceID
and f.TitleID=c.TitleID
and c.FileNo=@FileNo
GO
--------------------------------------------
Not a good SP but can tell that you can pass values into a SELECT SP
John Bailo 寫道:
A cool feature of SQL is that I can use a SELECT statement and pass
values into an INSERT -- great for moving a few records between tables.
Question, is there a way to use a SELECT to pass values into a stored
procedure?
--
The Texeme Construct http://you-read-it-here-first.com
Garfilone wrote:
ye,of cource you can do that
sample SP shows as below:
<snip>
--------------------------------------------
Not a good SP but can tell that you can pass values into a SELECT SP
That's not what he asked. He wants the result set from the Select
statement to be passed INTO the stored procedure. In SQL you can do
this:
INSERT Into tablename SELECT * From whatever
This uses the results of the select as the field values for the insert.
I believe the OP wants to do a similar action using a stored procedure
instead of an insert statement:
Something like this (pseudocode to illustrate point):
EXEC spStoredProcName SELECT * From Whatever
Which is not possible AFAIK.
Chris This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: HD |
last post by:
Is there a way to let an account have execute permission on a stored
procedure but not let that stored procedure run insert , delete, or
update records. Basically only let them run or create stored...
|
by: Bercin Ates via SQLMonster.com |
last post by:
I?m getting an error when I execute a stored procedure which is try to insert a row to a table.
The error is:
Server: Msg 1934, Level 16, State 1, Procedure SRV_SP_IS_EMRI_SATIRI_EKLE, Line 32...
|
by: Robin Lawrie |
last post by:
Hi again, another problem!
I've moved from an Access database to SQL server and am now having trouble
inserting dates and times into seperate fields. I'm using ASP and the code
below to get the...
|
by: Eli |
last post by:
Hi all
We currently have a strange problem with calling a Stored Procedure
(SQL Database) in our C# Project. The only error I get is "System
error" which says a lot :)
Background:
We have...
|
by: Max |
last post by:
I'm looking for best methods in terms of performance and simplicity to do an
INSERT and UPDATE. Using Microsoft's Application Blocks and SQL Server
stored procedures, this is simple:
Insert:...
|
by: Lelle |
last post by:
Hello !
how can i insert text containg code examples from a textbox into a database
using SQL insert statment.
i have no problem to just add text that dont contains code and script
examples...
|
by: taru |
last post by:
Env: DB2 UDB 8.1 on AIX
We are executing a db2 sql stored procedure which is invoked from a
java client. The stored procedure contains few select, insert and
update statements.
Using the DB2...
|
by: satish |
last post by:
hi,
i had a small doubt , i have a table xxx with two columns (a int,b int
) and i have inserted 5 rows my query is to add the two colums using a
stored procedure and the result has to be...
|
by: RB |
last post by:
Hi All,
I'm trying to use more data-adapters/data-sets in a project, because
they are so awesome! Anyhoo, I want to use them with Stored Procedures,
rather than raw SQL text.
The hard part of...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
| |