-
Introduction
Section titled “Introduction”The topic describes the EX0001 analysis rule.
EX0001: Identify objects used in the script.
Section titled “EX0001: Identify objects used in the script.”Message
Section titled “Message”Identify objects used in the script.
Description
Section titled “Description”The rule outputs description for the identifiers found in the analyzed T-SQL code.
The rule has a Batch scope and is applied only on the SQL script.
Parameters
Section titled “Parameters”| Name | Description | Default Value |
|---|---|---|
| IgnoreObjectsList | Comma separated list of database object names that to ignore during the identifier lookup. | |
| IgnoreUnidentified | Ignore not resolved identifiers. | yes |
Categories
Section titled “Categories”Explicit Rules
Additional Information
Section titled “Additional Information”There is no additional info for this rule.
Example Test Script
Section titled “Example Test Script”INSERT [dbo].[DatabaseLog]([PostTime],[DatabaseUser],[Event],[Schema],[Object],[TSQL],[XmlEvent])VALUES(GETDATE(),CONVERT(sysname, CURRENT_USER),'@eventType',CONVERT(sysname, '@schema'),CONVERT(sysname, '@object'),'<xsl/>','aaa');
UPDATE Production.ProductSET ListPrice -= ListPrice * 2;
UPDATE ProductSET ListPrice -= ListPrice * 2;
SELECT *FROM Table1 aLEFT JOIN Table2ON bbb.iad+1=1 AND b+1=1
SELECT *FROM Table1WHERE SUBSTRING( firstname , 1 , 1)='m'
SELECT *FROM Table1WHERE firstname LIKE 'm%'
SELECT member_number , first_name , last_nameFROM membersWHERE DATEDIFF( yy , datofbirth , GETDATE())>21
SELECT member_number , first_name , last_nameFROM membersWHERE dateofbirth<DATEADD( yy , -21 , GETDATE())Analysis Results
Section titled “Analysis Results”| Message | Line | Column | |
|---|---|---|---|
| 1 | EX0001 : Identifier [PostTime] is a datetime column of [dbo].[DatabaseLog]. | 3 | 0 |
| 2 | EX0001 : Identifier [DatabaseUser] is a sysname column of [dbo].[DatabaseLog]. | 4 | 0 |
| 3 | EX0001 : Identifier [Event] is a sysname column of [dbo].[DatabaseLog]. | 5 | 0 |
| 4 | EX0001 : Identifier [Schema] is a sysname column of [dbo].[DatabaseLog]. | 6 | 0 |
| 5 | EX0001 : Identifier [Object] is a sysname column of [dbo].[DatabaseLog]. | 7 | 0 |
| 6 | EX0001 : Identifier [TSQL] is a nvarchar column of [dbo].[DatabaseLog]. | 8 | 0 |
| 7 | EX0001 : Identifier [XmlEvent] is a xml column of [dbo].[DatabaseLog]. | 9 | 0 |
| 8 | EX0001 : Identifier getdate is a system function. | 13 | 0 |
| 9 | EX0001 : Identifier [ListPrice] is a money column of [Production].[Product]. | 24 | 4 |
| 10 | EX0001 : Identifier [ListPrice] is a money column of [Production].[Product]. | 24 | 17 |
| … | |||
| 17 | EX0001 : Identifier dateadd is a system function. | 73 | 24 |
| 18 | EX0001 : Identifier getdate is a system function. | 75 | 34 |