Tuesday, 19 November 2013

The restrictions imposed by the CONSTRAINED flag in the STRTOSET function were violated

Constrained flag in STRTOSET function required that you pass qualified Or Unqualified member names only.

That means, query in example 1 will fail because here members are not explicitly specified.
whereas same query works fine without CONSTRAINED flag (Example 2).

Example 1

SELECT StrToSet ('[Geography].[State-Province].Members', CONSTRAINED)
ON 0
FROM [Adventure Works]






Example 2:

SELECT StrToSet ('[Geography].[State-Province].Members')
ON 0
FROM [Adventure Works]



Example 3: (Qualified Name)

SELECT StrToSet (
        '{[Geography].[Geography].[Country].[Germany]
        ,[Geography].[Geography].[Country].[Canada]}'
        , CONSTRAINED)
ON 0
FROM [Adventure Works]








Example 4: (Unqualified Name)

SELECT StrToSet (
        '{[Germany]
        ,[Canada]}', CONSTRAINED)
ON 0
FROM [Adventure Works]



No comments:

Post a Comment