How is SQL Prompt helping your team? Share your experience.

Temp table name replacement

SteveC1971SteveC1971 Posts: 3 New member

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

    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,


  • TomWTomW Cambridge Posts: 108 Gold 1

    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?


    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

    Sample of specific code:

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




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

    Best regards,
  • 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.