I would reccomend to avoid that, for the reasons I've listed in my
previous message. Besides, going this way you make your VFP
application aware about the inner workings of your SQL Server database
(in other words, you're messing layers). If you'll ever change the
table structure you'll have to hunt down all those embedded sql's.

On Wed, Nov 23, 2011 at 9:33 PM, Rafael Copquin
<[email protected]> wrote:
> The reason I'm asking is because I am trying to build a general insert
> procedure to just send it the command, like so
>
> create procedure insertdata
> @cCmd varchar(max)
> as
> begin
> execute @cCmd
> end
>
> and call it from VFP
> cCmd = [insert into customers(account,company,province)
> values('1234','John Doe','Saskatchewan')
> cCmd1 = [execute dbo.insertdata ]+[']+ cCmd+[']
> sqlexec(nHandle,cCmd1)
>
> and using the debugging tool suggested by Gianni I found that the SP
> gets confused with the quotes.
> Rafael
>
>
> El 23/11/2011 16:22, Grigore Dolghin escribió:
>> The correct syntax is
>>
>> Create Procedure InsertData
>> @Account,
>> @CompanyName,
>> @Province
>> As
>> Begin
>> Insert Into Customers (Account, CompanyName, Province) Values
>> (@Account, @CompanyName, @Province)
>> End
>>
>> The idea is to use parameters (in both VFP and MSSQL), otherwise
>> sooner or later someone would enter Rock'n'Roll as company name and
>> your query will bomb because of those quotes. True, in VFP one could
>> use double quotes or square brackets as delimiters, but the problem
>> stays. As soon your data contain the character used as delimiter, the
>> query will error.
>>
>> On Wed, Nov 23, 2011 at 9:17 PM, Rafael Copquin
>> <[email protected]>  wrote:
>>> One more question.
>>>
>>> In VFP we can use quotes,double quotes or brackets to surround a literal
>>> value or a string.
>>> In SQL Server is there such thing, or we are forced to use only quotes?
>>>
>>> ie  VFP
>>>
>>>      cCmd = [insert into customers(account,companyname,province)
>>> values('1234',"RAFAEL SOFTWARE",'BUENOS AIRES')]
>>>
>>> is the equivalent TSQL only this?:
>>>      cCmd = 'insert into customers(account,companyname,province)
>>> values('1234','RAFAEL SOFTWARE','BUENOS AIRES')'
>>> BTW, is that the correct syntax?
>>>
>>> Rafael Copquin
>>>
>>>
>>> El 23/11/2011 15:26, Rafael Copquin escribió:
>>>> Thank you both, Gianni and Fred
>>>> Rafael
>>>>
>>>>
>>>> El 23/11/2011 14:49, Rafael Copquin escribió:
>>>>> I would like to follow a stored procedure behaviour line by line, as one
>>>>> can do in VFP with the debugger.
>>>>> I need to know what is the value of the parameters received by the SP
>>>>> as they are passed from VFP via SPT, to determine why the heck the SP is
>>>>> not working
>>>>>
>>>>> What are the commands in TSQL or the way to do it in SQL Server?
>>>>> I mean, is there a menu option to check to start the debugger in SQL
>>>>> Server Express or there is no such thing?
>>>>>
>>>>> TIA
>>>>>
>>>>> Rafael Copquin
>>>>>
>>>>>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CAH=cqdkn7sp_m7r1uqsmh_yuhxqbzdsgev1_bo538hoqqit...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to