Forum Replies Created

Viewing 15 posts - 811 through 825 (of 1,439 total)

  • RE: ROW_Number Help

    SELECT dt, DENSE_RANK() OVER(ORDER BY YEAR(dt), MONTH(dt)) rn FROM @tbl

    ORDER BY dt

  • RE: ROW_Number Help

    Try using DENSE_RANK instead of ROW_NUMBER

  • RE: Get the First letter of each word within a string and returned a concatenated string

    For completeness, here's a simple SQLCLR to perform the same task, appears to perform okay.

    using System;

    using System.Data;

    using System.Data.SqlClient;

    using System.Data.SqlTypes;

    using Microsoft.SqlServer.Server;

    using System.Text;

    public partial class UserDefinedFunctions

    {

    [Microsoft.SqlServer.Server.SqlFunction]

    ...

  • RE: Return Max value for each Group set

    Also this

    WITH CTE AS (

    SELECT *,

    MAX(IndivOrderRank) OVER(PARTITION BY Rep, ProductGroup, CustAcc) AS mx

    FROM @results)

    UPDATE CTE

    SET MaxOrderRank=mx;

  • RE: Get Max of a field and also extract date max was created.

    Another solution, this one not requiring a join

    WITH CTE AS (

    SELECT ITEM, REV, DATE,

    ROW_NUMBER() OVER(PARTITION BY ITEM ORDER BY REV DESC) AS rn

    FROM...

  • RE: need help with XML tag

    Haryadi Santoso (5/6/2011)


    Hi Mark,

    As i stated before, i had used ELEMENTS XSINIL, to product XML tag like <kotaDomisili xsi:nil="true" />

    but the system still won't accept it. The system will accept...

  • RE: need help with XML tag

    This seems to work

    declare @master_club table(VCLUBCD varchar(100),VCLUBNM varchar(100), DCLUB datetime,

    VCTYCLB varchar(100),VPICCLB varchar(100),VJNSCLB varchar(100),VTYPCLB varchar(100))

    insert into @master_club

    select '00001','HONDA TIGER MAILING LIST','19781025 00:00:00','3101','BUDI','SPORT','TIGER' union all

    select '00002','SUZUKI CLUB','20021005 00:00:00',null,'ADY','BEBEK','SATRIA'

    declare @output xml;

    set @output...

  • RE: Create XML file using TSQL

    SELECT

    (SELECT LastName AS "LASTNAME",

    FirstName AS "FIRSTNAME"

    FROM #Temp

    FOR XML PATH(''),ROOT('INDIVIDUALS'),TYPE)

    FOR XML PATH('INDIVIDUALS_LIST')

  • RE: How to Ignore the records based on their addition

    Maybe this?

    WITH CTE AS (

    SELECT Id,Type,Amt,

    SUM(CASE WHEN Type IN ('Debit', 'Credit') THEN Amt ELSE 0 END) OVER(PARTITION BY Id) AS sm

    FROM GLTbl)

    SELECT Id,Type,Amt

    FROM...

  • RE: Is it possible to transform the data to xml file with specified format

    WITH Pivotted AS (

    SELECT Bid,

    BranchName,

    WeekRange,

    OfficeHours,

    ...

  • RE: Identifying non-letters and non-integers

    Would a binary collation work?

    SELECT L6

    FROM testdata

    WHERE L6 LIKE '%[^0-9A-Za-z]%' COLLATE Latin1_General_BIN

  • RE: Determine Missing Hours

    WITH Hours([Hour]) AS (

    SELECT 0 UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL

    SELECT 4 UNION ALL SELECT 5 UNION ALL...

  • RE: how to convert xml input to a single table in sp

    DECLARE @x XML

    SET @x='<root>

    <product>

    <product_id ID = "1"/>

    <product_id ID = "2"/>

    <product_id ID = "3"/>

    </product>

    <discount>

    <discount_id ID ="9"/>

    <discount_id ID ="10"/>

    </discount>

    <tax>

    <tax_id ID = "0"/>

    </tax>

    </root>

    ';

    SELECT p.value('@ID','INT') AS Product_ID,

    ...

  • RE: XPath query against a query plan - xmlns giving me problems

    Try this

    WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')

    SELECT t.c.value('@Column', 'varchar(128)') AS 'Parameter', t.c.value('@ParameterCompiledValue', 'varchar(128)') AS 'Value'

    from @x.nodes('/ShowPlanXML/BatchSequence/Batch/Statements/StmtSimple/QueryPlan/ParameterList/ColumnReference') as T(c)

  • RE: Creating Delimited Strings

    opc.three (4/7/2011)


    Brandie Tarvin (4/7/2011)


    Wow. I wonder if they had permissions to reprint that article. I found it yesterday at Simple Talk.

    Or maybe it was the guy at Simple Talk...

Viewing 15 posts - 811 through 825 (of 1,439 total)