[thelist] SQL Question - Drop the last charector of a string

Chris at globet.com Chris at globet.com
Mon Aug 7 10:39:12 CDT 2006


Casey

> Ok, Try this before attempting to move everything back...
> 
> UPDATE temp_headings set sub_heading = replace(sub_heading,
> right(sub_heading,1),'') WHERE right(sub_heading,1) = '-'
> ...which basically translates into, "Replace all hyphens at 

[..]

<tip type="Query Analyser">
When running a SQL Server UPDATE query through Query Analyser, ensure
that you wrap it in a transaction block so that in the event of an
error, you can roll it back. For example:

BEGIN TRAN

    UPDATE ...

ROLLBACK
--COMMIT

If you accidentally hit F5, the transaction will automatically roll
back. If after running the BEGIN TRAN statement and the UPDATE statement
everything is copacetic, then you may uncomment and run the COMMIT
statement.
</tip>

-- 
Chris Marsh
Software Developer
t: +44 20 8246 4804 x828
f: +44 20 8246 4808
e: chris at globet.com
w: http://www.globet.com/

Any opinions expressed in this email are those of the individual and not
necessarily the Company. This message is intended for the use of the
individual or entity to which it is addressed and may contain
information that is confidential and privileged and exempt from
disclosure under applicable law. If the reader of this message is not
the intended recipient, you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly prohibited.
If you have received this communication in error, please contact the
sender immediately and delete it from your system. 



More information about the thelist mailing list