Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

How to Delete Right 3 Characters from a string Expand / Collapse
Author
Message
Posted Friday, July 22, 2011 4:57 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 11:14 AM
Points: 21,385, Visits: 9,603
Jeff Moden (7/22/2011)
Gah... I've got to learn to read the rest of the posts first. Tow other folks basically said the same thing.



I would point out the obvious that there's a reason you're #1 non employee-poster. But that's been said already .
Post #1146993
Posted Saturday, July 23, 2011 12:21 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 7:56 PM
Points: 36,775, Visits: 31,230
Ninja's_RGR'us (7/22/2011)
Jeff Moden (7/22/2011)
Gah... I've got to learn to read the rest of the posts first. Tow other folks basically said the same thing.



I would point out the obvious that there's a reason you're #1 non employee-poster. But that's been said already .


BWHAA-HAAA!!!! And the pot calls the kettle black.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1147101
Posted Saturday, July 23, 2011 3:42 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 11:14 AM
Points: 21,385, Visits: 9,603
Jeff Moden (7/23/2011)
Ninja's_RGR'us (7/22/2011)
Jeff Moden (7/22/2011)
Gah... I've got to learn to read the rest of the posts first. Tow other folks basically said the same thing.



I would point out the obvious that there's a reason you're #1 non employee-poster. But that's been said already .


BWHAA-HAAA!!!! And the pot calls the kettle black.


Here you go, 3 free points. Tx for closing my case .
Post #1147138
Posted Saturday, July 23, 2011 5:12 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 7:56 PM
Points: 36,775, Visits: 31,230
Ya know, Remi... I thought you were just joking.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1147156
Posted Saturday, July 23, 2011 7:41 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 11:14 AM
Points: 21,385, Visits: 9,603
Jeff Moden (7/23/2011)
Ya know, Remi... I thought you were just joking.



Of course I am. Why would you think otherwise .
Post #1147169
Posted Sunday, July 24, 2011 6:17 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, January 31, 2012 2:27 PM
Points: 5, Visits: 14
Fair enuff. In the scenario I was using it I wanted to get rid of 3 letters that had been added to a file number e.g
CaseCode: 1017856AVN.
In database wanted to link it to the file number & file type were in separate columns i.e.
Case number: 1017856 Case type: AVN
So to get CaseCode in 1st DB to match Case number in 2nd DB Kingston's REPLACE worked fine.
Post #1147202
Posted Sunday, July 24, 2011 6:22 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 11:14 AM
Points: 21,385, Visits: 9,603
andrew.sugden (7/24/2011)
Fair enuff. In the scenario I was using it I wanted to get rid of 3 letters that had been added to a file number e.g
CaseCode: 1017856AVN.
In database wanted to link it to the file number & file type were in separate columns i.e.
Case number: 1017856 Case type: AVN
So to get CaseCode in 1st DB to match Case number in 2nd DB Kingston's REPLACE worked fine.




All we said is that it can delete the wrong data with replace. Left is clear as day. Whack the last 3 characters and most importantly, it cannot fail.
Post #1147203
Posted Sunday, July 24, 2011 10:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, January 31, 2012 2:27 PM
Points: 5, Visits: 14
I know. That's why said fair enuff.
Post #1147217
Posted Sunday, July 24, 2011 10:13 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 8:33 AM
Points: 2,616, Visits: 4,720
Jeff Moden (7/22/2011)
Sugsy (7/22/2011)
Just for the record Kingston's suggestion works fine n'all


Just for the record, it will also delete the wrong data if the right 3 occurs more than once in the string. Don't use it.

(Sorry, Kingston)


This post is more than a year and a half old. When I saw it today, I was like "Why did i post that?". I will not give a similar reply today for sure. I hope I am more mature now and I am not a quick fix developer anymore who gives quick fixes which can prove nasty, thanks mainly to people like you in SQL Sever Central.

And Jeff, I also remember you giving me firing for giving a similar sort of quick fix earlier. I didn't feel bad a single bit even that day. Keep them coming. I would love to be corrected.

Once again, thanks Jeff.



Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1147292
Posted Monday, July 25, 2011 4:58 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 7:56 PM
Points: 36,775, Visits: 31,230
Kingston, you're the consumate gentleman and a dedicated programmer. I'd work with anytime. Thank you for the feedback.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1147393
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse