2

What is the significance of using Scope Resolution Operator (::) in SQL SERVER. As we all know when we are using GRANT command Scope Resolution Operator will be part of syntax.

GRANT ALTER ON Schema :: DBO TO user_name

Is there any specific meaning for it or it is used just like that.

Pரதீப்
  • 91,748
  • 19
  • 131
  • 172
  • To get technical: that is not a "scope resolution operator". (That [exists](https://msdn.microsoft.com/library/dd206995), but is something different.) Some languages have such a general operator for identifiers, but in T-SQL, the `class::` construct is used simply as that -- to specify the class of object you're operating on. It occurs only in `GRANT`, `DENY` and `ALTER AUTHORIZATION` statements and is not generally applicable. As to why it's necessary, that's another matter. The rules for when objects of different types can share names and when they can't are a bit complex. – Jeroen Mostert Nov 23 '16 at 07:31

1 Answers1

0

refer,

http://sqlblog.com/blogs/kalen_delaney/archive/2006/09/06/186.aspx

it does not have any meaning check below query,

SELECT * FROM ::fn_trace_getinfo(default)

and if you execute without :: it still get executed.

Vikrant More
  • 5,182
  • 23
  • 58
  • 90