Search and Replace within string

Table: CostCenter
Column: CostCenterName

I want to remove all ':' from CostCenterName (update data in table).

How do I do this in T-SQL ?

Thanks,
Greg 


0
Greg
6/25/2010 7:11:03 PM
sqlserver.programming 1873 articles. 0 followers. Follow

2 Replies
444 Views

Similar Articles

[PageSpeed] 54

Greg Berthume wrote:
> Table: CostCenter
> Column: CostCenterName
>
> I want to remove all ':' from CostCenterName (update data in table).
>
> How do I do this in T-SQL ?
>
> Thanks,
> Greg
Use the REPLACE function to replace them with empty strings:

update costcenter
set costcentername=REPLACE(costcentername,':','')
where costcentername like '%:%'

-- 
Bob Barrows 


0
Bob
6/25/2010 7:18:17 PM
Thanks!  Worked perfectly.

"Bob Barrows" <reb01501@yahoo.com> wrote in message 
news:Wh7Vn.2218$sR2.768@newsfe24.iad...
> Greg Berthume wrote:
>> Table: CostCenter
>> Column: CostCenterName
>>
>> I want to remove all ':' from CostCenterName (update data in table).
>>
>> How do I do this in T-SQL ?
>>
>> Thanks,
>> Greg
> Use the REPLACE function to replace them with empty strings:
>
> update costcenter
> set costcentername=REPLACE(costcentername,':','')
> where costcentername like '%:%'
>
> -- 
> Bob Barrows
> 


0
Greg
6/25/2010 7:26:48 PM
Reply:

Similar Artilces:

DataBind Repeater to string[] in ViewData without code behind. MVC 2
Greetings, I'm coming from a WinForms background and diving into ASP.Net. I'm using: C#, VS2010, .Net 4.0, ASP.Net, MVC 2. What I want to do is get a string[] of roles in the controller with: string[] currentUsersRoles = Roles.GetRolesForUser(User.Identity.Name); Then I want to attach this to the ViewData object (also in the controller): ViewData["CurrentUsersRoles"] = currentUsersRoles; Now, in the View I want to bind a Repeater to the array I fed to ViewData. Something like: <asp:Repeater ID="CurrentUsersRoles" runat="se...

Search last 4 digits in an (account number)
I store bank accunt and credit card numbers in various Contact Notes. For example, a credit card # as xxxxxxxxxxxx1234. Outlook contact search would not find this contact if I enter the search for "1234". Is there a way to do this in Outlook 2007? TIA PS - this search works fine in Outlook Mobile. outlook searches from the beginning - so it will only work if you use xxxxxxxxxxxx 1234. Other search tools (like google desktop) may find it. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: htt...

Look for: Search In => Choose folders=> Search subfolders not working
When I search for an old email using Outlook's Look for: box and specify which folders to search in via the "Choose folders=>Search subfolders" checking a folder does not actually cause any subfolders to be checked. Unless there is some other setting and/or option hidden away somewhere, the "Search subfolders" check box is not working. I must manually check all the desired subfolders. What am I doing wrong? -- Regards, Peter Sale Santa Monica, CA USA To email me, just pull 'my-leg.' ...

Search & replace in formulae
Is it possible to do a search and replace which includes the cell formula contents ? I have a workbook that has cells which link to the contents of a cell in another workbook and I'd like to know if the naming has to remain constant or if I can replace a part of the name periodically. ie each year. thanks "Iain Rhodes" <iain@pricejam.com> wrote in message news:8ec201c49682$858c5d20$a501280a@phx.gbl... > Is it possible to do a search and replace which includes > the cell formula contents ? I have a workbook that has > cells which link to the contents of a cel...

Searching for Newsgroups
I subscribe to a Usenet service for accessing various news groups. After I download all the newsgroups from that server I can not find a way to search for the newsgroups I have interest in. When I put something like "RV" in the search box on the top right corner, it searches all of my Emails rather than just the list of groups that had "RV" in the title. Help tells me that there is a " Display newsgroups containing" box but for the life of me I can't find it. Any thoughts out there? I am running Entourage 12.2.3 Dunc Click the bar in th...

Search engine optimization
Hello all! My question today regarding this issue is: I have noticed some sites have the following on their sites "Source". meta name= "robots" content="Index, follow" meta name= "revisit-after" content="15 days" or (30 days) What does this function accomplish as far as search engines go? and will it really imporve your results ( rankings) Like for instance "robots" "index, all" what is the difference between this and saying "robots" "index, follow" I'm a bit confused about this. Can someone ...

Can I search identical fields from multiple tables?
I have a database to log details about staff in my school. I have a tables for staff details, courses, absence, educational visits etc. In each table I have a date field to show when the member of staff is not present. I want to produce a query to search all tables by entering a date - e.g. to bring back all results for staff who are not in school on a certiain day because they are either ill, on a course or on an educational visit. The query will work by entering a date once - it will then search all the other tables and bring back the results. Is this possible? Do I restructure? ...

Format a concatenation string?
Is there a function to format a concatenation string eg 79.5% & " were recorded" comes out as .795 were recorded when using =cell ("contents", a1) & " were recorded" Would like it to be 79.5% were recorded. Can anyone help? Thanks Hilton Try this: =TEXT(A1,"00.0%")&" were recorded" Hope this helps. Pete On Jun 19, 9:37 am, "Hilton" <get_chatt...@hotmail.com> wrote: > Is there a function to format a concatenation string eg > > 79.5% & " were recorded" comes out as .795 were recorded w...

selecting gp company within crystal at run-time
I'm using GPv8 and Crystal 10(?). I have a report in Crystal that I want to be able to run against any of our multiple company databases in GP. For example, I want one of the parameters the user would enter to be "Select Company". How can I do this? Right now I have multiple versions of the report saved, with each pointing to a different SQL Server Database. Thanks, Rob Post your email address and I will send you a sample code which will let you process data from a selected company. I had to do it for myself to create a Consolidated Historical Trial Balance Report...

What does outlook search when you search Contacts ?
When you do a search in oulook for contacts, what is the criteria that outlook searches? Or I guess how does outlook search? Why is it not consistant? The reason I am asking is that we have our customers contacts in public folders. In our customers we have 6 contacts for XYZ Foods. If you search in outlook for just "XYZ" it only comes back with 4 of the six. If you do a search for "XYZ Foods" it returns with all 6. And if you just entered "Foods" no contacts were found. And we actually have a few companies in our contacts who's names are a two part name ending...

excel VBA
How would i search a range of a whole column instead of specific cells like .Range("a1:a300")? --- Message posted from http://www.ExcelForum.com/ ..range("a:a") ..columns(1) ..range("a1").entirecolumn are a few ways. "Zygoid <" wrote: > > How would i search a range of a whole column instead of specific cells > like .Range("a1:a300")? > > --- > Message posted from http://www.ExcelForum.com/ -- Dave Peterson ec35720@msn.com ahhh! Thanks!! I was trying .Column(1) i see i neede an "s" in there Thanks a...

Multiple fields using to search
Hi, Something i've been batteling for weeks with and theres probably such a simple answer to it and i just cant see it: Riiiight, i have this form (lets call it frmClientSearch) On this form i have a 2 list box thinghys; One called lstEmployee which is populated with Employee names and the other lstCity which is populated with City Names. Then i have a command button (cmdSearch) which, once click and values selected in both the lst boxes, should return only the values that are equal to both the lst boxes in a new form called frmSearchResult. (Hope i make sense) So... I know how ...

Search, Search, Thanks
In the last couple of weeks I have been fighting with different ways o synching my laptop and my home pc. I have ended up with numerou duplicate entries, duplicate address books and duplicate contact lists ALL of my questions/problems I was able to resolve simply by searchin through the forums. Chances are if you have a problem you're not th first. There are some really good people on these forums that know alo more about Outlook than I do. Just my .02 Thank ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages dir...

Display search results
Using OneNote 2010 Beta: file tabs are on the left; how can I make search result tabs appear on the right? Now they don't appear at all: the first search result is displayed in the middle of the screen (that's fine) but no way to move to the next search result, nor any way to scrool them all the search results. I'd like to see all the search result tabs listed on the right so I can choose the one I want (as was the case with the version of OneNote that got replaced by 2010 beta). Many thanks for any help. -- CH I can't really visualize what you want, but h...

how to find and replace a symbol in my worksheet
I need help with finding and then replacing a symbol in my worksheet. In the find and replace box there is no way to insert a symbol there. I have tried to cut and paste as well as to insert the symbol in the find box. If anyone has an idea on how to replace a bullet with a comma please let me know. Thanks TC TC In the Replace What: box you would hold down the ALT key then hit the ascii code number on the NumPad. Bullets are usually ALT + 0149 So.........select the cells. Edit>Replace what: ALT + 0149 you will not see anything in the what: box, but it is there. with: , Replace...

SUMIF with only one criteria cell within range
I need to use SUMIF to calculate a subtotal of column B based on the criteria of column A. The problem is, the column A has names of group in every 10th cell or so, and column B has many repeated numbers which could vary month to month. Example) Col A Col B group A a b c group B a b c d I need subtotals for group A & B, even when group A has "d" listed in Col. B in other months. Please help. Thanks. Stan Hi it would be much easier if you could fill...

Including imap folders in outlook 2003 search folders
Dear all, Is it possible to include imap accounts/folders as providers for "virtual" search folders in outlook 2003? At the moment, I only see the option to check folders in my personal folders but not to include imap folders. The reason that I ask is that I would like to be able to get a complete view of follow up tasks across all my accounts (1 pop3, 2 imap and 1 hotmail). Only the pop3 account gets delivered into the personal folders and is included in the follow up a nd unread search folders. Thanks for your help in advanced. Raj ...

Search Form Problems
I have a form that has two fields in it. The first field is for a ID number, and the other is for the projects name. I am having a problem with using the form for as a search tool. Some of the values are duplicates in the drop down, I wanted to know how to properly filter the combo box so that the values can only be seen once. The Row Source is the name of the table that the fields are from, however this only words for the ID combo box and not the project name one. For some reason the values are from the ID column in the project name's combo box as well. To counter this problem, I si...

Search
Is it possible to search on the results on a cell? For example, a cell may have a formula such as =3+5 You can search and find the 3 or the 5. The cell with show 8, is it possible to search for an 8 and have it find this cell? TIA Yes. In the Search dialog, choose Options and select Look in Values. -- Kind Regards, Niek Otten Microsoft MVP - Excel "berj" <berj@adelphia.net> wrote in message news:WbednSOFT7Cbp57fRVn-1Q@adelphia.com... > Is it possible to search on the results on a cell? > > For example, a cell may have a formula such as > > =3+5 >...

Search
How can I search for a phrase within thousands of documents 2003 search I searched for "Trust" in document name and "special needs" within document -- Irritated 2007 Word User You could do that by modifying the code in the article "Find & ReplaceAll on a batch of documents in the same folder” at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm probably in combination with the code in the article "Insert into a document the names of all files in a selected folder” at: http://www.word.mvps.org/FAQs/MacrosVBA/InsertFileNames.htm ...

Topic: Strings Separate and Extensions
Dear all,This has to be simple but something I am doing wrongI have a Tbl called TempData_Tbl with more than 10000 recordsI want to separate the string before the space, the File name and theextensionIn order to update them (separately) in the same Tbl in other fieldnamesThe string before the space does not have the same length(d4bd504fb63bd00454296a65d283a94c), I only can do this using somehowThe Chr Function (32) or " " but my code is not working this is myfirst problemThe second is that some files names has 2 extension (.zip.log) I knowhow to use InStrRev Function but I do not kn...

search
Why is it when I search (for a posting I listed) I never get any hits. I know I posted a message. I even search for a message on the screen and get nothing. mvestel@lbl.gov Sorry, that's not enough info. It should work if the parameters are configured correctly. Can you be more specific about how it fails? "Michael Vestel" <anonymous@discussions.microsoft.com> wrote in message news:45bb01c39f70$922026c0$7d02280a@phx.gbl... > Why is it when I search (for a posting I listed) I never > get any hits. I know I posted a message. I even search > for a message on ...

Search for record which needs two search terms
I have a table where the records are uniquely identified by a combination of two fields ChildAOLTermID and PhotoID. I want to use a combo on a form to look up records in the table. In the AfterUpdate event: DoCmd.SearchForRecord , , acFirst, "[ChildAOLTermID] = " & Me.cboFindRecord.Column(0) works but doesn't get me to the precise record I need because the PhotoID side of the record is not being specified. However, if I add that so that the search looks like: DoCmd.SearchForRecord , , acFirst, "[ChildAOLTermID] = " & Me.cboFindRecord.Column(0) And "[Phot...

Search
Can anyone tell me how to search across all worksheets in a workbook? I have a viewing diary with a sheet for every day of the month and it would really help if we could search the whole workbook for a name. Many thanks Michele Hi Michele Slect all sheets first. It's done this way: Click sheet tab of the first sheet. Hold Shift button and click the the last sheet tab. Now search. -- HTH. Best wishes Harald Excel MVP Followup to newsgroup only please. "Michele" <mjh1606@aol.com> wrote in message news:011301c35926$07b30d30$a301280a@phx.gbl... > Can anyone tell m...

Advanced Searches of Email in Outlook
Good Morning: I am in the middle of an email audit and I am trying to do searches that meet certain guidelines. An example of a search would be: The searches are like this Frequent within 10 words of Trad* Excessive with in 10 words of Employee Any help would be great. Cheers Darren ...