Skip to content

Delimit/Undelimit Identifiers

Refactor commands for delimiting not delimited identifiers with square brackets and undelimiting all not delimited identifiers in the document or current selection.

The command ensures that all SQL statements have the semicolon statement terminator at the end.

Input sql script:

CREATE TABLE Employee
(
EmployeeID int IDENTITY (1,1) NOT NULL,
FirstName varchar(30),
LastName varchar(30)
)

Result:

CREATE TABLE [Employee]
(
[EmployeeID] int IDENTITY (1,1) NOT NULL,
[FirstName] varchar(30),
[LastName] varchar(30)
)

The command removes delimiters of the identifiers that comply with the rules for the format of regular identifiers.

Input sql script:

SET QUOTED_IDENTIFIER ON
go
CREATE TABLE [Employee]]]
(
[EmployeeID] int IDENTITY (1,1) NOT NULL,
[First Name] varchar(30),
[LastName] varchar(30),
"DeptID" int
)

Result:

SET QUOTED_IDENTIFIER ON
go
CREATE TABLE [Employee]]]
(
EmployeeID int IDENTITY (1,1) NOT NULL,
[First Name] varchar(30),
LastName varchar(30),
"DeptID" int
)

Refactoring