Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use the readtext function
Message
 
À
18/03/2006 06:20:10
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01105526
Message ID:
01105556
Vues:
16
>Hi,
>
>I have this issue on SQL2k readtext issue.
>I have some data column in ntext data type.
>I need to read that column and write it into another table column
>of similar data type.
>
>01) However, I cannot find any way to read and store that ntext data
>to some local variable and then write it to my new column.
>The readtext found will read out but I can't feature out
>how to write it to another column through a temporarily variable.
>
>02) Next, for the readtext, we need to give the offset and no of
>byte to read, is there any know method to read all my data from
>colum without specify the size to read
>like readtext ===> test_tbl1.desc @old_ptr 0 datalength(desc)/2 ?
>
>Please advise and help. Thank you
>
>Here is my sample 01)
>
>declare @old_ptr binary(16)
>
>select @old_ptr = textptr(desc)
>from test_tbl1 where emp_no = 12345
>
>readtext test_tbl1.desc @old_ptr 0 0 <---- here is the record value
>
>-- write to a new table of old value
>declare @new_ptr binary(16)
>select @new_ptr = textptr(desc)
>from test_tbl2 where emp_no = 12345
>
>writetext test_tbl2.desc @new_ptr (readtext test_tbl1.desc @old_ptr 0 0) <----- this part is not working

Aren't the direct update doesn't works?
Becuase i have only SQL Server 2005 installed on my home computer I am not sure. Try:
UPDATE test_tbl2 SET Desc = (SELECT Desc FROM test_tbl1 WHERE emp_no = 12345) WHERE emp_no = 12345
That is only for testing, if you are updating many rows the join is the solution (if the direct update works on SQL2K)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform