적용 대상:SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
분석 플랫폼 시스템(PDW)
Microsoft Fabric의 SQL 분석 엔드포인트
Microsoft Fabric의 웨어하우스
Microsoft Fabric의 SQL 데이터베이스
사용자가 제공하는 텍스트를 나타냅니다. 서버에서 /**/ 평가되지 않는 텍스트입니다.
Syntax
/*
text_of_comment
*/
Arguments
text_of_comment
주석 텍스트입니다. 한 개 이상의 문자열로 구성됩니다.
Remarks
주석은 별도의 줄 또는 Transact-SQL 문에 삽입될 수 있습니다. 여러 줄로 이루어진 주석은 /*와 */로 표시되어야 합니다. 여러 줄로 이루어진 주석에 주로 사용되는 스타일 규칙은 첫 줄을 /*로 시작하고 후속 줄은 **로 시작하며 */로 끝내는 것입니다.
주석의 길이에는 제한이 없습니다.
주석의 중첩도 가능합니다. /* 문자 패턴이 기존 주석 내에서 발생하면 중첩된 주석의 시작으로 처리되므로 닫는 */ 주석 표시가 필요합니다. 닫는 주석 표시가 없으면 오류가 생성됩니다.
예를 들면 다음 코드는 오류를 생성합니다.
DECLARE @comment AS VARCHAR(20);
GO
/*
SELECT @comment = '/*';
*/
SELECT @@VERSION;
GO
오류를 해결하려면 다음과 같이 변경하세요.
DECLARE @comment AS VARCHAR(20);
GO
/*
SELECT @comment = '/*';
*/ */
SELECT @@VERSION;
GO
Examples
다음 예에서는 코드 섹션에서 수행되는 작업을 설명하기 위해 주석을 사용합니다.
USE AdventureWorks2022;
GO
/*
This section of the code joins the Person table with the Address table,
by using the Employee and BusinessEntityAddress tables in the middle to
get a list of all the employees in the AdventureWorks2022 database
and their contact information.
*/
SELECT p.FirstName, p.LastName, a.AddressLine1, a.AddressLine2, a.City, a.PostalCode
FROM Person.Person AS p
JOIN HumanResources.Employee AS e ON p.BusinessEntityID = e.BusinessEntityID
JOIN Person.BusinessEntityAddress AS ea ON e.BusinessEntityID = ea.BusinessEntityID
JOIN Person.Address AS a ON ea.AddressID = a.AddressID;
GO