Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use variables in SQL 'FROM' and 'INTO' clauses
Message
From
06/06/2005 21:25:02
James Chan
Objectmastery Pty Ltd
Hawthorn, Australia
 
 
To
06/06/2005 03:23:51
Jon Neale
Bond International Software
Wootton Bassett, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01020387
Message ID:
01020713
Views:
15
Thanks Jon.

I want to do it in pure SQL, the idea is to have a SProc with input and output tables names as parameters. Your suggestion will work. The only thing I don't like is that I have to construct the SQL as a string. This makes the SQL difficult to read. Does TSQL have something like VFP "textmerge"?

Regards

>Are you talking about with SPT or actually in SQL Server?
>
>This is the knind of thing you would need if doing it directly into SQL.
>
>EXEC ('select IT.* from ' + [MyInputTable] + 'IT order by IT.RefId')
>If you want to put it into a cursor you need to decalre that cursor a tempary table may be better.
>
>Is this pure SQL or VFP/SQL mix?
>
>>In VFP, I can use a variable/parameter in an SQL 'FROM' and clause, e.g.
>>
>>local AliasName, OutputName
>>
>>AliasName = 'MyInputTable'
>>OutputName = 'MyOutputCursor'
>>
>>select IT.* into cursor (OutputName) from (MyInputTable) IT order by IT.RefId
>>
>>
>>Can I do something similar in SQLServer stored procedures? How?
>>
>>Thanks in advance
James Chan
ObjectMastery Pty Ltd
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform