Forum Replies Created

Viewing 15 posts - 31 through 45 (of 345 total)

  • RE: SET IDENTITY_INSERT [dbo].[tblTransactions] ON

    We know from your other post that tblTransactions.Transaction_Number is an IDENTITY field. You are attempting to insert an Transaction_Number back into the IDENTITY field that was just created. It doesn't...

  • RE: Dynamic SQL

    All your answers lie here:

    http://www.sommarskog.se/dynamic_sql.html

  • RE: Trigger using @@IDENTITY

    briancampbellmcad (12/5/2012)


    So I can't have my trigger create a record to go in my tblTransactions and pick up the next available sequential number? I guess on my application...

  • RE: Trigger using @@IDENTITY

    I'm thinking now that tblTransactions.@@IDENTITY should actually be tblTransactions.OriginalTransactionNumber?

    You can't have @@IDENTITY in the insert list and you also can't insert into Transaction_Number since it's an IDENTITY. (For the...

  • RE: Trigger using @@IDENTITY

    What is the logic in inserting a new record into tblTransactions when a record in tblTransactions is updated? Shouldn't this be logged to a different table?

  • RE: Execute a dynamic select statment

    Change to

    declare @q varchar(max)

    SELECT @q = ISNULL(@q, '') + 'DELETE FROM ' + tablename + ' where tid =' + convert(char,rowid) + '; ' from #incoming where action...

  • RE: Interview Questions

    Alan.B (12/5/2012)


    Your Name Here (12/5/2012)


    Sorry to be a bit off-topic but this thread flashed me back to an interview I had years ago. The 'technical' questions about troubleshooting were...

  • RE: SQL Trigger for multiple columns - Insert / update

    UPDATE takes only one column. There is no similar 'INSERT' function; UPDATE checks for both.

    Your line would change to

    IF (UPDATE(Col1) OR UPDATE(Col2) OR UPDATE(Col3))

    You could also use COLUMNS_UPDATED, but...

  • RE: help with trigger

    To fix the syntax error, you need one more END. The BEGIN block for the trigger is not closed.

  • RE: Delete existing records, after inserting new record

    As nonsensical as this requirement is, sounds like you want

    CREATE trigger Del_records on Active_Table

    AFTER insert

    as

    delete from Active_Table a WHERE a.ID NOT IN (SELECT ID FROM INSERTED)

    Of course, use your...

  • RE: UPDATE & INSERT Conditional trigger

    PFlorenzano-641896 (9/11/2012)


    I'm wondering if I could use just one trigger to handle both the UPDATE and INSERT within the Mag_PortalUser table, and conditional logic like an IF or CASE...

  • RE: can this code be in a stored proc?

    The last line in the dynamic sql is highly suspect.

    'where act.uniqueincluster between select min('+@uniqueincluster+') from #temp1 and select max('+@uniqueincluster+') from #temp1'

    It doesn't make sense to have the variable in there....

  • RE: UPDATE when the values are the same

    MissTippsInOz (8/24/2012)


    Such passion for our topic!! It amused me to note that the original poster announced he'd got the answer he required 9 days ago now and has, presumably, gone...

  • RE: How to grab both old and new PK

    iwaldner (6/13/2012)


    I'm inserting a subset of a table into the same table and in order to update some related tables need to capture both the newly created identity PK, and...

  • RE: Wrist Support

    Anyone here move to a standing workstation or give it a try? It's supposed to be much healthier for blood flow and muscle use (as Brandie states.) It's been...

Viewing 15 posts - 31 through 45 (of 345 total)