Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Works in MySQL but not SQL Server
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Database:
Visual FoxPro
Divers
Thread ID:
01431281
Message ID:
01431285
Vues:
66
>I am horsing around with SQL code tonight and thought I'd try some "stuff", but this code didn't work in SQL Server 2005, but does in MySQL:
>
>What did I do wrong? Is it the two single quotes in the word "don't"?
>
>Here's the SELECT statement:
>
>
>use AdventureWorks
>insert into dbo.Album
>(name, track, duration)
>values
>('Abbey Road', 'Don''t Let me Down', 249)
>
Well, in general, to see if something like that is the problem, just remove it to see if the problem goes away e.g. try 'Dont Let me Down'

If that is the problem you're seeing, then it's an issue of escaping quotes. From what I've found, adding an extra single quote is an accepted way to escape a quote in SQL Server, so your command should work. OTOH, it seems in MySQL a single quote is escaped by a backslash ("\"), so the command would not work in MySQL.

Did you maybe have your question backwards?
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform