question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

INDEX UNIQUE NONCLUSTERED problem

See original GitHub issue

hey,

this

-- simplified and shorten

IF OBJECT_ID(N'[dbo].[Test]', 'U') IS NULL
BEGIN
    CREATE TABLE [dbo].[Test](
        [Id] int IDENTITY(1,1) NOT NULL,
        [Name] nvarchar(255) NOT NULL,
     CONSTRAINT [PK_GlobalTest] PRIMARY KEY CLUSTERED ([Id] ASC),
     INDEX IX_GlobalNames_Name UNIQUE NONCLUSTERED ([Name]),
    )
END
GO

fails with

tsqllint -c .tsqllintrc test.sql test.sql(8,32): error invalid-syntax : Incorrect syntax near UNIQUE…

config file

{ “rules”: { “conditional-begin-end”: “off”, “cross-database-transaction”: “off”, “data-compression”: “off”, “data-type-length”: “off”, “disallow-cursors”: “off”, “full-text”: “off”, “information-schema”: “off”, “keyword-capitalization”: “off”, “linked-server”: “off”, “multi-table-alias”: “off”, “named-constraint”: “off”, “non-sargable”: “off”, “object-property”: “off”, “print-statement”: “off”, “schema-qualify”: “off”, “select-star”: “off”, “semicolon-termination”: “off”, “set-ansi”: “off”, “set-nocount”: “off”, “set-quoted-identifier”: “off”, “set-transaction-isolation-level”: “off”, “set-variable”: “off”, “upper-lower”: “off”, “unicode-string” : “off” }, “compatability-level”: 150 }

Any idea what is wrong? Thank you

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
dougwilsoncommented, Nov 20, 2019

Because it didn’t exist at the time we choose a package to use (2017). We can absolutely switch and will look into it, but you’re welcome to make a PR if you would like to see the switch in a specific timeline 👍

0reactions
dougwilsoncommented, Nov 20, 2019

Thank you so much!! Bummer that the package switch didn’t fix the original syntax error issue though 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error on a unique non-clustered index - sql
1 Answer 1 ... You're only allowed one of any value in a unique index, include NULL so if you have multiple rows...
Read more >
Designing effective SQL Server non-clustered indexes
In this article, we will see how to design an effective Non-clustered index that will improve the performance of frequently used queries.
Read more >
sql server - When should I use a unique constraint instead ...
CREATE TABLE #T(X INT CONSTRAINT PK PRIMARY KEY NONCLUSTERED);SELECT * FROM #T WITH(INDEX(PK)) WHERE X = 1 . Indexes can be more flexible...
Read more >
Overview of Non-Clustered indexes in SQL Server
We can have multiple non-clustered indexes in a SQL table. Previously, we created a unique non-clustered index on the EmpContactNumber column.
Read more >
SQL SERVER - Unique Nonclustered Index Creation with ...
Here is the short answer: When nonclustered index is created without any option the default option is IGNORE_DUP_KEY = OFF, which means when ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found