Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using ANSI SQL Statements in VFP
Message
From
15/03/2000 08:20:22
 
 
To
14/03/2000 16:23:39
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00345519
Message ID:
00345745
Views:
23
>>lcSql = "UPDATE nametbl SET name = '" +lcName+ "' WHERE id = 5"
>
>But will SQL Server choke on the single quote in the character string? With Bob "Skip" O'Hara the lcSql would become:UPDATE nametbl SET name = 'Bob "Skip" O'Hara' WHERE id = 5

For SQLServer:

lcSQL = "UPDATE nametbl SET name = '" + STRTRAN(lcName, "'", "''") + "' WHERE id = 5"

This will evaluate to:

lcSQL = "UPDATE nametbl SET name = 'Bob "Skip" O''Hara' WHERE id = 5"

SQL Server will understand that "''" means just a single quote - just like [Turbo] Pascal does! :)
Sylvain Demers
Previous
Reply
Map
View

Click here to load this message in the networking platform