Forum Replies Created

Viewing 15 posts - 3,376 through 3,390 (of 5,504 total)

  • RE: How to group consecutive months

    Would the following code snippet help you to get started?

    DECLARE @tbl TABLE(account_number CHAR(8),payment_amt DECIMAL(6,2),DATE_PAYMENT_DUE DATETIME, num INT)

    INSERT INTO @tbl

    SELECT '10043997', 379.28 ,'2009-11-01 00:00:00.000', 1 UNION ALL

    SELECT '10043997', 379.28 ,'2009-12-01 00:00:00.000',...

  • RE: Help with Ranking Functions

    divyanth (6/2/2010)


    using a CTE instead of a sub query would improve the performance of the query

    ...

    AFAIK this is actually not true, since both, CTE and subquery will result in...

  • RE: How To ahndle Key-Value Pairs in SQL

    @bteraberry:

    I guess the biggest challenge would be to come up with a replacement for ROW_NUMBER().

    To substitute UNPIVOT and the CTE is a lot easier to handle...

    Maybe there is a tally...

  • RE: Combining INSERT And UPDATE Triggers?

    I don't know how you update that table (through stored procedure or a direct statement)...

    Let's assume the following code:

    UPDATE Blah

    SET col1=1, col2=...

    FROM Blah

    WHERE condition

    Why not change it to

    UPDATE Blah...

  • RE: database mail issue

    Would you mind reducing your post from 500 lines of code to the issue you're struggling with? If your issue is not to see the line break in your mail,...

  • RE: Combining INSERT And UPDATE Triggers?

    Regarding the INSERT trigger: I would use DEFAULT values for those two columns instead.

    Regarding UPADTE: why don't you include the ModifiedDate column in your update procedure / statement?

  • RE: create this query from access to sql

    It doesn't matter how you define the variable in your WHERE condition. All that matters is that you need to use a variable instead of an direct link to one...

  • RE: How To ahndle Key-Value Pairs in SQL

    The only thing I would change in bteraberry's solution is the split string function. I would use the DelimitedSplit8K function (search this site for the string) to avoid the while...

  • RE: create this query from access to sql

    Please see Eric Russells reply on your other thread. It's basically the same problem with the same solution. Just a different ACCESS form...

  • RE: Need some guidance on subselect

    Let's see if the following code will give the requested result:

    SELECT id, transdate AS begindate, account, #temptable_1.username, quantity, grossamt, netamt, transdate AS enddate, workcode, transdate,NBTotal

    FROM #temptable...

  • RE: Need some guidance on subselect

    The problem is your GROUP BY username condition within your subselect.

    This may cause more than one value (e.g. two NBTotal's if there are two username) leading to the error you...

  • RE: SQL query that needs to join comma seperated values to another table

    It depends.

    Which ID do you want as a result? The one from FirstTable or the one from the table generated by the split function? How do you plan to deal...

  • RE: ADD column storeID while bulk inserting

    daniarchitect (6/1/2010)


    Hey Jeff,

    I have been trying it the whole night yesterday and all the day today.. and it didn't work out.. (it goes well till some point and then...

  • RE: Want to insert Blank inside the main table instead of Null

    Sergiy (6/1/2010)


    I believe you don't need that table at all.

    What you need is a properly formatted query with GROUPING and ROLLUP.

    If you look up BOL for these key words you'll...

  • RE: SQL query that needs to join comma seperated values to another table

    You don't need to.

    But it certainly helps performance... 😀

    There are numerous split string functions available. Somer perform better than others...

    I'm not sure if you're running SQL2000 (I assume you do...

Viewing 15 posts - 3,376 through 3,390 (of 5,504 total)