Forum Replies Created

Viewing 15 posts - 106 through 120 (of 444 total)

  • RE: Pivoting

    Please what you tried so far?

    Here is my guess you need combine two tables into one first

    with allRatings as (

    select * from [dbo].[InputTest1]

    union all

    select *, null as [FormOrderForInstnRating],null as [SortOrder]

    from...

  • RE: Need help putting data into XML format

    Ok, do it with string manipulation. You may eliminate inner CAST if building entire string this way. But for redability i just use two CASTs.

    if object_id('Tempdb..#Element1') is not null drop...

  • RE: Need help putting data into XML format

    You may wish to add root element to keep output well-formed xml document when Element1 table has more rows . And subgroups naming may be rendered with attribute which...

  • RE: Extracting Data From XML Query

    To optimize a bit further why declare namespace which is never used in the query

    ;WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/shareddatasetdefinition')

    SELECT

    D.field1.value('(SharedDataSet/DataSet/Query/CommandText/text())[1]','VARCHAR(50)') AS CommandText

    FROM #demo D;

  • RE: Extracting Data From XML Query

    You are welcome.

  • RE: Extracting Data From XML Query

    Xquery must contain namespace declaration as it is dealing with namespaced xml.

    select field1.query('declare namespace x="http://schemas.microsoft.com/sqlserver/reporting/2010/01/shareddatasetdefinition";

    /x:SharedDataSet/x:DataSet/x:Query/x:CommandText') from #demo

  • RE: SSDT - Where??

    See http://blogs.msdn.com/b/ssdt/archive/2015/09/01/sql-server-data-tools-preview-update-for-august-2015.aspx

    May be you should wait till post-august2015-preview SSDT RTM is released.

  • RE: Counting Classes

    RonKyle (9/24/2015)


    I have reworded to ask about classes.

    So... how do we get to answer the question again with the revised wording?

    Just don't answer in a hurry, wait a...

  • RE: Debugging CTEs

    I combine -- and /* to make it a bit easier but still have to edit code.

    WITH CTE(x) AS (

    SELECT NULL

    )

    /* possible comment */

    -- /*

    SELECT...

  • RE: Multiple queries in the same stored procedure

    Manic Star (9/22/2015)


    kim / data detection group (9/17/2015)


    []

    There are LOTS of times when I need to use a simple local function within a stored procedure, but have to create and...

  • RE: Problem in sorting by alphanumeric table column of NVARCHAR datatype.

    WayneS (9/24/2015)


    ... PATINDEX('[A-Z,a-z][0-9]%', activityName ...

    CREATE TABLE #Activities(activityName NVARCHAR(100))

    ?

  • RE: Problem in sorting by alphanumeric table column of NVARCHAR datatype.

    If the first word contains digit then sort by first word parts second part considered to be integer. Otherwise sort by hole column

    select activityName

    from #Activities

    cross apply (select

    ...

  • RE: PHP to SQL

    Note 30days.. is not valid column name anyway.

    8000 limit doesn't apply to sp_executesql if only you are not quering linked server, OPENQUERY may be.

  • RE: Need Help in Recursive Query in SQL using CTE

    Probably it's cycle detection problem

    The query below will return all cycles containing 52342-00

    with r as (

    select parentid , DetailComponent , DetailLevel

    , cast( '->' + DetailComponent + '->' ...

  • RE: Dynamic SQL without Dynamic SQL?

    You may unpivote fixed number of columns and select specified col value without dynamic SQL

    declare @t table (

    id int identity

    ,ref01 varchar(10)

    ,ref02 varchar(10)

    ,ref03 varchar(10)

    ,ref04 varchar(10)

    ,ref05 varchar(10)

    ,ref06 varchar(10)

    );

    insert @t values ('a-ref01','a-ref02','a-ref03','a-ref04','a-ref05','a-ref06')

    ...

Viewing 15 posts - 106 through 120 (of 444 total)