Udating first 4 character in a column

Hi guys, I totally forgot how I can update only one character in SQL. I got the column UTC varchar (14) with all the bvalue as below
20090731070000
I should change the value to 20120731070000...
Any advice?
Thanks as usual

You can also use STUFF like this
UPDATE YourTable
SET  UTC = STUFF(UTC, 1, 4, '2014');
Krishnakumar S

Similar Messages

  • Finding the first unused number in a column

    I am attempting to write a single SQL statement that can find the first unused number for a column. For example, for a column called BLOCKID, that contains these values...1,2,3,4,6,7,8...I would like to be able to insert a record with BlockID equal to 5. I can do this by writting a loop, but that seems quite inefficient (may have to loop hundreds of times or more to find the first available hole).
    Any ideas? Thanks, Kieren
    null

    Here's one way
    1. Get a list of row numbers for the table
    2. Add an item to the list for 1 more than the largest id
    3. Remove from the list all numbers already used
    4. Use the smallest value of the list that is left.
    As a query this would be:
    SELECT MIN(BLOCKID) FROM
    (SELECT MAX(BLOCKID) + 1 BLOCKID
    FROM mytable UNION ALL
    SELECT ROWNUM BLOCKID
    FROM mytable MINUS
    SELECT BLOCKID FROM mytable
    Needless to say there should be a primary key or index on the BLOCKID column of 'mytable'.
    Good luck!
    null

  • Replace all up to the first word character

    I have a String with a value of *1. Artist - Title*. What I am trying to do is remove everything up to the first word character so the new String will be Artist - Title. This is all I have been able to come up with:track.replaceAll ("\\d ^\w","").split (" - ");{code} Also, I used {code:java}track.replaceFirst ("\\d","").replaceFirst ("\\W","").replaceFirst ("\\s",""){code}but that isn't practical at all (even though it works).
    I tried to find examples on a few regular expression sites, but maybe I'm not searching with the right keywords. My code won't even compile. Anyone have a hint?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    public class RegexExample3 {
        public static void main(String[] args) {
            String input = "1. Artist - Title";
            String output = input.replaceFirst("^[^A-Za-z]*", "");
            System.out.format("'%s' ==> '%s'%n", input, output);
    }For your requirements, you need to be cleared about "word character", since \w means [A-Za-z0-9]

  • EBS database name first 4 character must unique (on same server)??

    our consultant told me if we have several EBS databases on same server database name max is 8 characters, but first 4 characters must unique. For example, if we have VISDEMO1 and VISDEMO2 databases on same server, it will cause problem. I remember uniqueue first 4 character database name is backu to 7i, it is not a issue after 8i.
    Can anyone give me a confirm?
    Thanks.

    You are right; there are no restrictions on the first four characters. Database name can be up to 8 characters.
    Note: 115499.1 - Global Database Name Explained
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=115499.1

  • How to display first SPACE character in Column of ALV Grid Report?

    Hello All,
    In ALV Grid report, One of the column has a value like ' Test_Value'. In this value first character is SPACE but in display SPACE is not appearing.
    Field catalog type is:- slis_t_fieldcat_alv
    I have used the function module:- REUSE_ALV_GRID_DISPLAY
    Is there any settings required in Fieldcatalog Internal table for displaying leading SPACE chara.?
    its a field not the header.
    thanks in advance.
    Rahul

    Hi all,
    did any body have a solution for this problem?
    In ALV Grid report, One of the column has a value like ' Test_Value'. In this value first character is SPACE but in display SPACE is not appearing.
    Field catalog type is:- slis_t_fieldcat_alv
    I have used the function module:- REUSE_ALV_GRID_DISPLAY
    Is there any settings required in Fieldcatalog Internal table for displaying leading SPACE chara.?
    its a field not the header.
    thanks in advance.
    Rahul

  • 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.

  • Concatenation of character values by columns with excluding duplicates

    Hi all! Assume, that there is a multi-rows table of the following form (for example):
    1|A  |   |B  |C  |   |D  |   |
    2|   |   |A  |B  |C  |D  |   |
    3|   |A  |B  |   |   |C  |D  |
    4|   |   |A  |   |B  |C  |D  |
    5|   |   |A  |   |B  |   |C  |i.e. there are NULL and NOTNULL values in VARCHAR2( or NVARCHAR2) format, and the first column is a primary key.
    I need to do next:
    1. Select some set of certain rows, primary keys of those are initialy known, e.g. 1, 3, 5;
    2. Parse this table such way: concatenate values by columns in selected rows, if there are few not-null values in one column, it's necessary to separate concatenated values with comma and whitesbase (it's desirable that's word after comma with whitespace is outputted in lowercase). Finally, it's necessary to insert dot and whitespace character after the last value.
    3. Exclude duplicate substrings from the outcoming text values.
    Thereafter I need to initialize set of local variables with the values, obtained by forementioned parsing (parsing of one column match the corresponding variable), e.g. columns of 1, 3 and 5 rows.
    I.e. result in our case looks like:
    variable1 = A.
    variable2 = A.
    variable3 = B, A.
    variable4 = C.
    variable5 = B.
    variable6 = D, C.
    variable7 = D, C.
    Does the task will be easier, if the number of parsed rows is known (e.g. 3 as in our case)?
    Edited by: 942736 on 02.10.2012 17:17

    You missed your db-version. Please give the result from
    select * from v$version;When you are on 11.2 you can try this (will not work with 10.x):
    with yourtable as
    select 1 id, 'A' col1, 'N' col2, 'B' col3, 'C' col4 ,'N' col5, 'D' col6 ,'N' col7 from dual union all
    select 2,'N','N','A','B','C','D','N' from dual union all
    select 3,'N','A','B','N','N','C','D' from dual union all
    select 4,'N','N','A','N','B','C','D' from dual union all
    select 5,'N','N','A','N','B','N','C' from dual
    select
    (select listagg(col1,',') within group (order by id)||'.' from (select distinct col1, min(id) over (partition by col1 order by id) id from yourtable where id in (1,3,5))) v1,
    (select listagg(col2,',') within group (order by id)||'.' from (select distinct col2, min(id) over (partition by col2 order by id) id from yourtable where id in (1,3,5))) v2,
    (select listagg(col3,',') within group (order by id)||'.' from (select distinct col3, min(id) over (partition by col3 order by id) id from yourtable where id in (1,3,5))) v3,
    (select listagg(col4,',') within group (order by id)||'.' from (select distinct col4, min(id) over (partition by col4 order by id) id from yourtable where id in (1,3,5))) v4,
    (select listagg(col5,',') within group (order by id)||'.' from (select distinct col5, min(id) over (partition by col5 order by id) id from yourtable where id in (1,3,5))) v5,
    (select listagg(col6,',') within group (order by id)||'.' from (select distinct col6, min(id) over (partition by col6 order by id) id from yourtable where id in (1,3,5))) v6,
    (select listagg(col7,',') within group (order by id)||'.' from (select distinct col7, min(id) over (partition by col7 order by id) id from yourtable where id in (1,3,5))) v7
    from dual;Output with 11.2 is:
    V1      V2      V3      V4      V5      V6      V7
    A,N.     N,A.     B,A.     C,N.     N,B.     D,C,N.     N,D,C.@ranit B: You missed, that the OP said that only rows 1,3 and 5 shall be used.
    Edited by: hm on 01.10.2012 23:09

  • Selecting only normal character data from column

    Hi,
    We have a table column which stores party names and this could consist of non english characters. Would anyone know how do we just select regular english character rows from the table using a select query and not include the rows which have non-english characters?
    Thanks

    There iare two points with the suggestion by Frank.
    First i think he missed an +
    and secondly it doesnt work for example with german umlauts.
    with data as (
    select 'SERPI!! GAB' s from dual union all
    select 'SE£ GRA' from dual union all
    select 'ARA%%& sa' from dual union all
    select 'dasssädsa' from dual union all
    select 'ara€ ssa' from dual union all
    select 'gabriele dsa' from dual
    SELECT     *
    FROM     data
    WHERE     REGEXP_LIKE ( s
                  , '^[A-Za-z]+$'
    no rwos selected
    with data as (
    select 'SERPI!! GAB' s from dual union all
    select 'SE£ GRA' from dual union all
    select 'ARA%%& sa' from dual union all
    select 'dasssadsa' from dual union all
    select 'ara€ ssa' from dual union all
    select 'gabriele dsa' from dual
    SELECT     *
    FROM     data
    WHERE     REGEXP_LIKE ( s
                  , '^[A-Za-z]+$'
    S
    dasssadsa
    (without umlaut)
    so perhaps you will give translate a try e.g.
    with data as (
    select 'SERPI!! GAB' s from dual union all
    select 'SE£ GRA' from dual union all
    select 'ARA%%& sa' from dual union all
    select '@dass äsadsa' from dual union all
    select 'ara€ ssa' from dual union all
    select 'gabriele dsa' from dual
    select s
    ,  translate(
        lower(s)
        ,'@abcdefghijklmnopqrstuvwxyz1234567890 '
      ) t
    from data
    where
    length(
      translate(
        lower(s)
        ,'@abcdefghijklmnopqrstuvwxyz1234567890 '
    < length(s)
    S T
    SERPI!! GAB !!
    SE£ GRA £
    ARA%%& sa %%&
    @dass äsadsa @ä
    ara€ ssa € porjection is just for explanation purpose
    regards

  • How to create a report region which the first colomn is row selector column

    I want to create a report region and its first column is a row selector column. I have used select sentence to select some columns. But I do not know how set the first column to row selector column. I mean I want to do as follow. When a radio which is first column is chosen, it will return it's value of the column in the chosen row. Please help me! Thanks

    Hi unnamed,
    Suppose you have an id that identifies your record.
    Go to Report definiton, tab report attirbutes.
    Select the id of your record.
    Create a link to the page you want to go to.
    Hope this helps.
    If not, I suggest you to create a from with report, and analyze the way the wizard has generated it.
    Leo

  • SSRS Expression to calculate percentage with the denominator being the first value in the same column group in a matrix report

    Hello, Expert,
    Could you please help me with the following problem? Thanks in advance!
    I have designed the matrix report (SSRS 2012) with database table structure looks like below.    
    Week           
    Version
         Count
    Week1
    V1.1
    4000
    Week1
    V1.2
    4000
    Week1
    V1.3
    4000
    Week2
    V1.1
    3000
    Week2
    V1.2
    3000
    Week2
    V1.3
    3000
    Week3
    V1.1
    2000
    Week3
    V1.2
    2000
    Week3
    V1.3
    2000
    Week4
    V1.1
    1000
    Week4
    V1.2
    1000
    Week4
    V1.3
    1000
    The matrix report displays like below. Column grows based on no of Week in the table.   
    Week1
    Week2
    Week3
    Week4
    V1.1
    4000
    3000
    2000
    1000
    V1.2
    4000
    3000
    2000
    1000
    V1.3
    4000
    3000
    2000
    1000
    What I want to do now is: instead of the Count values, I need to calculate the percentage of each week over the
    Count in Week1 so that each cell displays Count(Week2)/Count(Week1), Count(Week3)/Count(Week1), etc. What is the SSRS expression for that? I’m new to SSRS, Please help!

    Heidi,
    Thank you so much for your reply and solution! Now I know how to get the first field in a group. But I can't apply your solution directly just yet because in order to explain my problem I simplified my data structure. My real data structure has a nested
    group like this:
    Week  VersionMajor VersionMinor Count
    Week1  V1           V1.1         2000
    Week2  V1           V1.1         1500
    Week3  V1           V1.1         800
    Week1  V1           V1.2         1000
    Week2  V1           V1.2         500
    Week3  V1           V1.2         200
    Week1  V1           V1.1         2000
    Week2  V1           V1.1         1500
    Week3  V1           V1.1         800
    Week1  V1           V1.2         1000
    Week2  V1           V1.2         500
    Week3  V1           V1.2         200
    Here is the query for the above data:
    SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
    UNION ALL
    SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
    UNION ALL
    SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
    UNION ALL
    SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
    UNION ALL
    SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
    UNION ALL
    SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
    UNION ALL
    SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
    UNION ALL
    SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
    UNION ALL
    SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
    UNION ALL
    SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
    UNION ALL
    SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
    UNION ALL
    SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
    And my matrix table looks like this:
    What I need to do is to calculate the percentage of each week over week1 for
    1) V1 Total
    2) V1.1
    3) V1.2
    I can't use your solution directly because I need to apply Sum function for each cell and the Sum function gives me error when I try to use it on the denominator
    First(Fields!Count.Value,"VersionMinor"). If you could help me further to get to the final solution, I'd really appreciate it!!
    Happy New Year!

  • Find feature looses focus while typing a phrase, after typing the first space character.

    The find feature now looses focus while I am entering a phrase. After entering the first word of a phrase and the space character, the find box will reposition itself to a possible result on the web page on EVERY CHARACTER and I have to reposition the cursor BACK to the find box to enter every subsequent character in the phrase I am searching for. Is there a way I can turn this useless (for me) *feature* off?
    I used to be able to key the phrase I was looking for, and the box would turn red as I typed if the phrase did not exist. I would really appreciate being able to do this again. It now seems that Firefox 'jumps the gun' to find the phrase before I have completed typing it in.
    Thanks.

    *If you have many extensions then first enable half of the extensions to test which half has the problem.
    *Continue to divide the bad half that still has the issue until you find which one is causing it.

  • Select records based on first n distinct values of column

    I need to write a query in plsql to select records for first 3 distinct values of a single column (below example, ID )and all the rows for next 3 distinct values of the column and so on till the end of count of distinct values of a column.
    eg:
    ID name age
    1 abc 10
    1 def 20
    2 ghi 10
    2 jkl 20
    2 mno 60
    3 pqr 10
    4 rst 10
    4 tuv 10
    5 vwx 10
    6 xyz 10
    6 hij 10
    7 lmn 10
    so on... (till some count)
    Result should be
    Query 1 should result --->
    ID name age
    1 abc 10
    1 def 20
    2 ghi 10
    2 jkl 20
    2 mno 60
    3 pqr 10
    query 2 should result -->
    4 rst 10
    4 tuv 10
    5 vwx 10
    6 xyz 10
    6 hij 10
    query 3 should result -->
    7 lmn 10
    9 .. ..
    so on..
    How to write a query for this inside a loop.

    Hi,
    So, one group will consist of the lowest id value, the 2nd lowest and the 3rd lowest, reggardless of how many rows are involved. The next group will consist of the 4th lowest id, the 5th lowest and the 6th lowest. To do that, you need to assign numbers 1, 2, 3, 4, 5, 6, ... to the rows in order by id, with all rows having the same id getting the same number, and without skipping any numbers.
    That sounds like a job for the analytic DENSE_RANK function:
    WITH     got_grp_id     AS
         SELECT     id, name, age
         ,     CEIL ( DENSE_RANK () OVER (ORDER BY id)
                   / 3
                   )          AS grp_id
         FROM     table_x
    SELECT     id, name, age
    FROM     got_grp_id
    WHERE     id     = 1     -- or whatever number you want
    ;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
    See the forum FAQ {message:id=9360002}

  • How to remove a newline character from a column

    hi all...
    i have a column in a table in which some of the datas contain a newline character at their last.
    i need to remove those newline characters.
    for example.... a data is
    'abcd
    (notice the end of the quotation).....i need to get the data as...'abcd'
    plss help me...
    thanks in advance..

    thanks for ur reply...
    i got your point..but here what you have done is....u have inserted a particular character set in between 'abcd' and 'xyz' and afetr that just replaced those character set by null....
    but in my case the problem is a bit different...
    the datas are already present and what i have to do is to remove the newline spaces from the end of the datas.
    select replace(column_name,'<what shall i put here>',null) from table_name;
    in your example...that is 'chr(10)'...but in my case its a newline character....

  • Finding and Changing "first word character syle" in text

    I want to search spesific word and only replacing first founded word character style in text. Like this :
    "Transfer to Istanbul Airport for morning flight to Adana.  Meet and transfer to Antioch , the place where the followers of Jesus were first called Christians. Here you will visit the Church of St. Peter, a grotto discovered by the Crusaders and reputed to be the cave church where early Christians met in secret. At the Mosaic Museum in Antioch you will see an unusually rich collection of mosaics from this area. Following your visit at the museum, you will go to the Seleucia Pieria, the ancient port town of Antioch from which Paul and Barnabas set out on their first journey and where Paul returned afterwards.  Finaly, you will check into the hotel in Antioch for dinner and overnight. (B,D)"
    This paragraph contains 4 Antioch word. And I want to make BOLD first one.
    This is my code but this code change all of them to bold. Can anyone help me?
    var myDocument = app.documents.item(0);
    // Clear old preferences
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;
    //Set the find options.
    app.findChangeTextOptions.caseSensitive = false;
    app.findChangeTextOptions.includeFootnotes = false;
    app.findChangeTextOptions.includeHiddenLayers = false;
    app.findChangeTextOptions.includeLockedLayersForFind = false;
    app.findChangeTextOptions.includeLockedStoriesForFind = false;
    app.findChangeTextOptions.includeMasterPages = false;
    app.findChangeTextOptions.wholeWord = false;
    // This CharacterStyle set to BOLD FONT STYLE
    app.changeTextPreferences.appliedCharacterStyle = myCharacterStyle;  
    app.findTextPreferences.findWhat = "Antioch";
    app.changeTextPreferences.changeTo = "Antioch";
    myDocument.changeText();

    @cuneytoral – the explanation is:
    findText() ( or findGrep() ) are methods that return an array of found texts (formatted text objects).
    So the result with index 0 is the first one found. The last one is the length of the array -1.
    Since the result is of type Array and not Collection, we cannot define a range with the itemByRange() method.
    And also we cannot define the last item as allFoundItems[-1], but to have write this:
    allFoundItems[allFoundItems.length-1].appliedCharacterStyle = myCharacterStyle;
    to address the last found one.
    Say, we want to format the found texts from the second one found to the last one found, we have to loop through the found array:
    We do not start the loop with 0, but with 1:
    for(var n=1;n<allFoundItems.length;n++){
        allFoundItems[n].appliedCharacterStyle = myCharacterStyle;
    Formatting every other of the found texts would be:
    for(var n=0;n<allFoundItems.length;n=n+2){
        allFoundItems[n].appliedCharacterStyle = myCharacterStyle;
    Just to give you some ideas…
    Uwe

  • Storing a Non Printable -from keyboard- Character in Varchar2 Column

    Hi,
    I want to store a non-printable character in a varchar2 column. This character should be non-printable -from keyboard- for all character sets -or very difficult to print from keyboard-. It doesn't matter, whether it can be displayed on screen or not. It does matter INSTR function returns the character position of that character. It should be able to import export data without any problem for any NLS specific operating environment. For example, I plan to use chr(1) do you think it's appropriate? I appreciate your helps.
    Best Regards,
    Salim

    What is the business requirement you're trying to satisfy?
    If your database character set is based on ASCII, CHR(1) (the Start of Header) character is likely to be transferred between systems without character set conversion. Non-ASCII character sets (i.e. Big5 for Chinese data) don't necessarily share the same control characters, though, and generally won't have the same binary representation of an ASCII control character (so CHR(1) in a non-ASCII based database wouldn't necessarily return the same character that CHR(1) would in an ASCII based database).
    Justin

Maybe you are looking for

  • Decrease sy-tabix value in Loop

    Hi Experts, I need to know that is it possible that we can decrease or change value of SY-TABIX. EXAMPLE: I am using a; loop at itab.  --> at this stage sy-tabix is 1. for instance current value of sy-tabix is changed to 4 and now I want to make it 3

  • Crystal Report Date Prompt  Query from SAP BW

    Dear Support, Using Crystal Report 2008 and Query is design In SAP BW Date Prompt is made mandatory in Query at Query Designer. Problem:  Requirent is that Date promt shoud take value currentdate-1 when report is excuted first date prompt will show i

  • Hyperlinks in PDF is not opening New window.

    Here I want to share my experience with PDF .I am using SSRS reports and I have a column called "Location" in SSRS Report. "Location" column contains a hyperlink and that uses javascript code.Below is the javascript code for that column "Location" ="

  • New G/L Configuration material

    Hi Experts,     Can any one help me with New G/L configuration material with screen shots. Regards, Nagaraju

  • Restore bookmarks to a certain Firefox (ESR) Sync state

    Dear all, at my (Win7x64) notebook which I use mainly for work I use the Firefox ESR. I use the FF Sync just to backup my bookmarks, add-ons, passwords, ... just everything. My Laptop with this setting was in use almost every day for about 1 year unt