[thelist] SQL: Accessing Data in a Stored Procedure

Tab Alleman talleman at autobex.com
Mon Dec 4 16:57:05 CST 2000


Is there anyway to access Recordset data inside a stored procedure.. I'm
trying to write one (my first) stored procedure that will

1. Be passed a String
2. Will look up a table and find the ID# that goes with the String
3. Will Delete the records from another table that Contain that ID#
4. Will Delete the record from the first table that contain that ID#

But I've got the WROX SQL7 book, and it looks like there's no way to refer
to data in the database..I'm trying to effectively  do something like this:

CREATE PROC spSFDelete
	@SFFileName nvarchar(255)
AS
	DECLARE @SFID int
	SELECT @SFID = SELECT ID FROM SF WHERE NAME=@SFFileName
	...
And it blows up right on that last line.  Is there no way to get data from
the database within the stored procedure, or do I have to create a recordset
in my .asp page and run the sproc on the recordset data (which wouldn't save
me enough time to be worthwhile)?





More information about the thelist mailing list