Temp table name replacement

SteveC1971SteveC1971 Posts: 3 New member
Hi,

Trialling SQL Prompt and have noticed the following:

When formatting code that includes a SELECT...INTO #Table section, the formatting will replace the #Table with [[databaselimitedname]]]

Any idea why this may be happening?

Many thanks in advance.

Best Answer

  • SteveC1971SteveC1971 Posts: 3 New member
    Hi,

    Thanks again for the help - I've spotted the issue: an alias has made its way to the INTO line; absolutely not allowed of course, why would you?! Removing that solves the problem.

    Apologies for wasting your time.

    Best regards,
    Steve

Answers

  • Hi,

    Sorry to hear you're having issues with SQL Prompt. This issue seems quite unusual - would you be able to give us a bit more information so we can work out what's going on?

    Thanks,

    Tom
    Software Engineer for SQL Prompt
    Redgate Software
  • SteveC1971SteveC1971 Posts: 3 New member
    Hi Tom,

    Thanks for coming back on this.

    I have a series of scripts that I'm working on, and have created a format rule set based on our company's standards. I open one of the files to work on, and select Format SQL (or Ctrl K, Ctrl Y) and the formatting begins. I have the editor open showing the line in question and can watch the process remove the temp table #EligibleItems and replace it with [databaselimitedname] text.

    I am running the following:

    Environment: Azure VM running Windows Server 2016
    SQL MS: SQL Server Management Studio v17.9.1
    SQL Server: MS SQL 2017 Developer Edition 64-bit
    SQL Prompt:Updated this morning to 9.5.12.10845

    Sample of specific code:

    SELECT...
    INTO #EligibleItems EligibleItems <---------------------- This is the line that experiences the issue
    FROM #EligibleItemItds ETSET
    INNER JOIN
    Base.FinalDebit FD WITH (SNAPSHOT)
    ON
    ETSET.TransactionSetId = FD.TransactionSetId

    Screenshots:

    Before:



    After:



    Thanks again Tom - any further info required just let me know.

    Best regards,
    Steve
  • Hi Steve,

    That's indeed very odd. Would you be able to share the format file and the complete script with us?
    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
Sign In or Register to comment.