Forum Replies Created

Viewing 15 posts - 3,541 through 3,555 (of 8,761 total)

  • RE: Need help in writing query to show data from rows into columns

    Quick suggestion

    😎

    USE TEEST;

    GO

    SET NOCOUNT ON;

    IF OBJECT_ID(N'tempdb..#temp') IS NOT NULL DROP TABLE #temp;

    CREATE TABLE #temp

    (

    STORE_ID INT

    ,PRINTER_NM VARCHAR(50)

    ,PRIORITY_IND INT

    ,PRINTER_ID INT

    )

    INSERT INTO #temp

    values(1000,'PRINT1',1,100)

    ,(1000,'PRINT2',2,101)

    ,(1001,'PRINT1',1,102)

    ,(1002,'PRINT2',2,103)

    ,(1002,'PRINT1',1,104)

    ,(1002,'PRINT2',2,105)

    ,(1003,'PRINT1',1,106)

    ,(1003,'PRINT2',2,107);

    SELECT

    T.STORE_ID

    ,MAX(CASE WHEN T.PRIORITY_IND =...

  • RE: What is SQL Fertilization any links?

    Lowell (6/1/2016)


    I'm now offering certifications in SQL Fertilization. If you act now i'll offer you 50% off my already low price of $99.

    Do you have a BYOD discount? 😛

    😎

  • RE: Inserting XML

    SQL-DBA-01 (6/1/2016)


    Even two single quotes will also work fine.

    INSERT mytest

    VALUES

    (1, CAST('<customer id = ' '1200' '>Acme</customer>' AS XML))

    , (2, CAST(...

  • RE: Split two delimited strings in table

    Elementary when using the DelimitedSplit8K function

    😎

    USE TEEST;

    GO

    DECLARE @testdata TABLE

    (

    IDINT NOT NULL,

    DegreeStr VARCHAR(100),

    YearEarnedStrVARCHAR(100)

    );

    INSERT INTO @testdata

    SELECT 1, 'BS,MS,PhD', '2001,2005,2011' UNION ALL

    SELECT 2, 'BS', '2003' UNION ALL

    SELECT 3, 'BS,MS', '2002,2008'

    SELECT

    ...

  • RE: Inserting XML

    Ed Wagner (6/1/2016)


    Yeah, something was missed in the question itself. I read it several times and didn't see the problem, so I did what I normally do - go...

  • RE: Inserting XML

    No applicable answer listed as the code is perfectly valid (maybe not valid on SQL Server 2000 but cannot be bothered to check).

    😎

  • RE: What is SQL Fertilization any links?

    ChrisM@Work (5/31/2016)


    Google "SQL Fertilization" with the quotes and most of the links appear to relate to a single job advert, something to do with Broadridge. Best guess? A dopey recruiter...

  • RE: Slow BCP Out, only 9000 rows/second

    mark.kremers.prive (5/30/2016)


    Eirikur Eiriksson (5/30/2016)


    Quick question, what value are you passing with the [-a packetsize] parameter? IIRC, if none is passed it will revert to the default 4096k

    😎

    tried 64k, 32k and...

  • RE: T Sql Query

    yb751 (5/30/2016)


    Eirikur Eiriksson (5/30/2016)


    tmmutsetse (5/30/2016)


    The query that i am using looks like the one below.

    SELECT

    Name,

    Memory,

    Model

    FROM [xxxx].[dbo].[Status]

    where

    active =...

  • RE: T Sql Query

    tmmutsetse (5/30/2016)


    The query that i am using looks like the one below.

    SELECT

    Name,

    Memory,

    Model

    FROM [xxxx].[dbo].[Status]

    where

    active = 1 and

    and name...

  • RE: T Sql Query

    tmmutsetse (5/30/2016)


    Thanks Tom,Infact i have more than those names mentioned above.Almost 30 names.

    Try to write down the definition of the logic, otherwise it will be impossible to construct a query...

  • RE: Slow BCP Out, only 9000 rows/second

    Quick question, what value are you passing with the [-a packetsize] parameter? IIRC, if none is passed it will revert to the default 4096k

    😎

  • RE: Query calculation over a partition

    Pre-grouping works quite well in this case, especially if there is a filtered index on the the table for customerID where sales is not null.

    😎

    ;WITH CUSTOMERS_SALE AS

    (

    ...

  • RE: Query calculation over a partition

    TheSQLGuru (5/28/2016)


    Eirikur Eiriksson (5/28/2016)


    santiagoc93 (5/27/2016)


    select customerId, window, product, sales,

    ( Case when count(sales) over(partition by customerid order by customerid) >0 then 1 else 0 end)as class

    from #example

    Very nice!

    😎

    The...

  • RE: Query calculation over a partition

    santiagoc93 (5/27/2016)


    select customerId, window, product, sales,

    ( Case when count(sales) over(partition by customerid order by customerid) >0 then 1 else 0 end)as class

    from #example

    Very nice!

    😎

    The addition of the...

Viewing 15 posts - 3,541 through 3,555 (of 8,761 total)