0
 Followers
2
 Likes

Variables declared in ExecutedSQL

Aggregates & Queries
New

Hi guys,

i have a few complexed advanced queries that has a lot of inputs and usually i copy/paste the query executed sql to management studio and tweak it from there.

What do you think if the executed sql includes the variable declaration? The purpose of this is that we don't need find and replace all variables and change it only one time on query header. 

Here's an example:


From:

SyntaxEditor Code Snippet

SELECT 
     [Fields]
FROM 
     [Table]
WHERE 
     [Field] = @InputId


To:

declare @InputId int = 

SELECT
     [Fields]
FROM 
     [Table]
WHERE 
     [Field] = @InputId


Kind regards,

Guilherme Jesus

Created on 5 Dec 2018
Comments (2)

Changed the category to Aggregates & Queries


Do you mean the input into the query or the variable declaration within the query

views
179
Followers
0