Monday, March 12, 2012

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

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

tiborYou're missing a few of the items that are suggested in the FAQ Entry (http://www.dbforums.com/showthread.php?t=1212452#post4527530) 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|||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

No comments:

Post a Comment