Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing parameters from VFP to Stored Procedures
Message
From
10/09/2001 09:52:43
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00554615
Message ID:
00554630
Views:
14
Hi!

For SQL Server 7.0, in the stored procedure you can do following:

declare @SQL1 as varchar(8000), @SQL2 as varchar(8000), @SQL3 as varchar(8000), @SQL4 as varchar(8000)
select @SQL1 = "SELECT " + @paramFieldsList
select @SQL2 = " FROM " + @paramFileList
select @SQL3 = " WHERE " + @paramJoinANDFilters
select @SQL4 = " GROUP BY " + @paramGroup

EXECUTE (@SQL1+@SQL2+@SQL3+@SQL4)


In the VFP you can run SQL Server Select command built in the string using SQLEXEC() command:

cSQL = "SELECT " + ....
nResult = SQLEXEC(CursorGetProp("ConnectHandle","SomeMyViewAlias"),cSQL,"ResultAliasName")

HTH.

>Question...
>
>Many of our current VFP queries utilize macro-expansion heavily....we have many instances of...
>
>SELECT &cFldList FROM &cFileList WHERE &cJoin GROUP BY &cGroup
>
>We'd like to convert some of these to Stored Procs in SQL Server, and then use SQLEXEC from VFP to call them. However, I haven't been able to figure out the syntax in T-SQL. I'm interested in all the parameters (field list, file list, join clause, and group by), but specifically the group by...basically, having it be variable at runtime.
>
>Can this be done?
>
>Thanks,
>Kevin
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform