473,657 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

insert into/update table in db with long text

Hi,

i connect to a ms sql2000server via SqlConnection.
if i make an SqlCommand "INSERT INTO mytable (mytext) VALUES (@mytext)" (or
i make an update),
and i pass the parameter @mytext a simple string, i get NO ERROR and the
database has an new empty row instead of the string which should be there.
mytext is type of "text".
I found out, that this effect only happens if the text is longer than around
900 words... if the text is shorter it works correct.

Does somebody know this problem?

Thanks a lot.
Alex
Feb 2 '06 #1
3 1945
Alex,

In SQL Server char, varchar, nvarchar, etc. fields all have a maximum number
of characters that may be set. This amount may be changed for the field in
question but ther is a limit. If you need to store more characters than the
maximum allowed in the plain text fields then an "ntext" field may be used
to store much more information, but ntext does not store the text the same
way in the field and requires conversion going in and out making it a bit
more difficult a field to work with.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Alexander Widera"
<aw**@hrz.tu-chemnitz.de-novaliddomainpl easedeletethisp art.de> wrote in
message news:ur******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

i connect to a ms sql2000server via SqlConnection.
if i make an SqlCommand "INSERT INTO mytable (mytext) VALUES (@mytext)"
(or i make an update),
and i pass the parameter @mytext a simple string, i get NO ERROR and the
database has an new empty row instead of the string which should be there.
mytext is type of "text".
I found out, that this effect only happens if the text is longer than
around 900 words... if the text is shorter it works correct.

Does somebody know this problem?

Thanks a lot.
Alex

Feb 2 '06 #2
I think text stores (2 ^ 31)(-1) characters ... and ntext "only" (2^30)(-1)
characters...
normally text would be "enough" ... but it doesn't store it.
I tried also ntext ... there is the same problem.

the error is still existing.
"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> schrieb
im Newsbeitrag news:O9******** ******@TK2MSFTN GP11.phx.gbl...
Alex,

In SQL Server char, varchar, nvarchar, etc. fields all have a maximum
number of characters that may be set. This amount may be changed for the
field in question but ther is a limit. If you need to store more
characters than the maximum allowed in the plain text fields then an
"ntext" field may be used to store much more information, but ntext does
not store the text the same way in the field and requires conversion going
in and out making it a bit more difficult a field to work with.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Alexander Widera"
<aw**@hrz.tu-chemnitz.de-novaliddomainpl easedeletethisp art.de> wrote in
message news:ur******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

i connect to a ms sql2000server via SqlConnection.
if i make an SqlCommand "INSERT INTO mytable (mytext) VALUES (@mytext)"
(or i make an update),
and i pass the parameter @mytext a simple string, i get NO ERROR and the
database has an new empty row instead of the string which should be
there. mytext is type of "text".
I found out, that this effect only happens if the text is longer than
around 900 words... if the text is shorter it works correct.

Does somebody know this problem?

Thanks a lot.
Alex


Feb 2 '06 #3
Alexander,

If those fields aren't long enough you will either have to encode and store
the text in a blob field (Search for storing pictures in a SQL Server
database that uses blob fields and storing a text file would be similar), or
you'll need to split the text up into pieces, or another alternative would
be to store the text in a regular file and then store a reference to said
file in the database.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Alexander Widera"
<aw**@hrz.tu-chemnitz.de-novaliddomainpl easedeletethisp art.de> wrote in
message news:Od******** ******@TK2MSFTN GP11.phx.gbl...
I think text stores (2 ^ 31)(-1) characters ... and ntext "only" (2^30)(-1)
characters.. .
normally text would be "enough" ... but it doesn't store it.
I tried also ntext ... there is the same problem.

the error is still existing.
"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com>
schrieb im Newsbeitrag news:O9******** ******@TK2MSFTN GP11.phx.gbl...
Alex,

In SQL Server char, varchar, nvarchar, etc. fields all have a maximum
number of characters that may be set. This amount may be changed for the
field in question but ther is a limit. If you need to store more
characters than the maximum allowed in the plain text fields then an
"ntext" field may be used to store much more information, but ntext does
not store the text the same way in the field and requires conversion
going in and out making it a bit more difficult a field to work with.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Alexander Widera"
<aw**@hrz.tu-chemnitz.de-novaliddomainpl easedeletethisp art.de> wrote in
message news:ur******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

i connect to a ms sql2000server via SqlConnection.
if i make an SqlCommand "INSERT INTO mytable (mytext) VALUES (@mytext)"
(or i make an update),
and i pass the parameter @mytext a simple string, i get NO ERROR and the
database has an new empty row instead of the string which should be
there. mytext is type of "text".
I found out, that this effect only happens if the text is longer than
around 900 words... if the text is shorter it works correct.

Does somebody know this problem?

Thanks a lot.
Alex



Feb 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2234
by: a-ok | last post by:
Hi, My client has a product database od around 20000 items. And it is updated every few days when he gets a catalog from the supplier. It's supposed to work like this: if there already is a product in the database with that ID (primary key), just UPDATE the price, and if there is no product with that ID it should do an INSERT for that item. Now I've tried it in several ways and I can't seem to get it to execute
4
22192
by: DTB | last post by:
I am having trouble creating an INSTEAD OF trigger in SQL Server to replicate a BEFORE UPDATE trigger from ORACLE. Here is a sample of the ORACLE BEFORE UPDATE trigger: CREATE TRIGGER myTRIGGER ON MYTABLE begin :new.DT := SYSDATE; if :new.NM is NULL then :new.NM := USER; end if; end myTRIGGER;
6
61568
by: Karen Middleton | last post by:
In MS Access I can do in one SQL statement a update if exists else a insert. Assuming my source staging table is called - SOURCE and my target table is called - DEST and both of them have the same structure as follows Keycolumns ========== Material
16
17004
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
1
2919
by: Abareblue | last post by:
I have no clue on how to insert a record into access. here is the whole thing using System; using System.Drawing; using System.Collections; using System.ComponentModel;
17
2364
by: NuB | last post by:
I have a sql query that is doing an update of records, how can I add NULL to the field in the database if the field on my screen is blank? example: I have 5 textboxes, and a user can leave some blank, delete data from a text box then hit update, how can I have NULL inserted into the field on the database instead of having a blank record in the db
8
6480
by: SaltyBoat | last post by:
Needing to import and parse data from a large PDF file into an Access 2002 table: I start by converted the PDF file to a html file. Then I read this html text file, line by line, into a table using a code loop and an INSERT INTO query. About 800,000 records of raw text. Later, I can then loop through and parse these 800,000 strings into usable data using more code. The problem I have is that the conversion of the text file, using a...
0
4446
chumlyumly
by: chumlyumly | last post by:
Hello scripters - OS: Mac OSX Language: PHP w/ MySQL database I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The tables are all linked with the field 'member_id', which is an auto-increment field in the parent table ('members'). I've been able to input multiple records into the other three tables 'specialty_groups', 'committee_interest' and 'committee_member'...
0
4052
by: troydixon | last post by:
Hello, I am new at this, and have been trying to insert data into a table by using the footer of a gridview (which I dont like) or by using a detials view on the same page that is doing the following: 1) gets query string from url and filters records (works great) via a Details View 2) shows notes that have been added to the record shown in the details view using a grid view, and it filters the data by looking at the ID that is selected in...
13
8866
by: Terry Olsen | last post by:
I'm using OleDb to connect with an Access Database. I have anywhere from 10 to over 100 records that I need to either INSERT if the PK doesn't exist or UPDATE if the PK does exist, all in a single transaction. Does anyone have an SQL statement I can throw at it that would accomplish this? If I can't figure out how to do it, I'm going to have to send two discreet SQL commands for each record which will take infinitely longer than a...
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.