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 

field length in syscolumns table

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





PostPosted: Tue Sep 16, 2003 9:58 am    Post subject: field length in syscolumns table Reply with quote



Hello,

I'm executing a query to syscolumns table to retrieve the size of the fields
of a table... Everything runs ok except when type is nvarchar, when the
length field is the double of the real size. I've noticed that there's a
field called prec that has the correct value. It's possible that when a
field is nvarchar the length field is double than the real size? Can I
consider that to divide it by two when I have the result or I've to retrieve
prec field in this case? It happens with other field type?
thanks very much

--
Oscar Espinosa



Back to top
Martijn Tonies
Guest





PostPosted: Tue Sep 16, 2003 1:13 pm    Post subject: Re: field length in syscolumns table Reply with quote



Hi Oscar,
Quote:

I'm executing a query to syscolumns table to retrieve the size of the fields

I assume you are talking about MS SQL Server here?

Quote:
of a table... Everything runs ok except when type is nvarchar, when the
length field is the double of the real size. I've noticed that there's a
field called prec that has the correct value. It's possible that when a
field is nvarchar the length field is double than the real size? Can I
consider that to divide it by two when I have the result or I've to retrieve
prec field in this case? It happens with other field type?
thanks very much

The "prec" column holds the length in characters, while the "length" column
holds the length in bytes.

Nchars occupy two bytes/character, as documented in the BOL.


--

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com




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.