In this case, it should simply be replaced with a semicolon ( ). It indicates the end of a batch of statements. Rather it is an instruction interpreted by some of SQL Server client tools (SSMS, sqlcmd, the now deprecated osql). The GO keyword at the end of your script is specific to the SQL Server platform, although it is not part of the Transact-SQL dialect per se. Therefore, the WITH line of the definition will need to be rewritten as WITH RECURSIVE cte AS MySQL supports recursive CTEs but, unlike SQL Server, it requires that the RECURSIVE keyword be specified when one or more CTEs in the WITH clause are recursive. The CTE in this view's definition is a recursive CTE 2. part of the view name when adjusting the script for MySQL. Therefore, it is likely that you will want to drop the dbo. When an object reference has two parts, it is interpreted as database.object However, MySQL does not support schemas in databases. ), then it is interpreted as schema.object When it only has two parts, like in this case (. Therefore, the full name of an object consists of three parts: In SQL Server, databases contain schemas, and schemas contain objects (tables, views, functions, stored procedures etc.). Or, in this case, you can just omit them altogether, because the name contains only letters and an underscore, which are allowed to be used in names without delimiting. For MySQL, you need to replace them with either double quotes ( ") or backticks ( `). Use of square brackets to delimit names, like in the statement's first line: CREATE VIEW. Therefore, your database server requires an upgrade 1.Īpart from that, there are issues with your CREATE VIEW statement that need to be addressed in order to make it work in MySQL. The syntax error you are getting seems to indicate that you are using an older version. First of all, MySQL has been supporting CTEs since relatively recently, starting from version 8.0 (as has been mentioned by others).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |