Skip to content

Commit 4d5fdf2

Browse files
authored
added sql colorizer
1 parent e067ca5 commit 4d5fdf2

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

docs/t-sql/functions/objectpropertyex-transact-sql.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-s
3333

3434
## Syntax
3535

36-
```
36+
```syntaxsql
3737
OBJECTPROPERTYEX ( id , property )
3838
```
3939

@@ -172,7 +172,7 @@ OBJECTPROPERTYEX ( id , property )
172172
## Remarks
173173
The [!INCLUDE[ssDE](../../includes/ssde-md.md)] assumes that *object_id* is in the current database context. A query that references an *object_id* in another database will return NULL or incorrect results. For example, in the following query the current database context is the master database. The [!INCLUDE[ssDE](../../includes/ssde-md.md)] will try to return the property value for the specified *object_id* in that database instead of the database that is specified in the query. The query returns incorrect results because the view `vEmployee` is not in the master database.
174174

175-
```
175+
```sql
176176
USE master;
177177
GO
178178
SELECT OBJECTPROPERTYEX(OBJECT_ID(N'AdventureWorks2012.HumanResources.vEmployee'), 'IsView');
@@ -190,7 +190,7 @@ GO
190190
### A. Finding the base type of an object
191191
The following example creates a SYNONYM `MyEmployeeTable` for the `Employee` table in the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] database and then returns the base type of the SYNONYM.
192192

193-
```
193+
```sql
194194
USE AdventureWorks2012;
195195
GO
196196
CREATE SYNONYM MyEmployeeTable FOR HumanResources.Employee;
@@ -210,34 +210,32 @@ U
210210
### B. Returning a property value
211211
The following example returns the number of UPDATE triggers on the specified table.
212212

213-
```
213+
```sql
214214
USE AdventureWorks2012;
215215
GO
216216
SELECT OBJECTPROPERTYEX(OBJECT_ID(N'HumanResources.Employee'), N'TABLEUPDATETRIGGERCOUNT');
217217
GO
218-
219218
```
220219

221220
### C. Finding tables that have a FOREIGN KEY constraint
222221
The following example uses the `TableHasForeignKey` property to return all the tables that have a FOREIGN KEY constraint.
223222

224-
```
223+
```sql
225224
USE AdventureWorks2012;
226225
GO
227226
SELECT name, object_id, schema_id, type_desc
228227
FROM sys.objects
229228
WHERE OBJECTPROPERTYEX(object_id, N'TableHasForeignKey') = 1
230229
ORDER BY name;
231230
GO
232-
233231
```
234232

235233
## Examples: [!INCLUDE[ssSDWfull](../../includes/sssdwfull-md.md)] and [!INCLUDE[ssPDW](../../includes/sspdw-md.md)]
236234

237235
### D: Finding the base type of an object
238236
The following example returns the base type of `dbo.DimReseller` object.
239237

240-
```
238+
```sql
241239
-- Uses AdventureWorks
242240

243241
SELECT OBJECTPROPERTYEX ( object_id(N'dbo.DimReseller'), N'BaseType')AS BaseType;

0 commit comments

Comments
 (0)