|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
If I want to change the value of a special bit in a column, how to wirte the SQL sentence in sqlserver.
I mean in a column, the value is 'test', then how to change the 's' to 'e' or any other value by just one SQL sentence. Thanks. |
|
#2
|
||||
|
||||
|
UPDATE tablename SET column_name = 'teet' WHERE column_name = 'test'
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
Thank you,but you hadn't unserstood my meaning.
I mean, suppose there is a column with the property nvarchar(100), I don't know the original value,but I want to change the value on the 23th position to another value such as 'p'. My problem is: with 'SUBSTRING', I can get a value, but how can I change the value? The MS SQL seems not to support this method. |
|
#4
|
|||
|
|||
|
select "TEST" as original,SUBSTRING("TEST",1,2) + 'E' + RIGHT("TEST",DATALENGTH("TEST")-3) as changed
in the first substring the lenght parameter is equal to pos to be changed minus 1 |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > How to write the SQL sentence |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|