Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

SQL + Dreamweaver

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dam6 - 12 Aug 2005 10:16 GMT
Hello,

I seem to be running into a problem with regards to data size etc:

Explanation:
A person opens a .aspx page and posts and writes an article of a few
thousand words.  When they click Insert Record they get this message:
System.Data.SqlClient.SqlException: String or binary data would be
truncated.
The statement has been terminated.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DreamweaverCtrls.DataSet.DoInit()

Problem:
It's to do with the size of the data being inserted into the record and I
have increased the VarChar length to 6000 characters to compensate. Is there
a better DataType to hold the information?  With MS Access this is a major
problem but I would expect that but not with SQL Server?  Any suggestions?
Cowboy (Gregory A. Beamer) - MVP - 12 Aug 2005 13:23 GMT
SQL Server allows 8k per data page. If you have an int column (4 bytes), you
still have almost 8,000 ansi characters to work with. This is not enough for
the verbose, however, which forces you to use a Text field:

CREATE TABLE ArticlesForTheReallyVerbose
(
ArticleID int IDENTITY(1,1) PRIMARY KEY
, ArticleText text NOT NULL
)

You might think you can separate out the text into multiple fields, ala:

CREATE TABLE ArticlesForTheReallyVerbose
(
ArticleID int IDENTITY(1,1) PRIMARY KEY
, ArticleText1 varchar (7000) NOT NULL
, ArticleText2 varchar (7000) NOT NULL
)

... but you will go over the page size if someone actually is verbose.

There are pitfalls with text fields, but this case calls for one.

Signature

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

> Hello,
>
[quoted text clipped - 16 lines]
> a better DataType to hold the information?  With MS Access this is a major
> problem but I would expect that but not with SQL Server?  Any suggestions?
Dam6 - 19 Aug 2005 11:47 GMT
Thanks!!!

> SQL Server allows 8k per data page. If you have an int column (4 bytes),
> you
[quoted text clipped - 44 lines]
>> problem but I would expect that but not with SQL Server?  Any
>> suggestions?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.