BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get the value from a numeric(20) datatype in SQL

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Andreas Grabher
Guest





PostPosted: Wed Apr 07, 2004 1:15 pm    Post subject: How to get the value from a numeric(20) datatype in SQL Reply with quote



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





PostPosted: Thu Apr 08, 2004 11:36 am    Post subject: Re: How to get the value from a numeric(20) datatype in SQL Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.