How can i create function/view appling below query and i have tyo pass Formid as int datatype

  • DECLARE @cols AS NVARCHAR(MAX);

    DECLARE @query AS NVARCHAR(MAX);

    select @cols = STUFF((SELECT distinct ',' +

    QUOTENAME(Name)

    FROM property

    FOR XML PATH(''), TYPE

    ).value('.', 'NVARCHAR(MAX)')

    , 1, 1, '');

    SELECT @query =

    'SELECT *

    FROM

    (

    SELECT

    o.object_id,

    p.Name,

    o.value

    FROM propertyObjects AS o

    INNER JOIN property AS p ON o.Property_Id = p.Id

    ) AS t

    PIVOT

    (

    MAX(value)

    FOR Name IN( ' + @cols + ' )' +

    ' ) AS p ; ';

    execute(@query);

    how can i put the above Query in function or View. Kindly help to this issue if any one have idea

  • double post, please reply only to Kindly resolve some error in the below...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply