Sunday, March 25, 2012
Delete a Substring
I need to delete the first ten characters from a field, I don't know how to write this query to allow me to do so.update table
set COLUMN = LTRIM(NAME, SUBSTR(COLUMN, 0, 10));|||UPDATE conitemdescrip
SET descrip= LTRIM(descrip,SUBSTRING(descrip,0,10));
Msg 174, level 15 State 1
the function 'ltrim' requires 1 argument
Suggestions?|||You are using MS SQL Server 2000.
update table
set column = Right(column, Len(column) - 1)
- From Visual Basic|||No, I am using
SQL 6.5...sql
Friday, March 9, 2012
DEFINITIVE ANSWER PLEASE -- can you UPDATE ntext datatype field??
column.
My ntext field will exceed 8,000 characters (typically twice that size
-- but just a text string).
One article (I think from MicroSoft) said you could NOT use ntext in
an UPDATE statement, but I've seen examples from other people using
it...but don't know if it's related to the size/characters issue.
Is this true or not?
Thanks very much...KathyKathyB (KathyBurke40@.attbi.com) writes:
> One article (I think from MicroSoft) said you could NOT use ntext in
> an UPDATE statement, but I've seen examples from other people using
> it...but don't know if it's related to the size/characters issue.
Yes, you can update an ntext column directly in an UPDATE statement.
I dont think there is a limitation, but it may be unpractiable if
you have a string which is million characters long.
There is also UPDATETEXT which permits you change parts of an ntext
column, but this function is certainly more complex to use, so as long
as you can do it with plain UPDATE stay with it.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Thanks, Erland, that's what I wanted to hear!
I don't need to save a million, just up to 50,000!
Kathy
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!