Reputation: 169
First of all sorry for the bad english.
I want to make the following query: "select top 1 NumeroLote from tblLote where convert(numeric(12), Documento)=28405"
The data for "Documento" is stored on a varchar field and sometimes is recorded as "002008" or "2008"... That's why I was trying to use numeric.
It works on sql server 2008 but when I use it from vb6 using Provider="sqloledb"and Microsoft ActiveX Data Objects 2.0 library, I get the following error: "numeric is not a recognized function name. Microsoft Ole Db provider for sql server".
Do you know some alternatives, I can only think of using "like".
EDIT: Documento might be varchar(12)
Answer: bigint
Thank you so much for your time!
Upvotes: 2
Views: 657
Reputation: 13422
The data for "Documento" is stored on a varchar field and sometimes is recorded as "002008" or "2008"... That's why I was trying to use numeric.
Is the number always an integer? If so, try using this instead:
CONVERT(INT, Documento)
Edit: Use bigint to avoid the overflow problem:
CONVERT(BIGINT, Documento)
Upvotes: 3