 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andreas Grabher Guest
|
Posted: Wed Apr 07, 2004 1:15 pm Post subject: How to get the value from a numeric(20) datatype in SQL |
|
|
Hi,
I have a Microsoft SQL Server 7 table which contains fields defined as
"NUMERIC(20)".
In these fields there are numbers with a length of 17 digits.
e.g. 18032001709254607
My problem is, how can I get the correct value out of these fields?
If I try to get the value with a TQuery Object:
Query.FieldByName('kcnr').AsString;
I only get the following '1,80320017092546E16'.
It also doesn't work with Query.FieldByName('kcnr').AsInteger.
Does anybody has an idea, how I can get the value out of these fields (return
value should be a string or a number (maybe Int64?)).
I'm working with Delphi 5 Enterprise and BDE 5.01.
Thanks in advance for any hints.
Andreas.
--
E-Mail: [email]ante (AT) tmt (DOT) at[/email]
Homepage: http://www.tmt.at/ante/
Home of the Pro Pinball: Hall of Fame
|
|
| Back to top |
|
 |
Andreas Grabher Guest
|
Posted: Thu Apr 08, 2004 11:36 am Post subject: Re: How to get the value from a numeric(20) datatype in SQL |
|
|
Andreas Grabher <ante (AT) tmt (DOT) at> schrieb:
| Quote: | My problem is, how can I get the correct value out of these fields?
If I try to get the value with a TQuery Object:
Query.FieldByName('kcnr').AsString;
I only get the following '1,80320017092546E16'.
|
I have found a solution, but I'm not pretty happy with it.
I'm executing the following sql statements:
select * into #tmp_db from testdb
alter table #tmp_db add kcnr_string varchar(20) null
update #tmp_db set kcnr_string=kcnr
So I get a string field with the correct information, and I can access it now
with Query.FieldByName('kcnr_string').AsString.
In the moment this works for me, but if someone has an idea how to access the
numeric(20)-field directly, please let me know.
Thanks,
Andreas.
--
E-Mail: [email]ante (AT) tmt (DOT) at[/email]
Homepage: http://www.tmt.at/ante/
Home of the Pro Pinball: Hall of Fame
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|