0
CREATE TABLE identity (
    empid VARCHAR(255) PRIMARY KEY,
    entry VARCHAR(255)
);

-- Table: vectors
CREATE TABLE vectors (
    f_id   INTEGER PRIMARY KEY IDENTITY(1,1),
    label  STRING  NOT NULL,
    empid  STRING  REFERENCES identity (empid) 
                   NOT NULL,
    vector BLOB    NOT NULL
);

I tried to run the above query but it gives me error

Incorrect syntax near expected '.', ID or QUOTED_ID.

I don't understand why it is giving me this error, is it because IDENTITY is a keyword in SQL Server. Kindly help!

1
  • This is all information which is available in the official documentation, which you should consult before posted here. Commented Nov 16, 2022 at 8:00

1 Answer 1

2

Try this:

CREATE TABLE [identity] (
    empid VARCHAR(255) PRIMARY KEY,
    entry VARCHAR(255)
);


-- Table: vectors
CREATE TABLE vectors (
    f_id   INTEGER PRIMARY KEY IDENTITY(1,1),
    label  VARCHAR(255)  NOT NULL,
    empid  VARCHAR(255)  REFERENCES [identity] (empid) 
                   NOT NULL,
    vector VARCHAR(255)    NOT NULL
);

Also, if you are working with SQL Server Management Studio, you can see that some words are colored in blue. It will be better to avoid them using in your code as names of tables, variables and other objects. For example, identity is such word.

Sign up to request clarification or add additional context in comments.

2 Comments

alright thanks a lot! also would you happen to know a way to migrate data from sqllite to sql server?
There are various ways to import data in SQL Server. For example - learn.microsoft.com/en-us/sql/tools/… or hevodata.com/learn/sqlite-to-sql-server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.