Click or drag to resize

SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space

The topic describes the SA0158 analysis rule.

Message

Deprecated usage of space as separator for table hints. Use a comma instead of space

Description

This rule checks for use of space as separator for table hints.

It is recommended that hints be specified using the WITH keyword and comma separator.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Design Rules

Additional Information
Example Test Script
  1SELECT     au_id
  2FROM       dbo.authors with ( UPDLOCK ,PAGLOCK ) -- Usage of the WITH keyword is recommended  
  3SELECT     au_id
  4FROM       dbo.authors  WITH( UPDLOCK PAGLOCK )
  5
  6
  7SELECT     au_id
  8FROM       dbo.authors ( UPDLOCK  PAGLOCK ) -- Usage of the WITH keyword is recommended  
  9SELECT     au_id
 10FROM       dbo.authors  WITH( UPDLOCK , PAGLOCK )
 11
 12SELECT     au_id
 13FROM       dbo.authors  WITH( 
 14FASTFIRSTROW 
 15FORCESEEK
 16HOLDLOCK 
 17NOLOCK 
 18NOWAIT
 19PAGLOCK 
 20READCOMMITTED 
 21READCOMMITTEDLOCK 
 22READPAST 
 23READUNCOMMITTED 
 24REPEATABLEREAD 
 25ROWLOCK 
 26SERIALIZABLE 
 27TABLOCK 
 28TABLOCKX 
 29UPDLOCK 
 30XLOCK 
 31INDEX ( 123,234 ) 
 32 )
 33SELECT     au_id
 34FROM       dbo.authors  with ( 
 35TABLOCK 
 36TABLOCKX 
 37UPDLOCK 
 38XLOCK 
 39INDEX ( 123,234 ) )
 40
 41
 42
 43--SELECT     au_id
 44--FROM       dbo.authors  WITH( 
 45
 46
 47--KEEPIDENTITY 
 48--KEEPDEFAULTS 
 49--FASTFIRSTROW 
 50--HOLDLOCK 
 51--IGNORE_CONSTRAINTS 
 52--IGNORE_TRIGGERS 
 53--NOWAIT
 54--PAGLOCK 
 55--READCOMMITTED 
 56--READCOMMITTEDLOCK 
 57--READPAST 
 58--REPEATABLEREAD 
 59--ROWLOCK 
 60--SERIALIZABLE  TABLOCK  TABLOCKX 
 61--UPDLOCK 
 62--XLOCK  )
 63
 64SELECT     au_id
 65FROM       dbo.authors  ( UPDLOCK ,PAGLOCK ) -- Usage of the WITH keyword is recommended  
 66SELECT     au_id
 67FROM       dbo.authors  ( UPDLOCK ,PAGLOCK )
 68
 69
 70SELECT     au_id
 71FROM       dbo.authors ( UPDLOCK  PAGLOCK ) -- Usage of the WITH keyword is recommended  
 72SELECT     au_id
 73FROM       dbo.authors ( UPDLOCK  PAGLOCK )
 74go
 75SELECT     au_id
 76FROM       dbo.authors  ( 
 77FORCESEEK
 78HOLDLOCK 
 79FASTFIRSTROW 
 80NOLOCK 
 81NOWAIT
 82PAGLOCK 
 83READCOMMITTED 
 84READCOMMITTEDLOCK 
 85READPAST 
 86READUNCOMMITTED 
 87REPEATABLEREAD 
 88ROWLOCK 
 89SERIALIZABLE 
 90TABLOCK 
 91TABLOCKX 
 92UPDLOCK 
 93XLOCK 
 94INDEX ( 123,234 ) 
 95 )
 96SELECT     au_id
 97FROM       dbo.authors   ( 
 98TABLOCK 
 99TABLOCKX 
100UPDLOCK 
101XLOCK 
102INDEX ( 123,234 ) )
103
104
105
106--SELECT     au_id
107--FROM       dbo.authors  ( 
108
109--KEEPIDENTITY 
110--KEEPDEFAULTS 
111--FASTFIRSTROW 
112--HOLDLOCK 
113--IGNORE_CONSTRAINTS 
114--IGNORE_TRIGGERS 
115--NOWAIT
116--PAGLOCK 
117--READCOMMITTED 
118--READCOMMITTEDLOCK 
119--READPAST 
120--REPEATABLEREAD 
121--ROWLOCK 
122--SERIALIZABLE  TABLOCK  TABLOCKX 
123--UPDLOCK 
124--XLOCK  )

Analysis Results

 MessageLineColumn
1SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.770
2SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.780
3SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.790
4SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.800
5SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.810
6SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.820
7SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.830
8SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.840
9SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.850
10SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.860
...
53SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.7325
54SA0158 : Deprecated usage of space as separator for table hints. Use a comma instead of space.7334
See Also

Other Resources