-4

SQL statement from Sublime Text

How it shows after pasting the statement on SSMS

These are the photos of how it shows

The first one is the image of the statement I copied from Sublime Text while the second is the image of what it looks like on the SQL Server Management Studio I noticed that it converts the names into black instead of a color same as user_id and name

Joakim Danielson
  • 43,251
  • 5
  • 22
  • 52
SayMaxil
  • 27
  • 8
  • That is next level in screenshotting code... – GSerg Jun 27 '19 at 16:32
  • 5
    So you pasted MySql code into SQL Server Management Studio, and you are asking why it gives syntax errors and why `user_id` and `user_name` are pink? It gives syntax error because MySql and SQL Server are different products with different dialects of SQL, and the [`user_id`](https://learn.microsoft.com/en-us/sql/t-sql/functions/user-id-transact-sql?view=sql-server-2017) and [`user_name`](https://learn.microsoft.com/en-us/sql/t-sql/functions/user-name-transact-sql?view=sql-server-2017) are pink because that have special meaning in SQL Server. – GSerg Jun 27 '19 at 16:35
  • Yea, you can see clearly... Those are just names... If I have to type theme line after another, they work very fine but when pasted from copying, it shows that way – SayMaxil Jun 27 '19 at 16:38
  • 1
    @GSerg, you should have screenshotted that text as an answer... – jarlh Jun 27 '19 at 16:45
  • Just to reiteratae what @GSerg is saying here. You are taking SQL that is written specifically for `mysql` (An RDBMS built and maintained by Oracle Corporation) and trying to run in SSMS against a SQL Server (An RDBMS built and maintained by Microsoft). This is like trying to speak russian to people in france. You need to translate it into SQL that is compliant with SQL Server. – JNevill Jun 27 '19 at 16:50

1 Answers1

0

First you have to remove IF NOT EXISTS from CREATE TABLE and refer to CREATE TABLE IF NOT EXISTS equivalent in SQL Server for the way to handle it. Second, you need to change AUTO_INCREMENT with IDENTITY(seed, increment): e.g. IDENTITY(1,1).