Forum Replies Created

Viewing 15 posts - 2,086 through 2,100 (of 4,087 total)

  • RE: A Fun Distraction

    jasona.work (12/19/2016)


    Phil Parkin (12/19/2016)


    jasona.work (12/19/2016)


    Rouge 1 (have now saw it twice)

    So you should certainly know how to spell it by now! :hehe:

    *I* spelled it correctly, just check the post!

    (and ignore...

  • RE: Duplicate data n times

    Use a tally table[/url]. I've created a small tally table using a CTE to demonstrate.

    ;

    WITH E(n) AS(

    SELECT n FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) E(n)

    )

    , cteTally(n) AS(

    ...

  • RE: Help Eliminating Duplicate Data

    Aggregate functions automatically exclude NULL values, so this can be simplified.

    SELECT *

    FROM (

    SELECT

    *,

    rn = ROW_NUMBER() OVER(PARTITION BY ProductId, ObjectId ORDER BY CheckNumber DESC)

    FROM EuroLuxProductBE.dbo.pdt_multidimensions m

    CROSS APPLY (

    SELECT COUNT(*)...

  • RE: Very Large Transaction Causing Error 'Attempting to set a non-NULL-able column's value to NULL'

    I don't know how you expect us to help you troubleshoot this. The problem specifically says that you have a NULL value, but you haven't given any us any...

  • RE: Confusion Over OR and And Operators

    simon.oakes (12/16/2016)


    1st Example:

    Select * from customers where country != 'US' AND country !='UK'; --Works

    Select * from customers where Not(country = 'US' OR country ='UK'); --Works because criteria within the NOT...

  • RE: A Fun Distraction

    I forgot to add that I am SO glad that I no longer work in fund-raising. With people trying to get in last minute gifts, this was always one...

  • RE: A Fun Distraction

    I'm currently reading The Altreian Enigma (Rho Agenda Assimilation Book 2)

    Tomorrow is the annual Solstice Party. All day board gaming with breaks for cheese fondu for dinner and later...

  • RE: Get current or historic values to calculate balance or total based on data parameters using SQL 2012

    This version only requires one table scan.

    ;

    WITH CTE AS (

    SELECT

    C.Id,

    C.value AS CurrentValue,

    C.valuedate AS CurrentValueDate,

    MAX(CASE WHEN C.valuedate <= @StartDate THEN CAST(C.valuedate AS BINARY(6)) + CAST(C.value AS BINARY(4)) END) OVER(PARTITION BY Id)...

  • RE: Need sql help

    sarwar.ali490 (12/15/2016)


    exactly...and now i added new column to new table and need to add the percentage of those two counts

    (count1*1.0)/(count2)...this needs to happen for every file load i do...

  • RE: Need sql help

    Do you mean like the following?

    INSERT YourTable

    VALUES((SELECT COUNT(*) FROM T1), (SELECT COUNT(*) FROM Q1))

    Drew

  • RE: Fiscal Quarter

    BWFC (12/15/2016)


    faulknerwilliam2 (12/15/2016)


    Hello

    I want to arrive at an output like 2011-Q4 (Financial Yr-Qtr)

    I can do this by:

    CASE -- Results: 2011-Q4 (Financial Yr-Qtr)

    ...

  • RE: Bitwise & NULL

    Jeff Moden (12/14/2016)


    drew.allen (12/13/2016)


    You're already seeing some of the issues, in that you can't have three-value states.

    As previously stated, yes you can. 0, 1, or NULL. Yes, I...

  • RE: Confusion Over OR and And Operators

    Matt Miller (#4) (12/14/2016)


    drew.allen (12/12/2016)


    SQLUSERMAN (12/10/2016)


    Suppose I want to find customers in the customers table who are not in the US or the UK.

    To me the query for the above...

  • RE: calling stored procedure in a loop and selecting from results

    It sounds like what you really want is an inline table-valued function.

    Drew

  • RE: Convert columns to rows

    komal145 (12/14/2016)


    I have written code , but it throws error.

    SELECT textresponse

    ,[Last Name] as LastName

    ,[First Name] as Firstname

    [City]

    FROM

    (

    Select

    textresponse AS textresponse

    ,questiONtext

    From #T

    )AS P

    PIVOT(

    Max(textresponse) FOR [questiontext] in ([Last Name],[First...

Viewing 15 posts - 2,086 through 2,100 (of 4,087 total)