0

I have SQL Server script that has scalar variable that can be used in single execution scripts

Just want to ask is there any way I can declare scalar variable like in PostgreSQL.

See sample code below:

DECLARE @samplevar varchar(max)= null
set @samplevar = 'test'
select @samplevar

PS: This is not in function nor stored procedure. This is TSQL execution

Thanks

  • `Just want to ask is there any way i can declare scalar variable like in postgre` - what does this mean? Many of us don't know PostgreSQL so you have to show us. – Dale K Jul 25 '22 at 03:39
  • And if you are wanting an answer for PostgreSQL (which is not clear), you don't need to tag SQL Server in that case. – Dale K Jul 25 '22 at 03:42

0 Answers0