MySQL to SQL Server - Incorrect syntax near the keyword 'mictest'

Posted by Champi Ardon on Stack Overflow See other posts from Stack Overflow or by Champi Ardon
Published on 2012-04-07T17:19:07Z Indexed on 2012/04/07 17:28 UTC
Read the original article Hit count: 272

Filed under:
|
|
|

First, I tried to migrate my databases with SQL Server Migration Assistant for MySql and it worked fine.

But now, I have some problems with my code.

I had this line on MYSQL version :

$fct="SELECT * FROM `users` WHERE `USER` LIKE CONVERT( _utf8 '$LOGIN' USING latin1 ) COLLATE latin1_swedish_ci AND `PASS` LIKE CONVERT( _utf8 '$PASS'USING latin1 ) COLLATE latin1_swedish_ci";

This line worked fine but when i try to put this on my SQL Version i get :

Error : SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax with the keyword 'mictest'. (which is my $LOGIN)

I though it was a problem with "quotes" so I also tried this but it is not working :

$fct="SELECT * FROM users WHERE USER LIKE CONVERT( _utf8 '$LOGIN' USING latin1 ) COLLATE latin1_swedish_ci AND PASS LIKE CONVERT( _utf8 '$PASS' USING latin1 ) COLLATE latin1_swedish_ci";

© Stack Overflow or respective owner

Related posts about php

Related posts about sql