How can we help you today? How can we help you today?

SQL Prompt formatting error

Hello, ever since the most recent update to SQL Prompt, one specific stored proc that I'm working on keeps throwing this error when attempting to run the formatter:

Exception value cannot be null. parameter name: key

Changing the style used does not make a difference, and another recently created stored proc does not trigger this problem. The SP in question can be executed without issues, it's not a syntax error in the query.

By commenting out blocks of code, I was able to narrow down the cause (at least one cause) to a chunk inside a WHERE statement that looks like this:

DROP TABLE IF EXISTS #test;

CREATE TABLE #test
(
    id INT IDENTITY
  , stuffing VARCHAR(10)
);

SELECT  T.id
      , T.stuffing FROM #test AS T
WHERE TRY_CONVERT(VARCHAR(40), T.stuffing  ) IS NULL;
AshlinF
0

Comments

1 comment

  • AshlinF
    Specifically, it seems as if TRY_CONVERT is causing problems with the auto format option where CONVERT does not.
    AshlinF
    0

Add comment

Please sign in to leave a comment.