Forum Replies Created

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

  • RE: Summing negative and positive values

    Try this:

    Select

    prdid as 'product number',

    sum(quano) as 'quantity ordered'

    from SalesOrderTable

    where prdid = 'XYZ'

    GROUP BY prdid -- Added this now

    Guess you have left the GROUP BY clause 😛

  • RE: Split source data in two tables

    A 2-part INSERT might help you..

    First INSERT - SourceTable data (only Name col) into Target

    Second INSERT - JOIN SourceTable and TargetTable and insert into TargetConnection..

  • RE: Is NTILE OVER (PARTITION BY .. running total..) possible?

    Got it; Now, as Dixie says, either Quirky Update or Cursor can save you. I am still pondering if it will be possible by a Recursive-CTE..Got to think..

  • RE: Is NTILE OVER (PARTITION BY .. running total..) possible?

    I couldnt get the logic behind the grouping.. can you please be more elaborate on your explanation?? This certainly is do-able with set-based code..

  • RE: How to output query results into a text file

    You can utilize BCP commands and call xp_cmdshell to execute the BCP statements..

    To read abt BCP, click here

  • RE: Names of People Born in specific month

    calvo (4/28/2011)


    ColdCoffee (4/28/2011)


    toddasd (4/28/2011)


    @WayneS: You write some great code.

    I totally concur 🙂 he is awesome, like how The Miz in WWE says, Wayne is awesome 🙂

    lol...love it. You just worked...

  • RE: Names of People Born in specific month

    toddasd (4/28/2011)


    @WayneS: You write some great code.

    I totally concur 🙂 he is awesome, like how The Miz in WWE says, Wayne is awesome 🙂

  • RE: Eliminating Duplicate Rows in SQL server

    Stefan Krzywicki (4/28/2011)


    ColdCoffee (4/28/2011)


    Stefan Krzywicki (4/28/2011)


    Also, you don't have to use a CTE for this, you can just use a subquery

    Aren't CTE and SubQuery synonymous except for the fact that...

  • RE: Eliminating Duplicate Rows in SQL server

    Stefan Krzywicki (4/28/2011)


    Also, you don't have to use a CTE for this, you can just use a subquery

    Aren't CTE and SubQuery synonymous except for the fact that CTE has an...

  • RE: Eliminating Duplicate Rows in SQL server

    Stefan Krzywicki (4/28/2011)


    ColdCoffee (4/27/2011)


    Try this:

    declare @table table

    ( catid int, catname varchar(25) , refid int )

    insert into @table values

    (1 ,'Lenovo', 21),

    (2 ,'Sony', 22),

    (2 ,'Sony', 22),

    (3 ,'Dell', 23),

    (4 ,'Toshiba', 24),

    (4 ,'Toshiba', 24)

    ;...

  • RE: Join Query in sql

    Change

    SELECT DATEADD(MM, N,@StartDate) [Month]

    FROM NumbersTable

    WHERE N < @NumOfMonths

    to

    SELECT DATEADD(MM, N,@StartDate) [Month]

    INTO dbo.TempTable -- Add this line alone

    FROM NumbersTable

    WHERE N < @NumOfMonths

    Look into the commented line 🙂

  • RE: Join Query in sql

    No Usha, you CANNOT join 1 SPs.. only tables and views can be joined..

  • RE: Sql Inert

    vicki528 (4/28/2011)


    i have come up with an alternative solution... may b this will help... its using while loop. you just have to input the starting and ending year like 2000...

  • RE: Sql Inert

    How about this?

    DECLARE @StartYear INT

    ,@EndYear INT;

    SET @StartYear = 2010

    SET @EndYear = 2011

    DECLARE...

  • RE: Customer Names Mixed up..

    It would help great up if you show the real data, as in, mock-up of ur real data instead of the column names.. and also all the columns in the...

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