Skip to content

Commit 33cd9e0

Browse files
authored
Merge pull request #17049 from icoric/icoric-patch-9
sql colorizer updates - tsql docs / statements pt.4
2 parents 555f370 + ae0288b commit 33cd9e0

38 files changed

Lines changed: 480 additions & 508 deletions

File tree

Lines changed: 94 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,94 @@
1-
---
2-
description: "DROP SCHEMA (Transact-SQL)"
3-
title: "DROP SCHEMA (Transact-SQL) | Microsoft Docs"
4-
ms.custom: ""
5-
ms.date: "05/11/2017"
6-
ms.prod: sql
7-
ms.prod_service: "database-engine, sql-database, sql-data-warehouse, pdw"
8-
ms.reviewer: ""
9-
ms.technology: t-sql
10-
ms.topic: "language-reference"
11-
f1_keywords:
12-
- "DROP SCHEMA"
13-
- "DROP_SCHEMA_TSQL"
14-
dev_langs:
15-
- "TSQL"
16-
helpviewer_keywords:
17-
- "deleting schemas"
18-
- "schemas [SQL Server], removing"
19-
- "DROP SCHEMA statement"
20-
- "dropping schemas"
21-
- "removing schemas"
22-
ms.assetid: 874aa29e-c8ad-41e4-a672-900fdc58f1f6
23-
author: markingmyname
24-
ms.author: maghan
25-
monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current"
26-
---
27-
# DROP SCHEMA (Transact-SQL)
28-
[!INCLUDE [sql-asdb-asdbmi-asa-pdw](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
29-
30-
Removes a schema from the database.
31-
32-
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
33-
34-
## Syntax
35-
36-
```syntaxsql
37-
-- Syntax for SQL Server and Azure SQL Database
38-
39-
DROP SCHEMA [ IF EXISTS ] schema_name
40-
```
41-
42-
```
43-
-- Syntax for Azure Synapse Analytics and Parallel Data Warehouse
44-
45-
DROP SCHEMA schema_name
46-
```
47-
48-
[!INCLUDE[sql-server-tsql-previous-offline-documentation](../../includes/sql-server-tsql-previous-offline-documentation.md)]
49-
50-
## Arguments
51-
*IF EXISTS*
52-
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ( [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [current version](https://go.microsoft.com/fwlink/p/?LinkId=299658)).
53-
54-
Conditionally drops the schema only if it already exists.
55-
56-
*schema_name*
57-
Is the name by which the schema is known within the database.
58-
59-
## Remarks
60-
The schema that is being dropped must not contain any objects. If the schema contains objects, the DROP statement fails.
61-
62-
Information about schemas is visible in the [sys.schemas](../../relational-databases/system-catalog-views/schemas-catalog-views-sys-schemas.md) catalog view.
63-
64-
**Caution** [!INCLUDE[ssCautionUserSchema](../../includes/sscautionuserschema-md.md)]
65-
66-
## Permissions
67-
Requires CONTROL permission on the schema or ALTER ANY SCHEMA permission on the database.
68-
69-
## Examples
70-
The following example starts with a single `CREATE SCHEMA` statement. The statement creates the schema `Sprockets` that is owned by `Krishna` and a table `Sprockets.NineProngs`, and then grants `SELECT` permission to `Anibal` and denies `SELECT` permission to `Hung-Fu`.
71-
72-
```sql
73-
CREATE SCHEMA Sprockets AUTHORIZATION Krishna
74-
CREATE TABLE NineProngs (source INT, cost INT, partnumber INT)
75-
GRANT SELECT TO Anibal
76-
DENY SELECT TO [Hung-Fu];
77-
GO
78-
```
79-
80-
The following statements drop the schema. Note that you must first drop the table that is contained by the schema.
81-
82-
```sql
83-
DROP TABLE Sprockets.NineProngs;
84-
DROP SCHEMA Sprockets;
85-
GO
86-
```
87-
88-
89-
## See Also
90-
[CREATE SCHEMA (Transact-SQL)](../../t-sql/statements/create-schema-transact-sql.md)
91-
[ALTER SCHEMA (Transact-SQL)](../../t-sql/statements/alter-schema-transact-sql.md)
92-
[DROP SCHEMA (Transact-SQL)](../../t-sql/statements/drop-schema-transact-sql.md)
93-
[EVENTDATA (Transact-SQL)](../../t-sql/functions/eventdata-transact-sql.md)
1+
---
2+
description: "DROP SCHEMA (Transact-SQL)"
3+
title: "DROP SCHEMA (Transact-SQL) | Microsoft Docs"
4+
ms.custom: ""
5+
ms.date: "05/11/2017"
6+
ms.prod: sql
7+
ms.prod_service: "database-engine, sql-database, sql-data-warehouse, pdw"
8+
ms.reviewer: ""
9+
ms.technology: t-sql
10+
ms.topic: "language-reference"
11+
f1_keywords:
12+
- "DROP SCHEMA"
13+
- "DROP_SCHEMA_TSQL"
14+
dev_langs:
15+
- "TSQL"
16+
helpviewer_keywords:
17+
- "deleting schemas"
18+
- "schemas [SQL Server], removing"
19+
- "DROP SCHEMA statement"
20+
- "dropping schemas"
21+
- "removing schemas"
22+
ms.assetid: 874aa29e-c8ad-41e4-a672-900fdc58f1f6
23+
author: markingmyname
24+
ms.author: maghan
25+
monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current"
26+
---
27+
# DROP SCHEMA (Transact-SQL)
28+
[!INCLUDE [sql-asdb-asdbmi-asa-pdw](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
29+
30+
Removes a schema from the database.
31+
32+
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
33+
34+
## Syntax
35+
36+
```syntaxsql
37+
-- Syntax for SQL Server and Azure SQL Database
38+
39+
DROP SCHEMA [ IF EXISTS ] schema_name
40+
```
41+
42+
43+
```syntaxsql
44+
-- Syntax for Azure Synapse Analytics and Parallel Data Warehouse
45+
46+
DROP SCHEMA schema_name
47+
```
48+
49+
[!INCLUDE[sql-server-tsql-previous-offline-documentation](../../includes/sql-server-tsql-previous-offline-documentation.md)]
50+
51+
## Arguments
52+
*IF EXISTS*
53+
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ( [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [current version](https://go.microsoft.com/fwlink/p/?LinkId=299658)).
54+
55+
Conditionally drops the schema only if it already exists.
56+
57+
*schema_name*
58+
Is the name by which the schema is known within the database.
59+
60+
## Remarks
61+
The schema that is being dropped must not contain any objects. If the schema contains objects, the DROP statement fails.
62+
63+
Information about schemas is visible in the [sys.schemas](../../relational-databases/system-catalog-views/schemas-catalog-views-sys-schemas.md) catalog view.
64+
65+
**Caution** [!INCLUDE[ssCautionUserSchema](../../includes/sscautionuserschema-md.md)]
66+
67+
## Permissions
68+
Requires CONTROL permission on the schema or ALTER ANY SCHEMA permission on the database.
69+
70+
## Examples
71+
The following example starts with a single `CREATE SCHEMA` statement. The statement creates the schema `Sprockets` that is owned by `Krishna` and a table `Sprockets.NineProngs`, and then grants `SELECT` permission to `Anibal` and denies `SELECT` permission to `Hung-Fu`.
72+
73+
```sql
74+
CREATE SCHEMA Sprockets AUTHORIZATION Krishna
75+
CREATE TABLE NineProngs (source INT, cost INT, partnumber INT)
76+
GRANT SELECT TO Anibal
77+
DENY SELECT TO [Hung-Fu];
78+
GO
79+
```
80+
81+
The following statements drop the schema. Note that you must first drop the table that is contained by the schema.
82+
83+
```sql
84+
DROP TABLE Sprockets.NineProngs;
85+
DROP SCHEMA Sprockets;
86+
GO
87+
```
88+
89+
90+
## See Also
91+
[CREATE SCHEMA (Transact-SQL)](../../t-sql/statements/create-schema-transact-sql.md)
92+
[ALTER SCHEMA (Transact-SQL)](../../t-sql/statements/alter-schema-transact-sql.md)
93+
[DROP SCHEMA (Transact-SQL)](../../t-sql/statements/drop-schema-transact-sql.md)
94+
[EVENTDATA (Transact-SQL)](../../t-sql/functions/eventdata-transact-sql.md)

docs/t-sql/statements/drop-type-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ DROP TYPE [ IF EXISTS ] [ schema_name. ] type_name [ ; ]
6464
## Examples
6565
The following example assumes a type named `ssn` is already created in the current database.
6666

67-
```
67+
```sql
6868
DROP TYPE ssn ;
6969
```
7070

Lines changed: 82 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,82 @@
1-
---
2-
description: "DROP USER (Transact-SQL)"
3-
title: "DROP USER (Transact-SQL) | Microsoft Docs"
4-
ms.custom: ""
5-
ms.date: "05/12/2017"
6-
ms.prod: sql
7-
ms.prod_service: "database-engine, sql-database, sql-data-warehouse, pdw"
8-
ms.reviewer: ""
9-
ms.technology: t-sql
10-
ms.topic: "language-reference"
11-
f1_keywords:
12-
- "DROP_USER_TSQL"
13-
- "DROP USER"
14-
dev_langs:
15-
- "TSQL"
16-
helpviewer_keywords:
17-
- "dropping users"
18-
- "DROP USER statement"
19-
- "deleting users"
20-
- "database user removal [SQL Server]"
21-
- "removing users"
22-
- "users [SQL Server], removing"
23-
ms.assetid: d6e0e21a-7568-4321-b6d6-bcfba183a719
24-
author: VanMSFT
25-
ms.author: vanto
26-
monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current"
27-
---
28-
# DROP USER (Transact-SQL)
29-
[!INCLUDE [sql-asdb-asdbmi-asa-pdw](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
30-
31-
Removes a user from the current database.
32-
33-
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
34-
35-
## Syntax
36-
37-
```
38-
-- Syntax for SQL Server and Azure SQL Database
39-
40-
DROP USER [ IF EXISTS ] user_name
41-
```
42-
43-
```
44-
-- Syntax for Azure Synapse Analytics and Parallel Data Warehouse
45-
46-
DROP USER user_name
47-
```
48-
49-
[!INCLUDE[sql-server-tsql-previous-offline-documentation](../../includes/sql-server-tsql-previous-offline-documentation.md)]
50-
51-
## Arguments
52-
*IF EXISTS*
53-
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ( [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [current version](https://go.microsoft.com/fwlink/p/?LinkId=299658), [!INCLUDE[sssds](../../includes/sssds-md.md)]).
54-
55-
Conditionally drops the user only if it already exists.
56-
57-
*user_name*
58-
Specifies the name by which the user is identified inside this database.
59-
60-
## Remarks
61-
Users that own securables cannot be dropped from the database. Before dropping a database user that owns securables, you must first drop or transfer ownership of those securables.
62-
63-
The guest user cannot be dropped, but guest user can be disabled by revoking its CONNECT permission by executing REVOKE CONNECT FROM GUEST within any database other than master or tempdb.
64-
65-
> [!CAUTION]
66-
> [!INCLUDE[ssCautionUserSchema](../../includes/sscautionuserschema-md.md)]
67-
68-
## Permissions
69-
Requires ALTER ANY USER permission on the database.
70-
71-
## Examples
72-
The following example removes database user `AbolrousHazem` from the `AdventureWorks2012` database.
73-
74-
```
75-
DROP USER AbolrousHazem;
76-
GO
77-
```
78-
79-
## See Also
80-
[CREATE USER (Transact-SQL)](../../t-sql/statements/create-user-transact-sql.md)
81-
[ALTER USER (Transact-SQL)](../../t-sql/statements/alter-user-transact-sql.md)
82-
[EVENTDATA (Transact-SQL)](../../t-sql/functions/eventdata-transact-sql.md)
83-
1+
---
2+
description: "DROP USER (Transact-SQL)"
3+
title: "DROP USER (Transact-SQL) | Microsoft Docs"
4+
ms.custom: ""
5+
ms.date: "05/12/2017"
6+
ms.prod: sql
7+
ms.prod_service: "database-engine, sql-database, sql-data-warehouse, pdw"
8+
ms.reviewer: ""
9+
ms.technology: t-sql
10+
ms.topic: "language-reference"
11+
f1_keywords:
12+
- "DROP_USER_TSQL"
13+
- "DROP USER"
14+
dev_langs:
15+
- "TSQL"
16+
helpviewer_keywords:
17+
- "dropping users"
18+
- "DROP USER statement"
19+
- "deleting users"
20+
- "database user removal [SQL Server]"
21+
- "removing users"
22+
- "users [SQL Server], removing"
23+
ms.assetid: d6e0e21a-7568-4321-b6d6-bcfba183a719
24+
author: VanMSFT
25+
ms.author: vanto
26+
monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current"
27+
---
28+
# DROP USER (Transact-SQL)
29+
[!INCLUDE [sql-asdb-asdbmi-asa-pdw](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
30+
31+
Removes a user from the current database.
32+
33+
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
34+
35+
## Syntax
36+
37+
```syntaxsql
38+
-- Syntax for SQL Server and Azure SQL Database
39+
40+
DROP USER [ IF EXISTS ] user_name
41+
```
42+
43+
```syntaxsql
44+
-- Syntax for Azure Synapse Analytics and Parallel Data Warehouse
45+
46+
DROP USER user_name
47+
48+
[!INCLUDE[sql-server-tsql-previous-offline-documentation](../../includes/sql-server-tsql-previous-offline-documentation.md)]
49+
50+
## Arguments
51+
*IF EXISTS*
52+
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ( [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [current version](https://go.microsoft.com/fwlink/p/?LinkId=299658), [!INCLUDE[sssds](../../includes/sssds-md.md)]).
53+
54+
Conditionally drops the user only if it already exists.
55+
56+
*user_name*
57+
Specifies the name by which the user is identified inside this database.
58+
59+
## Remarks
60+
Users that own securables cannot be dropped from the database. Before dropping a database user that owns securables, you must first drop or transfer ownership of those securables.
61+
62+
The guest user cannot be dropped, but guest user can be disabled by revoking its CONNECT permission by executing REVOKE CONNECT FROM GUEST within any database other than master or tempdb.
63+
64+
> [!CAUTION]
65+
> [!INCLUDE[ssCautionUserSchema](../../includes/sscautionuserschema-md.md)]
66+
67+
## Permissions
68+
Requires ALTER ANY USER permission on the database.
69+
70+
## Examples
71+
The following example removes database user `AbolrousHazem` from the `AdventureWorks2012` database.
72+
73+
```sql
74+
DROP USER AbolrousHazem;
75+
GO
76+
```
77+
78+
## See Also
79+
[CREATE USER (Transact-SQL)](../../t-sql/statements/create-user-transact-sql.md)
80+
[ALTER USER (Transact-SQL)](../../t-sql/statements/alter-user-transact-sql.md)
81+
[EVENTDATA (Transact-SQL)](../../t-sql/functions/eventdata-transact-sql.md)
82+

docs/t-sql/statements/drop-xml-schema-collection-transact-sql.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ Deletes the whole XML schema collection and all of its components.
3333

3434
## Syntax
3535

36-
```
37-
36+
```syntaxsql
3837
DROP XML SCHEMA COLLECTION [ relational_schema. ]sql_identifier
3938
```
4039

@@ -58,7 +57,7 @@ You can't drop an XML schema collection when it's in use. So, the collection bei
5857

5958
- Referenced in a schema-bound function or stored procedure. For example, the following function locks the XML schema collection `MyCollection` because the function specifies `WITH SCHEMABINDING`. If you remove it, there's no lock on the XML SCHEMA COLLECTION.
6059

61-
```
60+
```sql
6261
CREATE FUNCTION dbo.MyFunction()
6362
RETURNS int
6463
WITH SCHEMABINDING
@@ -76,7 +75,7 @@ To drop an XML SCHEMA COLLECTION requires DROP permission on the collection.
7675
## Examples
7776
The following example shows removing an XML schema collection.
7877

79-
```
78+
```sql
8079
DROP XML SCHEMA COLLECTION ManuInstructionsSchemaCollection;
8180
GO
8281
```

0 commit comments

Comments
 (0)