MS Access Query - Overflow

Hi Experts,

I have this part of a query:

I am getting a overflow error.

I do not do any arthritic or is there any decimals

This is a conversion.
InvoiceNr(nvarchar(20), null)
InvoiceNr(PK, int, not null)

Please help and thanks
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What are the values in the column? Perhaps you have values that are too big to be represented as numerics in access?
Amour22015Author Commented:
How can you tell which are numbers and which are not?

The field I am converting from is InvoiceNr(nvarchar(20), null)





Please help and thanks...
Try adding this to your SELECT statement

Where IsNumeric(InvoiceNr) = 1
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Curiously though... You say MS ACCESS and yet your question references SQL Server data types nvarchar. Knowing exactly which is which helps us know exactly what were working with and how to help
Amour22015Author Commented:
I am using MS Access to run the conversion query.

I see nvarchar in the ssms window.

Data gets imported into ssms

I use External Data> ODBC Database>Import the source data into a new table int the currnt database>Machine Data Source>Import Objects

To get the table from ssms to access.

So I am running the query in access to Insert into the new tables...

I ran this query (in TSQL) to find all none numeric:
SELECT [txtInvoiceNo]
  FROM [SIOP_siophal].[dbo].[tblAccounting]
  Where txtInvoiceNo like '%[^0-9]%'

Open in new window

But have filtered them out yet still get the same error...

The view works fine, it happens when I run.

Please help and thanks...
SELECT  CAST( [txtInvoiceNo] as int) NewInvoiceNr
  FROM [SIOP_siophal].[dbo].[tblAccounting]
  Where txtInvoiceNo like '%[^0-9]%'

Does that work in SSMS? What is the biggest value you see there?
Amour22015Author Commented:
So I got this:
Msg 248, Level 16, State 1, Line 1
The conversion of the nvarchar value '3165101084' overflowed an int column.

What does this mean?

Please help and thanks

That is the problem. Those figures are bigger than the max value for the data INT and NUMERIC in Access. An overflow in this case, means the value is too big for the data type you are working with. SQL Server has got the BIGINT data type which will take this value. For Microsoft Access here are the maximum value: 

My next question is why you want to convert invoice numbers to numerics with the VAL formula? You never do arithmetic on them. Why not just leave them as Text?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Amour22015Author Commented:
Thanks for helping... Great
Glad to help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.