How to replace only the first specified character in a string and leave other occurrence of the character alone.
Hello my Friends:
I have a string that looks like this in a column:
Hello, World, Hello, Planet
I want to replace only the first occurrence so that the result looks like this:
Hello World, Hello, Planet
Working on some bad data source.
I need to replace the character regardless of it's location as long as it is the first.
I tried something like this, but I soon discovered that if the comma or character is missing the the string may get truncated or altered. If there are no characters in the string, then I want to simply leave it alone.
Here is where I am at:
DECLARE @MyValue NVARCHAR(MAX) = 'Hello, World, Hello, Planet';
SELECT MyString = STUFF('Hello, World', CHARINDEX(',', @MyValue, 0), 1, ' ');
Thanks my friends.
I have a string that looks like this in a column:
Hello, World, Hello, Planet
Why doesn't it say Hello Kitty?
Oh, sorry about that. Anyway:
SELECT MyString = CASE WHEN CHARINDEX(',', @MyValue, 0) >= 1
THEN STUFF(MyString, CHARINDEX(',', @MyValue, 0), 1, ' ')
ELSE MyString
END;
Erland Sommarskog, SQL Server MVP, [email protected]
Erland, love you sense of humor!! :)
Thanks for the solution.
Similar Messages
-
Pressing "shuffle" on my 7th gen Nano will only randomly pick the first song, then repeats it over and over. How do I get "shuffle to work properly?
Is "REPEAT ONE" highlighted. If it is, touch it to de-select. Cheers!
-
I have photos on my iPad (the first apple device in our household) and then added an iMac and a Macbook air to our network. We have an airport 2TB back up device. How do I get all of my photos on all devices. My original iPad has images that my 2 newer devices do not have on iphoto.
My original iPad has images that my 2 newer devices do not have on iphoto.
How are the images stored on your original iPad? Are they in the camera roll, in events downloaded using the camera connection kit, or are they in albums synced to your ipad from a computer?
If the photos are in the camera roll or in events downloaded from a camera, you can transfer them to your iMac and MBA by directly connecting the iPad using USB. Then you can download the photos to iPhoto like from a camera.
Only, if your photos have been synced to the iPad from a computer, you will have to save them first to the camera roll; then you can download them by connecting the iPad via USB.
What IOS version has your iPad?
For new photos you might consider using Photo Stream to transfer your photos between the devices.
See: iCloud: Photo Stream FAQ
iCloud: Using and troubleshooting Shared Photo Streams
-- Léonie -
In Contacts version 8, how can I print ALL information in each individual card? When I select the print command the only thing printed is the name and address. I need phone number(s) and all other information in the cards. We enter various pieces of data, other than the standard name address & phone numbers and we print all information on each card so it fits in a 5x7 inch loose binder. We have used InTouch software for many years and it has served us extremely welll, however, the publisher (The Prairie Group) has not, and apparently has no plans to update their software to be compatible with any Mac OSX OS beyond 10.6. Any help will be appreciated!
You can select what you want included in a list format. In the Print command from Contacts, click the Show Details button. Then in the Style pulldown menu select "Lists" and there you'll be able to select what you want included. You can also select what you wish included if you select the Pocket Address Book style.
If neither of those options will work for you, then you will need to look to third-party software. Here's one possibility that seems to get good reviews:
https://www.macupdate.com/app/mac/15485/labels-&-addresses
I haven't done more than try it to make sure that it works with OS X 10.9's Contacts, which it does, but you can download their demo and try it yourself.
Regards. -
i plugged my iphone in for the first time to my itunes account and it now reads that this device is already associated with an apple id. what does that mean. i only have one apple id. and do i chose cancel or transfer?
Hello there, Shellywms09.
The following Knowledge Base article points out why you are receiving that message on your iPad:
iTunes Store: Associating a device or computer to your Apple ID
http://support.apple.com/kb/ht4627
Thanks for reaching out to Apple Support Communities.
Cheers,
Pedro -
HOW DO I SEND AN EMAIL ON MY IPHONE OR IPAD AND MAKE IT APPEAR ON THE MAIL APPLICATION ON MY MAC? IT ONLY WORK THE OTHER WAY ---SENDING AN EMAIL ON MY COMPUTER ---APPEARS IN SENT ITEMS ON MY IPHONE AND IPAD.
IT IS FOR GMAIL.
-
How to fix this error "this iPad is not able to complete the activation process. Please press Home and start over. If the issue persists, please visit your nearest Apple Store or Authorized service provider for more information or replacement"? When I plugged in my iPad this popped up!
Hi csreddy,
If you are receiving a message to contact an Apple Retail Store or Authorized Service Provider for help updating from iOS 3, click on the link below to initiate that support:
Update the iOS software on your iPhone, iPad, and iPod touch - Apple Support
http://support.apple.com/en-us/HT204204
Update your device using iTunes
If you can’t update wirelessly, or if you want to update with iTunes, follow these steps:
Install the latest version of iTunes on your computer.
Plug in your device to your computer.
In iTunes, select your device.
In the Summary pane, click Check for Update.
Click Download and Update.
If you don't have enough free space to update using iTunes, you'll need to delete content manually from your device.
Find out what to do if you get other error messages while updating your device.
Last Modified: Jan 12, 2015
Apple - Find Locations
https://locate.apple.com
Contact Apple for support and service - Apple Support
http://support.apple.com/en-us/HT201232
Regards,
- Judy -
How do you suppress page numbers. I am trying to print a screenplay for the first time since switching to Pages and I can't suppress Page #1 without making the rest of the pages inaccurate, as page #1 is the Title Page. Does anyone have any suggestions?
When you signed to be able to post in the forums, you were urged to read and accept the Terms of Use ruling these forums.
They claim :
The contents of the "More Like This" box prove that applying the rules you would have get the wanted explanations without creating this new thread.
Yvan KOENIG (VALLAURIS, France) mardi 26 avril 2011 10:04:03 -
I have a new Macbook Air, 6 months old, and for the last few days the fan had run continuously, this is the first time it has ever run, and now it won't stop, the fan starts up as soon as I turn it on and the computer seems to running more slowy.The computer is not hot but I am worried it may burn out,.Any ideas on how I can fix this please ?
Hello dwb,
Here is the screen shot, just the top half, there are another 10 pages, but I guess this should enough for you to have an idea of waht is going on, bit small I am afraid. No, I don't have any apps setup to run when I open my computer, the kernel, varies between 290 and 305 per cent ish.
Would that PRAM thing help ? I think it may be the computer itself, well something inside, as this the first time that the fan has ever started running since I have this computer, even when I have 3 or 4 apps running.
Thank you again for your advice,
Regard,
Beauty of Bath -
Applications are mentioned free, but when we start downloading one dollar is charged in my credit card, but only for the first time when i switch on and use it for the first time one dollar is charged. and from next application it is free. why?
Kindly inform any email id or toll free number to contact apple for your below answer, Mr.King_Penguin
About receiving my credit card being debited for Free App Store Application downloads,
It should be within a few days, but it might vary a bit by bank/provider :
I am in India, if the bank don't refunds , what to do?
Rajagopal.pngr :- It is only a holding charge, it is not a permanent charge. If it isn't refunded within a few days or so (and it quite possibly won't be over a weekend) then you can query the charge with Apple. -
My laptop had water spilled on it 3 days ago, I let it sit as instructed by best buy . I am on it right now but the mouse movement isn't smooth anymore and it is slower. The first time I turned it on it didn't respond at all,can anyone tell how bad the damage really is without actually seeing it ? Do you think maybe it will be just a simple repair or am I looking at a whole new logic board?
Until you take it in so that a technician can look at it, it is all guessing and nothing more.
Allan -
I need in more lines of the Index some words in Bold text and some others in Kursiv text. How can i get it? It seems to me that either I can edit a Style only in Bold Text or in Kursiv Text
I make you an example to clear what I really need:
Index
Introduction
I. Leonardo's Monnalisa
II. Leonardo's Battaglia
Bibliography
Please HELP HELP HELPWhat version of Pages are you referring to?
Basically if you are talking about the Table of Contents in Pages and want to have different character styles within paragraphs in the T.O.C. you will have to export the T.O.C. and bring it back in as text and change that.
Peter -
the first time you create account, always need a credit card? the option of "NONE" is hidden
my friend cant download apps, because of that reason.No you don't always need to enter credit card details, it just depends upon how you create the account - unless the instructions on this page are followed when creating a new account : http://support.apple.com/kb/HT2534
then you will need to entercredit card details will need to be entered before the account can be used to download any item from the store.
If you don't have or don't want to enter credit card details then you will need to create a new account, and this time use the instructions on that HT2534 page when creating it. If you want to use the same email address then you will need to replace it on that account first e.g. by logging into it via the Store > View Account menu option on your computer's iTunes or via http://appleid.apple.com
Creating an account with 'none' via a computer's iTunes : https://discussions.apple.com/message/24321860 -
I purchased a game on my ipod touch. I restored the device to factory settings last night and when I synced all the apps back, the game is now in the demo version. How do I unlock it ? I hope I don't need to pay for the full version again.
PES 2012 is no longer available in the US App Store and only on the British App Store currently.
http://pes-2012.en.softonic.com/iphone
That (an app no longer available) happens sometimes.
Your only way is if you have the appt on your computer such as in the recycle bin/trash or in a computer file backup. In that case move it to your iTunes library and sync. -
How do I get the Itunes Music Library to stop showing and asking me to purchase the songs I have drug in for playlist?
If I make a playlist of my favorite Sax players by dragging there songs from their homepage into my playlist not purchasing them. Those songs appear along side my regular songs in my overall music library with option to buy them. The only way to get rid of them in my Music library seems to be to delete the playlist.
Maybe you are looking for
-
Running Logic in 64-bit but what about Snow Loepard?
Hi all, I am wondering what the benefit is of running Logic in 64-bit if you only run Snow Leopard in 32-bit. Is there better performance when you run both Logic and the OS in 64-bit?
-
Bouncing .mac mail off webmail
I'm using a company email address (@pillensfarm.com) as my main email but its linked to my .mac mail via a webmail service. I've made no changes to my account and now mac mail is suddenly not being forwarded from the webmail service. I'm receiving my
-
Tethered Capture issue, LR 5 and Canon 7D Mk II
When I connect the camera and start TC I get the connect message and then a no camera detected, flashing back and forth about once a second -- regularly. LR/ACR is up to date and reads and downloads the files fine. Same thing on 2 computers. Wonde
-
SD Revenue Recognition-Account settings for deferring COGS
Hi Experts In the current process, COGS, cost of goods sold is getting posted into the COGS G/L account, while creation of billing document. In VF44 transaction, we find option for VPRS cost being captured against every line item & are available for
-
Can I keep HTML format in a resource bundle -properties file? Anybody has expirience?