Is there a SQL Server Management Studio option controlling parameters assignment?

Viewed 97

I am not able to execute a lot of T-SQL statements due to various errors. The statements are basically some CREATE OR ALTER statements of routines. I guess I have turned on/off option of SQL Server Management Studio to force these errors because everything was working OK earlier.

For example the following code:

DECLARE @TEST1 DATETIME2 = SYSDATETIME();
DECLARE @TEST2 BIT;

gives this:

enter image description here

If I execute only one of the lines or the following:

DECLARE @TEST1 DATETIME2 
SET @TEST1 = SYSDATETIME();
DECLARE @TET2 BIT;

everything is OK.

This cannot be due to SQL Server version/setting or hardware, because the query is working fine on other laptop.

I was using SSMS 18.0, then updated to SSMS 18.1 and nothing change.

Has anyone idea what is causing this?

1 Answers

It was caused by this option:

enter image description here

We are not using always encrypted, so I guess I have turned it on with some short-key or other way (damn me). If you enable this, open new query window and paste the code above, you will be able to reproduce the issue.

There might be something with how Parameterization is working with SSMS when this is ON because some of the statements are not support.

Related