Forum Replies Created

Viewing 15 posts - 691 through 705 (of 1,439 total)

  • RE: Are the posted questions getting worse?

    Can someone jump in here... seems like a simple problem made really complicated and I'm losing the will to live.

    http://www.sqlservercentral.com/Forums/Topic1234021-1292-1.aspx

  • RE: tsql - xml question

    This won't include the encoding header

    DECLARE @t TABLE( VARCHAR(20), value VARCHAR(20))

    INSERT INTO @t(,value)

    SELECT 'proyect','2901' UNION ALL

    SELECT 'user','usrsession'

    SELECT (

    SELECT AS "@key",

    ...

  • RE: Help with Counts

    Sorry, I still don't get it. Why only one landline value per datakey, surely you need to consider all landline values to count the number of distinct ones.

    Here's a simple...

  • RE: Help with Counts

    <snip>

    I'm not convinced these queries work at all even though they apparently give desired results.

    This one

    select count(distinct landline) as Unique_landlines

    from (select *, row_number() over(partition by datakey order by...

  • RE: Help with Counts

    stephen99999 (1/12/2012)


    I see your point now. In all actuality, your prior code:

    select count(distinct datakey) as Unique_Dataset

    from (select *, row_number() over(partition by datakey order by case when Datakey!='' then 0 else...

  • RE: Help with Counts

    bicky1980 (1/12/2012)


    stephen99999 (1/12/2012)


    in table format, bicky, please post what you are expecting your results to look like. Earlier you stated you wanted to see 9, 6, etc to be returned,...

  • RE: Help with Counts

    Is this what you're after?

    SELECT COUNT(*) AS Total,

    COUNT(DISTINCT datakey) AS Uniquedatakey,

    COUNT(DISTINCT CASE WHEN landline<>'' THEN landline...

  • RE: Grouping

    Something like this?

    WITH CTE AS (

    SELECT [User],GWP,

    ROW_NUMBER() OVER(PARTITION BY [User] ORDER BY GWP DESC) AS rn

    FROM MyTable)

    SELECT [User],GWP

    FROM CTE

    WHERE rn=1;

  • RE: Are the posted questions getting worse?

    Ninja's_RGR'us (1/10/2012)


    Gianluca Sartori (1/10/2012)


    Very annoying. I think the random words are meant to trick search engines.

    I don't know which countermeasures can be taken, if any. I would be extremely upset...

  • RE: Extracting and parsing XML from fields (CRM related)

    Common table expressions (the 'WITH' bit) go at the start of the query.

    WITH TempTable AS (

    SELECT ConstraintBasedGroupId, Constraints

    FROM ConstraintBasedGroupBase

    ),

    ResourceGroupToTeam AS (

    SELECT

    TempTable.ConstraintBasedGroupId,

    SUBSTRING(item,CHARINDEX('{',item)+1,CHARINDEX('}',item)-CHARINDEX('{',item)-1) AS TeamId

    FROM TempTable

    CROSS APPLY

    DelimitedSplit8K(REPLACE(Constraints,'||','|'),'|') split

    )

    SELECT ...

  • RE: T-SQL help

    SELECT t1.Name, t1.PDate, t1.Value, COALESCE(SUM(t2.Value),0) AS Value1

    FROM #tTest t1

    LEFT OUTER JOIN #tTest t2 ON t2.Name=t1.Name

    ...

  • RE: saving XML in sqlserver issue

    Dev (12/20/2011)


    GSquared (12/20/2011)


    I'm assuming you're asking me, but I'm not clear on what you're asking. XML doesn't have columns, it has elements. Is that what you...

  • RE: saving XML in sqlserver issue

    Change

    SELECT *

    FROM OPENXML (@idoc, 'NewDataSet/Sheet1', 1)

    WITH ([Column1] [varchar](50),

    [Column2] [varchar](50) )

    to

    SELECT *

    FROM OPENXML (@idoc, 'NewDataSet/Sheet1', 1)

    WITH ([Column1] [varchar](50) 'Column1',

    [Column2] [varchar](50) 'Column2')

  • RE: Using SP_

    Interesting question, thanks!

  • RE: Xml DML - delete error - Cannot implicitly atomize or apply 'fn:data()'

    inuts (12/13/2011)


    yes, I had already tried that on an untyped xml column but mine is typed here 🙁

    Can you post the schema?

Viewing 15 posts - 691 through 705 (of 1,439 total)