Reputation: 1279
In Oracle, I can separate blocks of PL/SQL code with the /
character, and Oracle SQL Developer knows that when I run code with Ctrl+Enter
, it's supposed to run all the code it finds until finding a /
. Is there anything similar for SQL Server Management Studio (or T-SQL)?
Upvotes: 0
Views: 702
Reputation: 95561
As I note in the comment, one method is to highlight the SQL you want to execute, and then press the Execute Button (or F5) and only the SQL you have selected will be run.
This works in other Microsoft based IDEs too, such as Azure Data Studio:
Note, however, that when using such techniques that only variables defined in the highlighted SQL will be accessible. Take, the following statement for example:
DECLARE @MyString nvarchar(50) = N'This is my string';
SELECT @MyString;
SELECT CONCAT(@MyString, N' again');
If you highlight the last row only, you will get an error stating that the variable @MyString
has not be declared:
Upvotes: 1