Forum Replies Created

Viewing 15 posts - 6,616 through 6,630 (of 10,144 total)

  • RE: How to return Null or value when nothing is returned from Query

    Never miss a (nearly) free opportunity to gather some information:

    SELECT Result = NULLIF(COUNT(*),0) FROM atable

  • RE: Need to Add text in SP

    Use an output parameter. Set the value of the output parameter to the number of rows returned by the SELECT. Interpret the parameter at the client side.

  • RE: Duplicate records based on specific columns list

    sonymadhu (10/10/2011)


    Hey frnds,

    I am new to this site actually, thats the problem..

    Just i followed how i post queries in other sites juz did the same here also..

    at last i got...

  • RE: Sum rows of data from various tables in single column

    The most logical way to do this is like so:

    SELECT

    OSLP.SlpName AS [Salesperson],

    invoice.,

    d.*,

    i.*

    FROM OSLP

    LEFT JOIN (

    SELECT

    OINV.SlpCode,

    OINV.CardCode AS [Cust ID],

    OINV.CardName AS [Customer],

    SUM(INV1.LineTotal) AS [Sales]

    FROM...

  • RE: Duplicate records based on specific columns list

    sonymadhu (10/10/2011)


    Hi All,

    I have a requirement like in my sample table

    there are empid, firstname, lastname, salary, date joined.

    Now in Sample table i want only the list of all duplicate records...

  • RE: alternative of Top.

    shivendrakumaryadav60 (10/7/2011)


    Thanks to all.. 🙂

    Actually when we perform "TOP" for table having very large

    row set (50000 or More) ;than "TOP" gives performance issue. It happens because according to sql architecture...

  • RE: "Recursive" Update query

    Jakub Dvorak (10/7/2011)


    ...I need to update Vals without recursion or cursor or loops...

    Why not? This is a running totals update. The fastest way to do it is a quirky update,...

  • RE: alternative of Top.

    SELECT SUM(Agg) as [Agg]

    From

    (

    select

    id,

    rn = ROW_NUMBER() OVER(ORDER BY id)

    from @testing

    ) dt WHERE rn < 11

  • RE: Calculating Moving Averages with T-SQL

    Here's an interim solution for you. It's horribly inefficient however, I'm working on a second more efficient version.

    DROP TABLE #ROCdata

    CREATE TABLE #ROCdata (ID INT NOT NULL, Symbol_Code VARCHAR(12), Transaction_date DATE,...

  • RE: Replacement for union

    jared-709193 (10/4/2011)


    ...If, however, I just want to see a list of identities from T1 combined with the identities in T2 without duplicates I may choose the query below:

    CREATE TABLE #Tablename...

  • RE: Generating number sequences with Common Table Expressions

    nigel. (10/4/2011)


    skra (10/4/2011)


    I am surprised that anyone is still reading it since it was published in february 2008 🙂

    It is the "Featured Script" in todays news letter.

    What's "today"?

    By Rafal Skotak,...

  • RE: Generating number sequences with Common Table Expressions

    Try option (MAXRECURSION 0).

    This is by far the slowest of the CTE-based row (number) generation methods but as your code shows it's very easy to manipulate rCTE's to generate quite...

  • RE: Replacement for union

    jared-709193 (10/3/2011)


    ChrisM@home (10/3/2011)


    komal145 (10/3/2011)


    I have table T1

    1234

    And table T2

    3456

    And my result set should be

    123456

    Is there any way other than union?

    Yes, several, but union (without ALL) would be best. Why...

  • RE: Performanence issue on select query

    ...What will i do for that. ? ...

    Post the execution plan.

  • RE: Calculating Moving Averages with T-SQL

    sushilb (10/3/2011)


    Well the condition should not on 13 rows before , it should be on thirteenths days before

    as below

    select ID,

    ...

Viewing 15 posts - 6,616 through 6,630 (of 10,144 total)