Forum Replies Created

Viewing 15 posts - 751 through 765 (of 897 total)

  • RE: Removing negative condition

    There is no easy way to remove a negative condition. It depends on the data in the table and the indexes. Try converting the query using a positive condition as...

  • RE: Table columns in chronlogical order

    WayneS (5/13/2010)


    h2sut (5/13/2010)


    Hello: This worked!! I really appreciate your help on this i cant thank you a enough. Thanks again

    be bless

    I would caution you: if you can't...

  • RE: Table columns in chronlogical order

    h2sut (5/13/2010)


    Hi:

    I not sure how that works. I have over 959 rows of data. I saw that you mention i could use a function that did the same thing....

  • RE: Table columns in chronlogical order

    This should give you the expected result

    DECLARE@tblTable TABLE

    (

    Col1 INT,

    Col2 INT,

    Col3 INT,

    Col4 INT

    )

    INSERT@tblTable

    SELECT65,55,0,67 UNION ALL

    SELECT1,3,2,5 UNION ALL

    SELECT24, 21, 3, 19

    ; WITH cte_Table AS

    (

    SELECTROW_NUMBER() OVER ( ORDER BY Col1 ) ID, *

    FROM@tblTable

    ),...

  • RE: update statement with isnull and nullif functions.

    You can also use a CASE statement for the same

    UPDATEdbo.Mytable

    SET@Path = COALESCE( @Path, '' ),

    @PathReadOnly = COALESCE( @PathReadOnly, '' ) ,

    Path = CASE WHEN @Path = '' THEN Path ELSE...

  • RE: find missing date and values

    You gave us what you didn't want instead of what you wanted.

    But still, i hope this will give you what you want

    ; WITH cte_Dates AS

    (

    SELECTcode, DateTimes, Amount

    FROM@Table

    UNION ALL

    SELECTcode, DateTimes +...

  • RE: update table with tally doesnot work

    This should give you the expected output without a Tally table

    UPDATEfprj

    SETfprj.periodid = ISNULL( fper.periodid, 1 ) + fprj.rownum - 1

    FROM(

    SELECTROW_NUMBER() OVER( PARTITION BY prjid ORDER BY periodid ) rownum, periodid,...

  • RE: Delete duplicate rows

    Jason P. Burnett (5/4/2010)


    Since I am not completely sure of your table structure given the information provided I am assuming that their is some sort of PK on the records....

  • RE: nested sql statments

    I think you can use an INSTEAD OF trigger for the same. There you have to make sure that you delete/update the related data in proper order and then delete/update...

  • RE: STUFF FUNCTION

    You will have to run an UPDATE query like below

    UPDATEform5Test

    SETIndUniqId = STUFF(IndUniqId, 7, 1, '/0')

  • RE: Select from two tables, side by side

    This should work for you

    SELECTCOALESCE( A.RowID, B.RowID ) RowID, DataValueA, DataValueB

    FROM(

    SELECTROW_NUMBER() OVER ( PARTITION BY RowID ORDER BY DataValueA ) RowNum, *

    FROM@TableA

    ) A

    FULL OUTER JOIN(

    SELECTROW_NUMBER() OVER ( PARTITION BY RowID...

  • RE: Trigger For Delete - Multiple Row Value

    I hope this helps..

    UPDATES

    SETCountUsedTogether = S.CountUsedTogether - 1

    FROMSummary S

    INNER JOIN deleted D1 ON S.IdItem1 = D1.IdItem

    INNER JOIN deleted D2 ON S.IdItem2 = D2.IdItem

    WHERED1.IdTrans = D2.IdTrans

  • RE: Trigger For Delete - Multiple Row Value

    ard_dicted (4/22/2010)


    When I delete a transaction which using item with ID 2,3, and 4

    Does this mean you are running the query

    DELETE FROM DetailTrans WHERE IdItem IN (2,3,4)

    And how is DetailTrans...

  • RE: Truncate rollback

    Nice question. Not many know that even a TRUNCATE can be rolled back.

    Some people as mentioned might get tricked by the INSERT statement and may choose the wrong answer.

    But on...

  • RE: Trigger For Delete - Multiple Row Value

    It would be of great help if you provide the table structure of the table on which you are creating the trigger and the table on which you are doing...

Viewing 15 posts - 751 through 765 (of 897 total)