Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query not inserting both the columns into MS Access tables

Status
Not open for further replies.

Kalyan Ganesan

Programmer
May 10, 2017
93
US
I have imported a table into MS Access from Excel.its called Sheet1

I have a query below

INSERT INTO LOAN_LIST ( NEW_LOAN_NUMBER,OLD_LOAN_NUMBER )
SELECT TOP 100 Sheet1.[ACCT_NBR] AS NEW_LOAN_NUMBER,Sheet1.[V_Acct_Nbr] as OLD_LOAN_NUMBER
FROM Sheet1;


for some reason it doesnt insert the first column ACCT_NBR into Loan List table..when i just run this query

SELECT TOP 100 Sheet1.[ACCT_NBR] AS NEW_LOAN_NUMBER,Sheet1.[V_Acct_Nbr] as OLD_LOAN_NUMBER
FROM Sheet1;

it does pull two columns data.
there are no triggers or any constraint in the linked table Loan_List

what could be wrong here?
 
I would check constraints. Are there required records in a related table? Are any of the fields "lookup" fields?

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
How are the 2 columns defined in LOAN_LIST table and in Sheet1 table?

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
In Loan_List Table the two columns are number, sheet1 table both the columns are numbers,also i didnt see any constraints or dependencies in the table Loan_list
 
What happens when you do:
[tt]INSERT INTO LOAN_LIST ( NEW_LOAN_NUMBER, OLD_LOAN_NUMBER )
VALUES (123, 678)[/tt]

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Tried

INSERT INTO LOAN_LIST ( NEW_LOAN_NUMBER, OLD_LOAN_NUMBER )
VALUES (123, 678)


inserts 678 into old_loan_number
 
What about the [tt]NEW_LOAN_NUMBER[/tt] field? Nothing? Is it NULL? Any errors? Do you allow NULL to be in this field?

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
new loan number is just null,it just doesnt insert into it ,there are no constraints or conditions so yes null must be allowed
 
Can you update the NEW_LOAN_NUMBER field by hand? Can you type a number in there? And does it take it/does the number stay in the field?

Grasping straws here... :)

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Actually i did try that and it wouldn't let me insert values that way ....this is very strange.like i said there are no triggers on the linked table in Oracle,no contraints,no primary key,but the allow null is checked as Yes,but thats for both columns,dont know why it would prevent only this one to enter data
 
I tried this

create table LOAN_LIST_Test as select * from LOAN_LIST_VLS;

INSERT INTO LSDMGR.LOAN_LIST_Test(NEW_LOAN_NUMBER,OLD_LOAN_NUMBER) VALUES(7400760339,410011260339);

select * from LOAN_LIST_Test;

It showed that it has both the column values

How could this work when the original table doesnt let the data not entered into New_Loan_NUmber
 
You can spend days tracking this issue.

Create a new table
Transfer all data from the old table to the new table
Drop the old table
Rename the new table

Problem solved.

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Can oracle read CSV file thru pl sql and insert two columns into a oracle table?i can do this manually i know that but all this needs to be run in a script in production that is why..
 
Yes.
You can have a simple Stored Procedure or a Package written in PL/SQL in Oracle where you can read a csv file and write the data into an Oracle's table.

From your other post: thread1662-1780658

What would be the code to insert the data from two columns in the excel file into the oracle table..

First you need to determine if you want to read from Excel file or from CSV file - 2 completely different 'animals' :)

Have fun.

---- Andy

There is a great need for a sarcasm font.
 

Andrzejek

Sorry i pasted the request to get the code to read from CSV into Oracle table in the wrong posting,but i am assuming you can help me on this,so i need the code to

INSERT two columns data in a TABLE in Oracle from a CSV file, i need this done using code and not thru wizard or any package.just thru Pl/SQL Code
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top