Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 asking about data types

Author  Topic 

aldiwahyu
Starting Member

7 Posts

Posted - 2011-10-18 : 03:27:47
is there any datatypes in Microsoft SQL Server 2000 which has maximum length over 1000 characters ?
because i wanna saved a large description that can be deleted or be editted ..
please help me ..

thank you before


regards , Aldi

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-18 : 03:29:30
yes. the max length for varchar is 8000


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

aldiwahyu
Starting Member

7 Posts

Posted - 2011-10-18 : 03:56:58
most of people in the internet are said "255" characters for varchar ?
i'm confused with it
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-18 : 04:16:38
you can use text if you want to store data more then 8000 characters but keep in mind that it wont support some of normal string handling functions

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-18 : 04:17:01
Nope. It is 8000. According to the Books Online for SQL Server 2000
quote:

char[(n)]

Fixed-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000. Storage size is n bytes. The SQL-92 synonym for char is character.

varchar[(n)]

Variable-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000. Storage size is the actual length in bytes of the data entered, not n bytes. The data entered can be 0 characters in length. The SQL-92 synonyms for varchar are char varying or character varying.


http://msdn.microsoft.com/en-us/library/aa258242%28v=sql.80%29.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-18 : 04:27:17
quote:
Originally posted by aldiwahyu

most of people in the internet are said "255" characters for varchar ?
i'm confused with it



I guess they have been given you the wrong information. For SQL Server related questions, you should visit a reputable site like this


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-18 : 04:28:52
quote:
Originally posted by aldiwahyu

most of people in the internet are said "255" characters for varchar ?
i'm confused with it


can you post one such reference?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

aldiwahyu
Starting Member

7 Posts

Posted - 2011-10-18 : 04:38:43
well , what about text datatypes , is it edittable ?
i want to make a long description, and i don't know what's the proper datatypes
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-18 : 05:11:21
its editable but only thing is updation is not as straightforward as normal character data types

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-18 : 05:13:16
see below

http://msdn.microsoft.com/en-us/library/ms187993.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

aldiwahyu
Starting Member

7 Posts

Posted - 2011-10-18 : 05:21:35
i'm still confused, how to edit text type , and what about '255' in the varchar and whats about '8000' ?
i'm very confused
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-18 : 05:32:06
where do you want to edit the text value?

255,8000 etc represent maxlength of varchar fields

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

aldiwahyu
Starting Member

7 Posts

Posted - 2011-10-18 : 05:41:42
i wanna edit the text value through visual basic 6.0

uh , i see, is 8000 characters = 255 byte ?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-18 : 05:43:56
even if its text you can update it from vb. you need to use UPDATETEXT in code behind.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-10-18 : 05:44:17
You would be much better to upgrade to newer version of SQL Server. SQL 2005, 2008 and 2008R2 (latest version) support VARCHAR(MAX) which has "unlimited" length.

Using TEXT, which was the only "unlimited" length character datatype in SQL 2000, has lots of limitations and is a PITA to use compared to the new VARCHAR(MAX) - which behaves just like an ordinary VARCHAR datatype, in programming use (physical storage is different to normal VARCHAR, but that should not concern you).

By comparison TEXT will give you trouble in Triggers, string handling, and all sorts of other places.

If your descriptions will all be less than 8,000 characters you can use VARCHAR ... but there is a limit, in SQL 2000, on the total length of a row - so ig you have several VARCHAR(8000) columns in a single table the overal length of the row is limited - that's although good reason to upgrade as that is no longer a limitation in SQL2005/2008
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-18 : 05:51:54
quote:
Originally posted by aldiwahyu
uh , i see, is 8000 characters = 255 byte ?


8000 characters = 8000 bytes


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

aldiwahyu
Starting Member

7 Posts

Posted - 2011-10-18 : 06:08:30
thank you for your information , this forum is very prizeable :D
thank you for all who helps me , i'll try it , i'll ask again if i meet any difficulties again
Go to Top of Page
   

- Advertisement -