Linq to sql monodevelop - linq-to-sql

I am trying to use linq to sql in monodeveolop when i try to retrieve anything from the table i get that error
check the manual that corresponds to your MySQL server version for the right syntax to use near '[id], [name]
FROM [test]' at line 1
so any help please

Turns out that the problem was with mysql so i changed my database to sqlite and everything is okay now. but still don't know why it doesn't work with mysql.

Related

How to auto generate UUID/GUID with Fluent Migrator in MySQL?

I'm trying to set a default value NewGuid() to a UUID/GUID column in MySQL 5.7 (with FluentMigrator in .Net Core).
Create.Table("table")
.WithColumn("auto_guid").AsGuid().NotNullable().WithDefaultValue(SystemMethods.NewGuid)
Based on Fluent Migrator documentation NewGuid should be supported but I get an error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ..."
I searched for any similiar issues and solutions but couldn't find any.
Is auto generating UUID/GUID in MySQL even possible with Fluent Migrator?
You are using the wrong method. Use .WithDefault(SystemMethods.NewGuid) instead of .WithDefaultValue().

Conversion of any format of date in mysql 8.0

I am trying to insert values into a table:
INSERT INTO EMP VALUES (7876,'ADAMS','CLERK',7788,convert(datetime,'13-JUL-2019',101),1100,NULL,20);
But I receive the error below:
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ''13-JUL-2019',101),1100,NULL,20)' at line 1.
Tried different syntaxes, however I couldn't solve this.
Please some one help.
Thank you.
The convert(datetime,'13-JUL-2019',101) syntax is for MS SQL Server / Sybase.
Instead, use STR_TO_DATE.

Issue with MySQL and phpAdmin

I am using MySQL 5.1.5 on a Yahoo Sight Server, with phpMyAdmin as the databse interface.
I use the following Query
UPDATE table_family SET last_name='Smith' WHERE id=1;
Then I get the following error:
Error There seems to be an error in your SQL query. The MySQL server
error output below, if there is any, may also help you in diagnosing
the problem
ERROR: Unknown Punctuation String # 34 STR: =\ SQL: UPDATE
table_family SET last_name=\'Smith\' WHERE id=1;
SQL query:
UPDATE table_family SET last_name=\'Smith\' WHERE id=1;
MySQL said: Documentation
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near '\'Smith\' WHERE id=1' at line 1
Ideas? I feel like its an issue with the database, not with my code. the last_name field is a varchar(50). I actually opened a ticket with support on this issue, but it happened to me on two different domains I have with Yahoo, so that makes me think there is more than I know is going on. I have done this with integer fields that don't require the (') single quote and have had no issues. I have also run my syntax through a local access database I created just to make sure it wan't a syntax issue. Worked perfectly first time. Then I had 2 database guys I know look at it. They think its good too. So now I am lost.
Thanks for any help you can provide.
Andy

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version

I am using Sybase Power Designer to create a database from a physical data model (Sybase creates an SQL file) . When i import the SQL file with phpMyAdmin I have the following error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'if exists(select 1 from sys.sysforeignkey where role='FK_ARTWORK_CREATES_ARTIST'' at line 7 .
Any ideas? Could this error appear due to errors on the physical model or there is another problem?
This is the code :
if exists(select 1 from sys.sysforeignkey where role='FK_ARTWORK_HAS_BUY') then
alter table artwork
delete foreign key FK_ARTWORK_HAS_BUY
end if;
The error you are getting is from MySQL. Regardless of the tool used to generate SQL, the database seems to be MySQL (or something is terribly wrong with your systems if they are confused and think they are MySQL).
The MySQL if statement (documented here) has to be inside a stored program. That means that this code only compiles inside a stored procedure, user defined function, or trigger. It doesn't "just work" on its own.
In addition, MySQL doesn't have sys tables. It uses information_schema tables. My strongest suggestion is to use tools appropriate for your actual database. If you are using a tool to generate Sybase, then use Sybase as the destination database. If you are using MySQL, then use a tool to generate MySQL code. Or, better yet, learn how to write the commands yourself.
Finally, if you intend to use Sybase, then connect to the correct database and your problem should be fixed.
As I can't post here, and sqlfiddle.com temporary unavailable, I decided to post code with correct syntax for Sybase on the PasteBin

Somewhere to write and check SQL

Is there somewhere you can input SQL to check syntax etc. because using it in Java just yields a really unhelpful error when trying to run the code: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near..."?
http://www.sqlfiddle.com/
Seems like what you are after.
You can setup table structure in the left part of the window (CREATEs and INSERTs).
And try your desired SELECTS on the right
UPDATE: Though I might add to this that the error you are receiving is in fact an MySQL error you will encounter there as well, but fiddling around can be more handy in a separate tool.
Are you looking for Show Warning and Show Error
You can check here as well
You can check it in your phpmyadmin where you can just write and run the queries and see if it returns errors and/ or results.
You can also check your syntax at http://www.piliapp.com/mysql-syntax-check/
You can test your queries and also test if they return desired results at "http://www.martystepp.com/query/?username=cse154&password=cse154" this site provides test databases that are already built so you not only get the syntax right but it provides against logic errors.