Forum Replies Created

Viewing 15 posts - 91 through 105 (of 921 total)

  • RE: Eliminating duplicate records in join

    that's more than the guys at Enron and MCI Worldcom can say

    They're preparing to say (on the stand): "Unfortunately I don't know any accounting, so this is very confusing...

  • RE: Create a temp table in SP from another SP?

    CREATE TABLE #Temp(

    Col1 int,

    Col2 int)

    INSERT #Temp

    EXEC p_Test 'YourParam'

    Put all the DDL at the beginning of your calling proc to prevent excessive recompiles.

  • RE: Eliminating duplicate records in join

    Unfortunately I know some accounting, so this is very confusing to me. 

    Please post the DDL and some sample data with an example of...

  • RE: Delete records from a "summarized" table.

    A way to do exactly what? 

  • RE: Anyone done anything similar? Need Help!

    There are lots of ways to do this. 

    • You could have your weekend table populated with a row for each weekend day and then just subtract your start date from...
  • RE: Create a temp table in SP from another SP?

    Yes.  That's typically how one deals with a set returned from a called proc.

  • RE: DateTime Function

    UPDATE SCH_SET

        SET fac_send_date = DateAdd(n, fdate_cnt*24*60 + fhour*60 + fmin, f.book_date)

        FROM SCH_SET t, FAC_BOOK f

        WHERE upper(set_id) = 'A000001' and upper(pcode) = 'A'

  • RE: TimeSheet - Date Time

    If that's what you want...

    SELECT ISNULL(i.FEmpID,o.FEmpID) FEmpID, i.FTime FTimeIn, o.FTime FTimeOut, CONVERT(char(5),o.FTime - i.FTime,14) Hours

    FROM Punches i FULL JOIN Punches o ON i.FEmpID = o.FEmpID AND o.FType = 'OUT' AND...

  • RE: Triggers to create String ID

    It now sounds as though you should not be using a method incorporating the identity property.  Alter the stored procedure so it optionally takes a prefix and/or number.

    CREATE...

  • RE: Triggers to create String ID

    If the first character is input but the numeric portion is automatically increasing, then you could use bbron's suggestion of a table holding the last number used.

    CREATE TABLE SeqNos(

    Type char(4)...

  • RE: Var types for this type of Stored Procedure

    About the only reason to do this with dynamic SQL is if those responsible for the front-end code are not conversant with SQL.  As that is where your clauses are...

  • RE: Record deletion

    If you have any indexes on the ID columns, this will probably be fastest:

    DELETE FROM StagingIn

    WHERE NOT EXISTS

    (SELECT *

     FROM Plans

     WHERE ID1 = StagingIn.ID1

      AND ID2 = StagingIn.ID2

      AND ID3 =...

  • RE: transaction not rolling back

    No, as I wrote, you only need one local variable:

    declare @DidItError int

    insert statement ....

    set @DidItError = @@error

    update....

    set @DidItError = @DidItError + @@error

    if @DidItError > 0 then

    rollback

    else

    commit

  • RE: transaction not rolling back

    > Maybe I have to save the @@error to a var after every statement, then at the end evaluate that var to see if there was errors?

    Yes, the @@error value...

  • RE: Triggers to create String ID

    CREATE TABLE test(

    IntID int identity(0,1) CHECK (IntID < 260000),

    StringID AS CHAR(IntID/10000 + 65) + RIGHT('0000' + CAST(IntID AS varchar(10)),4))

    You could also do this with a view instead of a computed...

Viewing 15 posts - 91 through 105 (of 921 total)