Usage of mssql replace

Updated on healthy 2024-08-10
10 answers
  1. Anonymous users2024-02-15

    Use the stuff function.

    stuff ( character_expression , start , length ,character_expression )

    parameter character expression

    A character data expression. A character expression can be a constant, a variable, or a column of characters or binary data.

    start is an integer value that specifies where deletion and insertion begin. If start or length is negative, an empty string is returned. If start is longer than the first character expression, an empty string is returned.

    Start can be of type bigint.

    length

    An integer that specifies the number of characters to remove. If the length is longer than the first character expression, up to the last character in the last character expression is removed. Length can be of type bigint.

    Return Type Returns character data if character expression is a supported character data type. If character expression is a supported binary data type, binary data is returned.

    Note If the start position or length value is negative, or if the start position is greater than the length of the first string, an empty string is returned. If the length to be removed is greater than the length of the first string, the first character in the first string will be removed.

    If the result value is greater than the maximum value supported by the return type, an error is generated.

    Example The following example creates and returns a string by removing the three characters starting at the 2nd position (character b) in the first string abcdef, and then inserting the second string at the beginning of the deletion.

    select stuff('abcdef', 2, 3, 'ijklmn');

    Here's the result set:

    aijklmnef

    1 row(s) affected)

  2. Anonymous users2024-02-14

    update ceshi set nr=replace(itemname,'x','klj') where itemname like '%x%'

    It's definitely okay to write like this, I've tested this, you can try it.

  3. Anonymous users2024-02-13

    I don't know how many of those symbols you're going to remove, but if you could list them all, there's a dumber way to do it.

    Nesting uses replace

    select replace(replace(column name,'ɦ',‘’621’,'')

  4. Anonymous users2024-02-12

    How to use replace:

    replace ( ''string_replace1'' , ''string_replace2'' , ''string_replace3'' )

    parameters''string_replace1''

    string_replace2''

    The string expression to be found. string replace2 can be either character data or binary data.

    string_replace3''

    Substitution of string expressions. String replace3 can be either character data or binary data.

    The return type is a string.

  5. Anonymous users2024-02-11

    I haven't used this function, but based on subjective feelings, it seems that the substitution function with other languages should be a truth.

    So, write it like this in the following way, and it should work!

    Yes or no, you can give it a try.

    replace(replace(,'e','Investigation'),'g','business')

  6. Anonymous users2024-02-10

    You can write this in two parts, you can update it directly without replacement.

  7. Anonymous users2024-02-09

    select case when trip_type = 'g'then 'business'

    when trip_type = 'e'Then 'investigate'

    endfrom table;

    There is also a replace that can also be used in select.

    e.g. sql> select * from dual a ; dummy

    x sql> select replace (dummy , 'x' , 'Zhang San') from dual a ;

    replace(dummy,'x','Zhang San')

    Zhang San: If you want to replace more than one, you can also do it.

    select replace (dummy , 'x' , 'Zhang San') from dual a where dummy ='x'

    union all

    select replace (dummy , 'g' , 'Zhang 1') from dual a where dummy ='g'

    union all

    select replace (dummy , 'e' , 'Zhang 2') from dual a where dummy ='e';

  8. Anonymous users2024-02-08

    select case when g then'business' when e then 'Examination' end

    from [table name].

  9. Anonymous users2024-02-07

    Regularization is a general-purpose technique that does not distinguish between languages.

    Like g, there are only 3 blocks.

    They are g, i, and m

    g indicates the full-text search of the reed chain.

    i indicates that case is ignored.

    m indicates a multi-line query.

    Generally, only the first two are used, and the third is rarely used. I didn't have to accompany my grandson either.

  10. Anonymous users2024-02-06

    Replace is not wrong, it's your way of thinking.

    Replace can only return 1 value at best, and all you pass is a string, which is a value.

    It's not very easy to split it into multiple values.

    In this case, it is usually as concatenating SQL, exec to execute the statement, or using the charindex function to spell up the characters.

Related questions
8 answers2024-08-10

The REPLACE in asp means: [count] replace; DOS External Commands: Supersede or Update Files!

4 answers2024-08-10

from Inpatient Description Form inner join Inpatient Information Form on Inpatient Description Form. fname = Hospitalization Information Sheet. Fname Inner Join (select Fregistid from Hospitalization Registration Form Group by FregistID) c on Hospitalization Information Form. >>>More

8 answers2024-08-10

The process of turning koji into wine: after the rhizopus and yeast in the koji are alive first, the yeast reproduces a large amount, and the rhizopus produces starch decomposition enzymes, which turn starch into sugars (such as glucose), and then the yeast does not turn sugar into wine under the condition of no oxygen or low oxygen!

20 answers2024-08-10

The layout of your air conditioner limits your purchasing power, if your living room is small, I suggest you can buy two Gree, **about 2300 units, refrigerators depend on what type you buy, small living room you can buy Haier, there are small living rooms, ** depends on yourself, because some small ones are very expensive, computers, I suggest you find an acquaintance who knows how to do it, and configure one yourself, so as to save money and rest assured, electric cars are now the same, Generally around 1500-1800, the washing machine will be you and your lover to see it in person, I personally prefer Siemens, of course, ** is also very expensive, because my range hood is Siemens, but the performance is really good, so if you want to buy these furniture in 20,000 or so on, it is more difficult, I roughly calculated. >>>More

3 answers2024-08-10

The goto statement is a transfer instruction, which directly changes the current instruction pointer IP of the CPU to the instruction address pointed to by the goto statement, and then continues to execute from this address. From the assembly language point of view, the goto statement corresponds to the assembly language JMP instructions, but the danger of assembly language is that the jump of JMP instructions is unconstrained or less constrained, and the machine instruction level can be jumped at will, unless the instructions are strictly checked before execution, which is actually very difficult. >>>More