Search code examples
sql-serversql-server-data-tools

What does "::" mean in a SQL context?


What does the "::" syntax mean in SSDT error message SQL71561? For example:

SQL71561: View: [dbo].[V_RPT_MART_SIGNALS] contains an unresolved reference to an object.Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects:
[SSISDB].[CATALOG].[EXECUTIONS].[EXECUTION_ID] or
[SSISDB].[CATALOG].[EXECUTIONS].[TM]::[EXECUTION_ID]

This seems like such a strange syntax to see in in a SQL context, I can't believe I can't find it documented anywhere. (I've found that doing an online search for "::" doesn't work too well!)


Solution

  • In the specific case there

      [SSISDB].[CATALOG].[EXECUTIONS].[TM]::[EXECUTION_ID]
    

    The syntax would be database.schema.table_or_view.column::static_method_on_clr_type

    The double colon is also used in legacy syntax for some functions

     SELECT * FROM ::fn_trace_getinfo(default)
    

    And in the grammar for GRANT, REVOKE, DENY. (Example)

     GRANT INSERT ON SCHEMA :: HumanResources TO guest;