473,395 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

UPDATETEXT question

I have a question on the UPDATETEXT function (SQL 2000)
The below query works and only updates the record where p.pub_id =
pr.pub_id.
I just don't quite understand why only 1 record is updated when the
UPDATETEXT statement
does not specify anything except pointer value. Is it no possible for 2
rows in a table with a text column to have the same pointer value?
Does this query scan all pr_info in the pub_info table?

USE pubs
GO
EXEC sp_dboption 'pubs', 'select into/bulkcopy', 'true'
GO
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(pr_info)
FROM pub_info pr, publishers p
WHERE p.pub_id = pr.pub_id
AND p.pub_name = 'New Moon Books'
UPDATETEXT pub_info.pr_info @ptrval 88 1 'b'
GO
EXEC sp_dboption 'pubs', 'select into/bulkcopy', 'false'
GO
Also, what is the importance of 'select into/bulkcopy', 'true' ?

Thanks

Feb 21 '08 #1
3 2527
Artie (ar*******@yahoo.com) writes:
I have a question on the UPDATETEXT function (SQL 2000)
The below query works and only updates the record where p.pub_id =
pr.pub_id.
I just don't quite understand why only 1 record is updated when the
UPDATETEXT statement
does not specify anything except pointer value. Is it no possible for 2
rows in a table with a text column to have the same pointer value?
No, that is not possible. You get a text pointer for a specific row,
and then you work with that row.

In SQL 2005 there are new data types for blobs, varchar(MAX), nvarchar(MAX)
and varbinary(MAX). You work with these just like you work with regular
varchar, and no need for the klunky UPDATETEXT. That makes life a lot lot
easier.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 21 '08 #2
Thanks for the info. I am aware of how much easier this is in SQL 2005 but
am stuck with 2000 in this case.
One more if I may...In the example syntax from BOL:

UPDATETEXT { table_name.dest_column_name dest_text_ptr }
{ NULL | insert_offset }
{ NULL | delete_length }
[ WITH LOG ]
[ inserted_data
| { table_name.src_column_name src_text_ptr } ]

I would like to take an extire TEXT column from a source table and append it
to a TEXT column in a destination table.
Do I need to get a start/end textptr from the source?

"Erland Sommarskog" <es****@sommarskog.sewrote in message
news:Xn*******************@127.0.0.1...
Artie (ar*******@yahoo.com) writes:
>I have a question on the UPDATETEXT function (SQL 2000)
The below query works and only updates the record where p.pub_id =
pr.pub_id.
I just don't quite understand why only 1 record is updated when the
UPDATETEXT statement
does not specify anything except pointer value. Is it no possible for 2
rows in a table with a text column to have the same pointer value?

No, that is not possible. You get a text pointer for a specific row,
and then you work with that row.

In SQL 2005 there are new data types for blobs, varchar(MAX),
nvarchar(MAX)
and varbinary(MAX). You work with these just like you work with regular
varchar, and no need for the klunky UPDATETEXT. That makes life a lot lot
easier.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Feb 21 '08 #3
Artie (ar*******@yahoo.com) writes:
Thanks for the info. I am aware of how much easier this is in SQL 2005
but am stuck with 2000 in this case.
One more if I may...In the example syntax from BOL:

UPDATETEXT { table_name.dest_column_name dest_text_ptr }
{ NULL | insert_offset }
{ NULL | delete_length }
[ WITH LOG ]
[ inserted_data
| { table_name.src_column_name src_text_ptr } ]

I would like to take an extire TEXT column from a source table and
append it to a TEXT column in a destination table. Do I need to get a
start/end textptr from the source?
Yes, you would need a text pointer both for the source and target columns.
And you can only copy from one row to another at a time.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 22 '08 #4

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

Similar topics

3
by: First Tracks Research | last post by:
hello, i would like to update a column called footer in a table called agency. i have to update about 60 different records in this table. footer is varchar(200) i would like to search for...
0
by: Dev | last post by:
Hi Fellows, I am trying to write a User Defined Function in SQL 2000 to accept a Parameter of type Text Field and then Do a replace function to manipulate the some strings inside that text data....
3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
7
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
4
by: Dan | last post by:
Hi all, I am creating a search table where the keywords field is made up of several text fields and this is causing me some problems. I can concatentate the text ok but i can't seem to concatenate...
5
by: Zamdrist | last post by:
I need to update/change the text in a table column of data type TEXT. It's a smaller set of records (72) where I need to append onto the end a string of text, the same for all records. I don't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.