Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Posts
    82

    Unanswered: Insert Statement Help

    hi all

    i am writing a trigger that inserts from one table to the next. i have an issue with the table being inserted into have 2 more columns than the one being inserted from. Here is the trigger just in case

    Code:
    CREATE TRIGGER [Insert40801] ON [dbo].[tPA10801] 
    FOR INSERT
    
    AS
    
    insert into tPA40801
    select 
    	intTimesheetKey,
    	chrTimesheetNumber,
    	TranID,
    	intEmployeeKey,
    	intEmployeeDivKey,	
    	BatchKey,
    	dtePeriodStartDate,
    	dtePeriodEndDate,
    	chrStatus1,
    	numTotalHrsWorked,
    	numTotalHrsBilled,
    	numTotalCosts,
    	numTotalCharges,
    	numTotalRecover,
    	chrSignedID,
    	dteSignedDate,
    	chrApprovalID,
    	dteApprovalDate,
    	intJobKey,
    	intPhaseKey,
    	intTaskKey,
    	dteDate,
    	siCstClsificatnDDL,
    	UpdateCounter,
    	CompanyID
    	
    
    
     from tpa10801
    now tpa40801 has two extra columns that tpa10801 doesnt. how would i please the sql gods and get the insert statement running? thanks alot

    tibor

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You're missing a few of the items that are suggested in the FAQ Entry that would probably get you the answer you need on your next try. Specifically, it would help me a lot to know what the table structures are now, so I'd know which columns were missing.

    -PatP

  3. #3
    Join Date
    Mar 2006
    Posts
    82
    actually i was able to overcome that issue but just deleting the columns from tPA40801. but now i have an issue with the batchkey column. the program that this is all for is recognizing that it is a batchkey and does not allow the program to save while this is trying to insert. so i just need to be able to insert everything there except the batchkey column. hope that helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •