title: How to create foreign key in Sybase database?
body: <p>I have two tables in my database that should have connection with PK and FK. Here is example of table 1:</p>
  
  <pre><code>RecID(numeric(19,0)) PK CLUSTERED
  Name(varchar(100))
  Description(varchar(5000))
  </code></pre>
  
  <p>then I want to create second table that will reference to table 1. Here is example of the code I have so far:</p>
  
  <pre><code>CREATE TABLE table2(
      RefID bigint,
      Status bit,
      Comments varchar(8000),
      FOREIGN KEY fk1(RefID) REFERENCES table1(RecID)
  )
  </code></pre>
  
  <p>RefID in table 2 should be the Foreign Key and reference to RecID in table 1. When I run the code above in DBeaver for Sybase here is the error message that I'm getting:</p>
  
  <pre><code>SQL Error [102] [37000]: Incorrect syntax near 'fk1'.
  
    Incorrect syntax near 'fk1'.
  </code></pre>
  
  <p>If anyone can tell me where is my code breaking please let me know. I'm not sure if this is related to DBeaver or my syntax is incorrect. </p>