Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Syntax for inserting rows into SQL Server?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00850927
Message ID:
00850931
Views:
22
Hi Harry,

m.realkey, m.kcurrent, ecc., make no sense to the remote source because they are VFP variables and the remote source doesn't know their values.
You should preface the variable name with a "?" so VFP will substitute the value "before" send the command:

=SQLEXEC(gnhandle,"insert into vizkeys (realkey,kcurrent,date_used,kprevious,knext,date_up,crypt_key,mess_hash,ownerkey) values (?m.realkey,?m.kcurrent,?m.date_used,'','',?m.date_up,'','',?m.ownerkey)",'real')

Franco


>I've just tried
>
>SQLEXEC(gnhandle,"insert into vizkeys (realkey,kcurrent,date_used,kprevious,knext,date_up,crypt_key,mess_hash,ownerkey) values (m.realkey,m.kcurrent,m.date_used,'','',m.date_up,'','',m.ownerkey)",'real')
>
>and got this error message:
>
>"The name 'realkey' is not permitted in this context. Only constants, expressions,or variables allowed here. Column names are not permitted."
>
>which makes no sense to me whatever, as Column names would seem to be an obvious requirement when we're inserting records!!
>
>and while we're on the subject, even if I can straighten out that syntax, reading around the various guides to SQL, individual inserts looks like it would be an inefficient way to add, for example, 10000 records to a table with several million. Anyone know where to find a step by step guide to that kind of insertion?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform