TSQL To Maria DB SQL
Please assist, converting this to Maria DB SQL?
CREATE TABLE Order_Detail ( uid bigint NULL), order_uid bigint NULL, product_uid bigint NULL, label varchar(150) NULL, selling_unit varchar(80) NULL, price varchar(10) NULL, quantity varchar(10) NULL, amended_quantity varchar(10) NULL, adjusted_quantity varchar(30) NULL, margin varchar(30) NULL, out_of_stock varchar(1) NULL, comments varchar(250) NULL, edi_cost_price varchar(50) NULL, edi_rsp varchar(50) NULL, edi_promo_price varchar(50) NULL, picked varchar(1) NULL, oos_qty int NULL ) ON PRIMARY GO
Answer Answered by Ian Gilfillan in this comment.
Your formatting of the code in the question was certainly hard to read, but I've fixed that for you :) FYI, you can preview the comment, and use the "editing help" link visible when you are typing. In this case, wrapping <<code>>
or <<sql>>
tags around your sample code makes it much more readable.
As to the question, the way you've pasted it is definitely broken - you have two CREATE TABLE statements inside of each other. Presumably a copy and paste error. But even if you take the inner query there are errors. When you enter this in the MariaDB client you'll see an error, and this helps you find where the problem is. The first error would be:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''Order'(...
This was answered in your previous question - the statement is again not correctly escaping the identifier - single quotes are not acceptable.
Your next error would be:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'max) NULL...
That points you to the next error - look for where the string max
etc. occurs in your query, and try see what could be wrong. In this case you have declared VARCHAR(max) which is not valid - it needs to be a number. Go through your statements in this way trying to identify your errors. If you are still unsure, use the Knowledge Base search to look up, for example, VARCHAR to get further help.