Query to find and Update

hi,
Can anyone please provide me a query to find out names having " , " commas like servi,ce actually I have a service name column in a table where i need to find names with commas "," and remove by update.
I appreciate, if anyone provide me query to find those services having commas in between and a separate update statement to remove them
Thanks in advance for your cooperation
Regards,
ahon

hello
used the sql command REPLACE & INSTR function
example :
Query :
select service_name
from YOURTABLE
where instr(service_name,',') > 0 -- This return those with ',' char
to update :
update YOURTABLE
set service_name = replace(service_name,',','') -- to replace the ',' char to null values
where instr(service_name,',') > 0
But before doing that back up your table or do it in a copy of that..
Syntax
REPLACE ( string_expression , string_pattern , string_replacement )
Arguments
string_expression
Is the string expression to be searched. string_expression can be of a character or binary data type.
string_pattern
Is the substring to be found. string_pattern can be of a character or binary data type. string_pattern cannot be an empty string (''), and must not exceed the maximum number of bytes that fits on a page.
string_replacement
Is the replacement string. string_replacement can be of a character or binary data type.
charles.
if this find helpful or correct then mark it accordingly

Similar Messages

  • Query to find duplicates, update appropriately, delete one of those duplicate

    I have duplicate rows in below given table and need to cleanse it by observing another duplicate record.
    I'd like to know various ways to achieve it. (I'm confused I should use UPDATE.. (CASE WHEN.. THEN).. or MERGE or something else)
    Please find below DDL/DML.
    create table MyTable
    PKey int identity(1,1),
    CustID int,
    FirstName varchar(10),
    LastName varchar(10),
    Main varchar(10),
    Department varchar(10)
    Insert into MyTable
    select 101, 'aaa','bbb','VM','Marketing' union
    select 101, '', '','','' union
    select 102, '', 'yyy', 'Main', 'Marketing' union
    select 102, 'xxx','','','' union
    select 103, 'ppp', 'qqq', '', 'HR' union
    select 103, '', '', 'MF', '' union
    select 104, 'mmm', 'nnn', 'f', 'dept'
    select * from mytable
    --PKey CustID FirstName LastName Main Department
    --2 101 aaa bbb VM Marketing
    --3 102 xxx yyy Main Marketing
    --6 103 ppp qqq MF HR
    --7 104 mmm nnn f dept
    Cheers,
    Vaibhav Chaudhari

    Hi Vaibhav,
    Manu's has copied as a part of the below code.
    create table MyTable
    PKey int identity(1,1),
    CustID int,
    FirstName varchar(10),
    LastName varchar(10),
    Main varchar(10),
    Department varchar(10)
    Insert into MyTable--(CustID,FirstName,LastName,Main,Department)
    select 101, 'aaa','bbb','VM','Marketing' union
    select 101, '', '','','' union
    select 102, '', 'yyy', 'Main', 'Marketing' union
    select 102, 'xxx','','','' union
    select 103, 'ppp', 'qqq', '', 'HR' union
    select 103, '', '', 'MF', '' union
    select 104, 'mmm', 'nnn', 'f', 'dept'
    SELECT * FROM MyTable;
    ;WITH cte AS
    SELECT DISTINCT
    MAX(PKey) PKey,
    CustID,
    MAX(FirstName) AS FirstName,
    MAX(LastName)AS LastName,
    MAX(Main) AS Main,
    MAX(Department) AS Department
    FROM mytable
    GROUP BY CustID
    MERGE mytable AS Tar
    USING cte AS Src
    ON Tar.PKey = Src.PKey
    WHEN MATCHED THEN
    UPDATE SET Tar.CustID = Src.CustID, Tar.FirstName = Src.FirstName,Tar.LastName = Src.LastName, Tar.Main = Src.Main,Tar.Department = Src.Department
    WHEN NOT MATCHED BY SOURCE THEN
    DELETE
    SELECT * FROM MyTable
    DROP TABLE MyTable;
    If you do care about the Identity Pkey, as per the expected output, my understanding on your logic is like below.
    ;WITH cte AS
    SELECT PKey, CustID,V1,V2,V3,V4,ROW_NUMBER() OVER(PARTITION BY CustID ORDER BY v1+v2+v3+v4 DESC) AS RN
    FROM MyTable
    CROSS APPLY(SELECT CASE WHEN FirstName ='' THEN 0 ELSE 1 END AS v1) AS cat1
    CROSS APPLY(SELECT CASE WHEN LastName ='' THEN 0 ELSE 1 END AS v2) AS cat2
    CROSS APPLY(SELECT CASE WHEN Main ='' THEN 0 ELSE 1 END AS v3) AS cat3
    CROSS APPLY(SELECT CASE WHEN Department ='' THEN 0 ELSE 1 END AS v4) AS cat4
    ,cte2 AS
    SELECT DISTINCT
    CustID,
    MAX(FirstName) AS FirstName,
    MAX(LastName)AS LastName,
    MAX(Main) AS Main,
    MAX(Department) AS Department
    FROM mytable
    GROUP BY CustID
    ,cte3 AS
    SELECT c2.CustID,c2.FirstName,c2.LastName,c2.Main,c2.Department,c.PKey FROM cte2 c2 JOIN cte c ON c.CustID = c2.CustID WHERE NOT EXISTS(SELECT 1 FROM cte WHERE RN<c.RN)
    MERGE mytable AS Tar
    USING cte3 AS Src
    ON Tar.PKey = Src.PKey
    WHEN MATCHED THEN
    UPDATE SET Tar.CustID = Src.CustID, Tar.FirstName = Src.FirstName,Tar.LastName = Src.LastName, Tar.Main = Src.Main,Tar.Department = Src.Department
    WHEN NOT MATCHED BY SOURCE THEN
    DELETE
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Query to find Last updated..

    Hi all,
    If I have a table with accounts, users and last_on_date, how can I find the user who accessed an account most recently.
    Say, the table is as follows:
    a/c user c_date
    a1 u1 03/04/2007
    a1 u2 03/05/2007
    a2 u3 03/05/2007
    a2 u1 03/07/2007
    a2 u2 03/06/2007
    a3 u3 04/05/2007
    What query would fetch the following:
    a/c user c_date
    a1 u2 03/05/2007
    a2 u1 03/07/2007
    a3 u3 04/05/2007
    Any help is appreciated.

    That's only part of the OP's Q.
    The OP asked for the most recent user of a particular account not the most recent access of each user to each account.
    so this would do the trick:
    SELECT AC,
           USER,
           C_DATE
    FROM (SELECT AC,
                 USER,
                 C_DATE,
                 ROW_NUMBER() OVER (PARTITION BY AC ORDER BY C_DATE DESC) RN
            FROM YOUR_TABLE)
    WHERE RN = 1;

  • Trying to find a Program that locates and updates your songs and albums??

    Does any1 know of a program that Finds and Updates Information about Your songs and Albums. These are the Songs and albums that have already been on my PC and not have been purchased on Itunes

    In the detailed help for the event structure there is a link to caveats and recommendations for using event structures.  It is a good starting point.
    It is courteous to let the Forum know when your questions are related to a school assignment or homework.  We are glad to help you learn LabVIEW, but do not do your homework for you.
    You have learned the major disadvantage of the sequence structure: It must run to completion before anything else can happen.
    If you are building a state machine (typically a while loop with shift registers enclosing a case structure with one case per state) and having trouble with timing, then think about your requirements. Apparently you have some time delays, but under certain conditions you must terminate a delay/wait and do something else.  One way of doing this is to have a Wait state.  The wait state has a short delay, determined by the minimum time you can delay responding to a changed condition, and a check to see if the required elapsed time has occurred.  If the time has not elapsed, the next state is the Wait state again.  The state machine can repeat any state as often as necessary.  So a 15 second delay could be implemented by going to a Wait state with a one second wait 15 times. Any error or new command will see a response in no more than one second.
    Lynn

  • Find All INSERTs and UPDATEs

    Hi All;
    I want to find out all inserts and updates of a spesific table. For instance a package l,ke that
    CREATE OR REPLACE PACKAGE BODY param_test IS
      PROCEDURE ins_test IS
      BEGIN
    insert INTO parameter_value VALUES (2);
        INSERT INTO parameter_value VALUES (9);
        INSERT  INTO
        parameter_value VALUES (4);   
        insert INTO parameter_value VALUES (54);
      END ins_test;
    END param_test;I am querying user_source view. My query is below.
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    Connected as SYS
    SQL> SELECT us1.NAME, us1.line, us1.text
      2    FROM user_source us1,
      3         (SELECT us2.line, us2.NAME, us2.text
      4            FROM user_source us2
      5           WHERE regexp_like(upper(us2.text), '[[:space:]]*PARAMETER_VALUE[[:space:]]*')) us3
      6   WHERE us3.line - 1 = us1.line
      7     AND us1.NAME = us3.NAME
      8     AND regexp_like(upper(us1.text), '[[:space:]]*(INSERT[[:space:]]*INTO|UPDATE)[[:space:]]*')
      9  /
    NAME                                 LINE TEXT
    PARAM_TEST                              9 insert INTO parameter_value VALUES (2);
    PARAM_TEST                             12     INSERT  INTO
    SQL> My question is "Are tehre any solutions to overcome this situation?"
    Kindly Regards...

    You might be better off combining into your attack the use of user_dependencies. This will tell you what objects e.g., code is dependent on your table and then you can search the source of those modules for inserts and updates into the table. Even then you'll never be sure, especially if dynamic SQL is used as the statement may be pieced together from various bits if strings, as then user_dependencies won't contain the reference.

  • Query to find all the view name and their size in GB

    Hi,
    What is the query to find all the view name and their size in GB.I am aware of joining all_views and user_segments but this is not serving the purpose.is there any table i need to join to get the desired result
    Thanks

    You could of course be thinking of views as they are stored in other RDBMS' as some of them actually create the view as a table on the database with a copy of the data in it and maintain that data as the base tables are updated.
    As already mentioned, Oracle just stores the SQL of the View and executes that SQL when the view is queried.
    Alternatively, Oracle also has "materialized views" which are created as snapshots of the data and will have a size. This data is updated (refreshed) based on the parameters used when creating the materialized view which means that it will either be, commonly, when a commit is issued or when a refresh is explicitly requested (refresh on demand).

  • Can anyone give me query to find  in SSHR 1) No. of Changes(Personal Info Update) Requested 2) No. of Processed Requests

    Dear Experts,
    Can anyone give me query to find  in SSHR 1) No. of Changes(Personal Info Update) Requested 2) No. of Processed Requests
    1) No. of Changes(Personal Info Update) Requested
    select COUNT(*)
      from hr_api_transactions
    where process_name like 'HR_PERSONAL_INFO_JSP_PRC'
       and creation_date between '01-JAN-2014' AND '31-DEC-2014';
    How do know whether they were processed successfully
    where to see the meaning of Status column of HR_API_TRANSACTION?
    Thanks
    Rahul

    Hi Rahul,
    For transaction status check the below query -
    select * from fnd_lookup_values
    where lookup_type like 'PQH_SS_TRANSACTION_STATUS'
    and language = 'US';
    Cheers,
    Vignesh

  • Can following query be used to find inserted update records.

    hi,
    i am using query1) to insert data query2) to update the record
    query1)
    INSERT INTO [t1]
               ( id
                ,createddatetime
               ,updateddatetime)
         VALUES
               (1
               ,GETDATE()
               ,GETDATE()) 
    query2)
    update t1 set updatedatetime=getdate() where id=@t1
    please tel me will two date cols get same time , that is, will i be able to 
    write following to find inserted/updated rows
    if exists(select * from t1 where createddt1=updateddt2)
    begin 
    select 'inserted'
    end 
    else
    begin 
    select 'updated'
    end
    yours sincerely

    Depending on how you execute both the queries there's a small chance date value comparison may not wok as expected as datetime also has timepart until milliseconds precision. So if you want to retrieve details on records inserted and updated you may use
    something like below
    query 1
    DECLARE @dt datetime
    SET @dt = GETDATE()
    INSERT INTO [t1]
    ( id
    ,createddatetime
    ,updateddatetime)
    VALUES
    (1
    ,@dt
    ,@dt)
    query2
    DECLARE @dt datetime
    SET @dt = GETDATE()
    update t1 set updatedatetime=@dt where id=@t1
    then you can do below to get inserted updated detailsif exists(select * from t1 where createddt1=updateddt2)begin select 'inserted'end elsebegin select 'updated'end
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • My MacBook Pro stated that it needed to be updated. I clicked yes to restart the computer and update but when it restarted it stays on the gray screen with the apple logo and then pops up, stating "unable to find driver for this platform." What do I do?

    My MacBook Pro stated that it needed to be updated. I clicked yes to restart the computer and update but when it restarted it stays on the gray screen with the apple logo and then pops up, stating "unable to find driver for this platform." What do I do?

    Boot into Recovery by holding down the key combination command-R at the startup chime. Release the keys when you see a gray screen with a spinning dial.
    Note: You need an always-on Ethernet or Wi-Fi connection to the Internet to use Recovery. It won’t work with USB or PPPoE modems, or with networks that require any kind of authentication other than a WPA or WPA2 Personal password.
    When the Mac OS X Utilities screen appears, follow the prompts to reinstall the Mac OS. You don't need to erase the boot volume, and you won't need your backup unless something goes wrong. If your Mac didn’t ship with Lion, you’ll need the Apple ID and password you used to upgrade, so make a note of those before you begin.
    Don't install the Thunderbolt update -- it's defective.

  • I have an iphone 4, i connect it to my laptop using the usb and then when connecting to itunes it says my phone is not up to date with itunes yet i cannot find an update 11.1 for my phones itunes? someone please help me.. kind regards

    i have an iphone 4, i connect it to my laptop using the usb and then when connecting to itunes it says my phone is not up to date with itunes yet i cannot find an update 11.1 for my phones itunes? someone please help me.. kind regards

    Itunes 11.1 is for your computer, not your iphone
    It is required in order to sync with ios 7.

  • Insert and update query to calculate the opening and closing balance

    create table purchase(productid number(5) ,dateofpurchase date,
    qty number(5));
    create table inventory(invid number(5),productid number(5),
    idate date,openingqty number(5),closingqty number(5));
    Records in inventory:
    1,1,'01-jan-2009', 10, 20
    2,1,'03-jan-2009', 20, 30
    3,1,'04-jan-2009', 40, 50
    when I enter the purchase invoice for 15 qty on 02-jan-2009
    after say '15-jan-09' , a new record should get inserted
    with opening balance = (closing balance before 02-jan-2009)
    and all the opening and closing balance for that product should
    get affected.
    If the invoice for 20 qty is entered for the existing date say
    '03-jan-2009' in inventory , then the closing balance
    for 03-jan-2009 should get updated and all the following records
    should get affected.
    I need the insert for the first one and update query for the
    second one.
    Vinodh

    <strike>You can do this in one statement by using the merge statement</strike>
    Hmm, maybe I spoke too soon.
    Edited by: Boneist on 25-Sep-2009 13:56
    Thinking about it, why do you want to design your system like this?
    Why not simply have your purchases table hold the required information and then either work out the inventory on the fly, or have a job that calls a procedure to add a row for the previous day?
    If you continue with this design, you're opening yourself up to a world of pain - what happens when the data doesn't match the purchases table? Also when is the inventory cut-off to reset the opening/closing balances? Monthly? Annually? Weekly? If it's set to one of those, what happens when the business request the inventory for a particular week?
    Edited by: Boneist on 25-Sep-2009 13:59

  • My iPhone 5s is stuck in recovery mode and won't turn on, I've tried to restore and update it to iTunes and its finding my phone, but saying an error has occurred, any ideas?

    My iPhone 5s is stuck in recovery mode and won't turn on, I've tried to restore and update it to iTunes and its finding my phone, but saying an error has occurred and won't work, the software is up to date, it just automatically switched itself off and when I try to turn it on, it shows the White background with the apple logo asif it's going to turn itself on but then switches off after a couple of seconds, what can I do? ive already taken it to a shop and he's looked at it, but said he can't fix it, thanks.

    Visit an Authorized Apple Service Provider or Apple Store to get it checked. If they can't fix this, you'll have to pay the Out-Of-Warranty-Service fee to get a new replacement for a reduced price:
    Out-of-warranty repair service
    If your repair isn’t covered by Apple’s One Year Limited Warranty, AppleCare+, or AppleCare Protection Plan, your iPhone might be eligible for out-of-warranty service. For example, liquid damage isn’t covered by warranty but might be eligible for out-of-warranty service. Some damage isn’t eligible at all, for example if your device has been broken into multiple pieces. See Apple’s Repair Terms and Conditions for complete details.
    Read Apple’s Repair Terms and Conditions
    Model
    Out-of-warranty service fee
    Battery service*
    iPhone 6 Plus
    $329
    $79
    *available only if battery
    fails Apple’s diagnostic test
    iPhone 6
    $299
    iPhone 5s, iPhone 5c, iPhone 5
    $269
    iPhone 4s
    $199
    iPhone 4, iPhone 3GS, iPhone 3G,
    Original iPhone
    $149
    Plus a $6.95 shipping fee, if required. Fees are in USD and exclude local tax. Pricing is for service through Apple. The final service fee we charge will be determined during testing and may be less than the service fee listed above. Pricing and terms vary for service through an Apple Authorized Service Provider.
    copied from Service Answer Center - iPhone

  • My iphone 4s is in recovery mode, when i plug it into my computer, itunes can find it and starts to restore and update it, but then it gets to the part where its waiting for itunes, my computer hasn't found it. how do i get my computer to find it?

    My iphone is in recovery mode, and when i connect it to my computer it makes the connected noise and itunes finds it, it starts to restore and update but it gets to the point where it says waiting for iphone. My compuer hasnt connected my iphone. i dont know how to make it conect :S Someone help! ive been trying for three hours!

    i have, its connected to my sisters computer,it starts to restore then says there was a problem downloading the software for the iphone, the network connection has timed out. what does this mean?

  • HT5429 I am not able to get any directions on my maps i am using iphone 4s and updated to ios 6.1.3 and whenever i try to find a route it always says directions could not be found can anyone help in fixing it

    I am not able to get any directions on my maps i am using iphone 4s and updated to ios 6.1.3 and whenever i try to find a route it always says directions could not be found can anyone help in fixing it

    Maps: Turn-by-Turn Navigation
    Argentina Australia Austria Belgium Brunei Bulgaria Canada Croatia Czech Republic Denmark Egypt Estonia Finland France Germany Greece Hong Kong Hungary Ireland Israel Italy Japan Latvia Liechtenstein Lithuania Luxembourg Macau Malaysia Malta Mexico Morocco Netherlands New Zealand Norway Poland Portugal Romania Russia San Marino Singapore Slovakia Slovenia South Africa South Korea Spain Sweden Switzerland Taiwan Thailand Turkey UK Ukraine USA
    Back to Top

  • HT1338 I have a Callaway range finder and need a software update and they provided the following directions and have changed the Java runtime versions several times to get their exe to update.Hello Doug,  Thank you for contacting Callaway uPro Technical S

    Hello Doug,
    Thank you for contacting Callaway uPro Technical Support.
    Please follow the instructions below to sync your upro mx/mx+ with your computer and update to the latest software - 3.1.005.
    1. Ensure the upro sync software is running on your computer (you will see a black icon at the bottom right of your screen by the clock with a Callaway logo in it).
    2. Plug your device into your computer; select Sync then PC.
    3. The sync software should initialize and launch the uxplore website. If you haven't installed the upro sync software you can download it Here:http://www.callawayuxplore.com/downloads/
    4. Download this: http://media.callawaygolf.com/webupdate/callawaygolf/2012/products/accessories/u pro/upro-mx-plus/downloads/3_1_005_launch.jnlp.zip
    5. Double click "3_1_005_launch," then click the green START button
    NOTE: If you get a "Unable to launch application" error please follow the instructions below.
    1a. Navigate to "Control Panel" through the start menu located in the bottom left of your screen.
    2a. Find and uninstall any "Java" applications. After uninstalling please go back to the start menu and right click on "Computer" or "My Computer" and select "Properties". In the right half of the pop up windows it'll say the Operating system your computer is running. If it says x64 bit click: http://tinyurl.com/lhkps2rto download the correct java for your computer. If it doesn't have a number please click: http://tinyurl.com/qysyctb to download the correct Java.
    3a. Once the correct Java is installed please follow steps 1-5 listed above.
    4a. To update your Java back to 7 please click: http://java.com/en/download/index.jsp. Once on the page select "Free Java Download" to run the download (Make sure to uncheck any Mcafee or toolbar installations during the installation).
    Once the update has completed the device will restart itself. At that time you can unplug it or select Sync and PC to launch the uxplore site again to continue syncing courses.
    NOTE: Do not try to sync courses to the unit while the update is running or both processes will fail. 

    Java isn't a part of the Mac OS X anymore, so you will need to install a version of Java. However, I don't know what version of java is required for this software. You need to explain to their support that you are using a Mac and what OS you are running. Download the latest java and see if that works.

Maybe you are looking for

  • HELP my ipone wont turn on

    i was on my iphone 3GS this evening and i suddenly decided to turn off ive tryed holding the buttons in and charging it up again and still nothing

  • Third Party Billing Server

    Hello All We have call manager 7.0.1 and a billing server which gets calling informations and shows it in a web format.I have a problem sending informations to that server,from which part of the call manager i force to send information to my billing

  • Manual Standard Price updation

    Hi All, One of my client having 8 plants and have more than 1000 FG materials. We are not doing costing run. I have to update manually the standard price for all the FG materials for all the plants. How I can do the above updation in one screen. than

  • Anyone tried to automate Skype recently?

    We recently switched our chat platform to the new Skype for Business, and I've been asked to research how to automatically update everyone's contact list. So I Googled around a bit and found out a few important things:They discontinued their desktop

  • Eraser brush for radial  or graduated filter like in PSCC Camera Raw?

    Does anyone know if we are going to get an eraser brush for radial  or graduated filter like in PSCC Camera Raw or why not? I thought the camera raw engines were supposed to be the same with the same tools.