Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ms-sql/vfp spt question
Message
From
05/11/1998 20:26:30
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Ms-sql/vfp spt question
Miscellaneous
Thread ID:
00155073
Message ID:
00155073
Views:
66
Greetings!
I've got a strange problem with a sql stored procedure [MS-SQL] and passing the parameters to it. There are more notes below - but if you have an idea on this please DO post here and slam a cc: to wsanders@eagleusa.com

TIA!!!!
code starts here
***************************
*[stored procedure code]*
********* store procedure PICKLISTS_FRM_CONFIRMENTRY ***********
if exists (select * from sysobjects where id = object_id('dbo.PickLists_Frm_ConfirmEntry') and sysstat & 0xf = 4)
drop procedure dbo.PickLists_Frm_ConfirmEntry
GO

CREATE PROCEDURE PickLists_Frm_ConfirmEntry
@vchFieldList VARCHAR(255)
AS


DECLARE @SelectString VARCHAR(255)

SELECT @SelectString = 'SELECT ' + @vchFieldList + ' FROM Accounts WHERE cAcctNum LIKE "E%"'

EXEC (@SelectString)
GO
**********end of stored procedure********************************

Mondo questions::::
Is it possible to pass the field list for a SQL SELECT statement as a parameter in a store procedure?

The following command works when run through the SQL(ver 6.50.201) query tool:

exec picklists_frm_confirmentry 'cacctnum,cpartyname,ipartykey'

The following commands do not work when run through Visual FoxPro 6.0

lha = sqlconnect("General","sa","")
CSTRING = "exec picklists_frm_confirmentry 'cacctnum,cpartyname,ipartykey'"
X= sqlexec(lha,CSTRING,"testcursor")
----
X always returns a -1...
your thoughts, as always, will be most appreciated....
regards [Bill]

--
========================================
William Sanders, Programmer/Analyst[VFP/SQL]
TALON Development Team, MIS Department [281-618-3100 X 3516]
EAGLE USA Airfreight, 15350 Vickery Drive, Houston TX 77032
Next
Reply
Map
View

Click here to load this message in the networking platform