SQL + Dreamweaver

D

Dam6

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?
 
G

Guest

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.

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

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

Dam6

Thanks!!!

Cowboy (Gregory A. Beamer) - MVP said:
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.

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top