Version 6.4.0.478 qualify object name issue for user defined

jsreynolds1jsreynolds1 Posts: 96 Silver 2
edited August 15, 2014 12:42PM in SQL Prompt
Version 6.4.0.478 qualify object name issue for user defined table type and table value parameter (TVP).

I applied "qualify object names" to some SQL which contained a user defined table type, and a declared table value parameter.

When I asked it to qualify, it removed the TVP and replaced it with the name of the user defined table type.

The name of our user defined data table is, "HRG_Integers". The name of the parameter is, "@RequiredTypes".

You can see below there the inner join on clause gets messed up.

It went from this:
    DECLARE @RequiredTypes HRG_Integers,
        @IncludedTypeList NVARCHAR(MAX);

    INSERT  INTO @RequiredTypes
            ([Value])
    VALUES  (16);
      
    SELECT  @IncludedTypeList = STUFF(
(SELECT ', ' + [Types].[TypeName]
 FROM   @RequiredTypes
 INNER JOIN [Types]
 ON     [@RequiredTypes].[Value] = [Types].[TypeID]
 ORDER BY [Types].[TypeName]
            FOR                       XML PATH(''),
                                          TYPE).value('.[1]', 'nvarchar(max)'), 1, 1, '');    

to this:
    DECLARE @RequiredTypes HRG_Integers,
        @IncludedTypeList NVARCHAR(MAX);


    INSERT  INTO @RequiredTypes
            ([Value])
    VALUES  (16);

    SELECT  @IncludedTypeList = STUFF(
(SELECT ', ' + [Types].[TypeName]
 FROM   @RequiredTypes
 INNER JOIN [Types]
 ON     [HRG_Integers].[Value] = [Types].[TypeID]
 ORDER BY [Types].[TypeName]
            FOR                       XML PATH(''),
                                          TYPE).value('.[1]', 'nvarchar(max)'), 1, 1, '');    

Comments

Sign In or Register to comment.