This post is just a suggestion for a new feature.
DarkoMartinovic
Posts: 1 New member
in SQL Prompt
Converting T-SQL into its dynamic equivalence and vice versa.
It would be nice to click on context menu and transform T-SQL statement into its dynamic equivalent.
For example the following T-SQL statement
DECLARE @BusinessEntityID tinyint = 101
SELECT BusinessEntityID, NationalIDNumber, JobTitle, LoginID FROM AdventureWorks2012.HumanResources.Employee WHERE BusinessEntityID = @BusinessEntityID
becomes
The opposite case is also extremely very useful!
It would be nice to click on context menu and transform T-SQL statement into its dynamic equivalent.
For example the following T-SQL statement
DECLARE @BusinessEntityID tinyint = 101
SELECT BusinessEntityID, NationalIDNumber, JobTitle, LoginID FROM AdventureWorks2012.HumanResources.Employee WHERE BusinessEntityID = @BusinessEntityID
becomes
DECLARE @IntVariable INT;
DECLARE @SQLString NVARCHAR(500);
DECLARE @ParmDefinition NVARCHAR(500);
SET @SQLString =
N'SELECT BusinessEntityID, NationalIDNumber, JobTitle, LoginID
FROM AdventureWorks2012.HumanResources.Employee
WHERE BusinessEntityID = @BusinessEntityID';
SET @ParmDefinition = N'@BusinessEntityID tinyint';
SET @IntVariable = 101
EXECUTE sp_executesql @SQLString, @ParmDefinition, @BusinessEntityID = @IntVariable;
SET @IntVariable = 101
EXECUTE sp_executesql @SQLString, @ParmDefinition, @BusinessEntityID = @IntVariable;
I hope you understood my suggestion.
Best regards!
Tagged:
Answers