BUG - NewSequentialId() is not supported

MattOGMattOG Posts: 8 New member
Hi,
    Defining a default with newsequentialid() results in SqlPrompt surrounding it with square brackets, causing invalid code.
The desired behaviour is the same as NewID().

Unformatted code:
CREATE TABLE [dbo].test (
IdOne UNIQUEIDENTIFIER NOT NULL DEFAULT NEWID()
,IdTwo UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID()
)

Formatted code:
CREATE TABLE [dbo].[test] (
    [IdOne] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWID()
   ,[IdTwo] UNIQUEIDENTIFIER NOT NULL DEFAULT [NEWSEQUENTIALID]()
)

Thanks

Best Answer

Answers

  • Alex BAlex B Posts: 1,157 Diamond 4
    Hi @MattOG,

    What version of SQL Prompt are you seeing this in?  I've just tried in 9.5.20 and .21 and it doesn't add the square brackets around it for me.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • MattOGMattOG Posts: 8 New member
    The latest release, updated just before posting this. I check it after every update to see if it's fixed.

    I'll share the version and maybe my settings file (?) when I get home and can check. I have the option to surround aliases etc checked too.

    Matt
  • MattOGMattOG Posts: 8 New member
    Ok,
        If you go into SQL Prompt > Options > Special characters
        : Enable "Enclose identifiers within square brackets"

        Also SQL Prompt > Options > Styles
        : Enable "Add/remove square brackets
        : Select "Add brackets to all identifiers"

    The behaviour will then be present.

  • Hi @MattOG,

    I'm still not able to reproduce this.  I've tried in 18.3 and 17.9.1 against different SQL versions and tried toggling other different SQL Prompt options and styles but it's still working correctly for me in 9.5.21.


    Are able to share the Prompt.settings file and the .sqlpromptstylev2 files?  If needed I can reach out to you via a support ticket to retrieve the files.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • MattOGMattOG Posts: 8 New member
    Hey Alex,
        Yes ok I'll go via the support ticket route, although I can't imagine there's anything private in those files, it'll at least get a ticket open to track the issue.

    I'll open one as soon as I've posted this and attach the files there.

    Thanks.
Sign In or Register to comment.