Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jfkennedy5
Starting Member
6 Posts |
Posted - 2007-02-22 : 19:57:49
|
| Hello all, Im trying to insert into a tableINSERT INTO [SPIResConv5].[dbo].[TransactionsTemp] ([RESORT_ID] ,[TRANSTYPE_ID] ,[BILLCODE_ID] ,[MAINTENANCE_ID] ,[CONTACT_ID] ,[POSTED] ,[DATE] ,[USER_ID] ,[BATCH] ,[TYPE] ,[AMOUNT] ,[PAYMENTCODE_ID] ,[BANKCODE_ID] ,[DOCNO] ,[Shift4Trx] )Select Resort_ID. '' as TRANSTYPE_ID, '' as BILLCODE_ID, '' as MAINTENANCE_ID, Contact_ID, 'False' as Posted, Date = getdate(), 'Hwells' as [USER_ID], 3000 as BATCH, 2 as Type, Amount, 'LockBox' as PAYMENTCODE_ID, 'Conv' as BANKCODE_ID, DOCNO, '' as [Shift4Trx]from TransactionTempToTransactionbut I get a --Cannot insert the value NULL into column 'TRXNO', table 'SPIResConv5.dbo.TransactionsTemp'; column does not allow nulls. INSERT fails.The TRXNO is the first column in the table--but it has a wierd setup. For example TRXNO RESORT_ID3 ELL23 FAC3 CSI3 ATR4 CSI 4 FAC4 ELL2It Creates a tranaction code- based on the last resort itselfs transaction -instead just adding a number for the next transaction.How would I know the last tranasaction for the resort to insert the data from the other table?Thanks for your help |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-02-22 : 20:18:38
|
do you have another table that keeps track of the Transaction No, TRXNO ? KH |
 |
|
|
|
|
|
|
|