Jump to content

Update condition..


Siddhesh
 Share

Recommended Posts

Hi,I have a table Student With Column Student NameI want to do is thatThe Names Starting with 'S' , should start with 'K'e.g Students names areSid, Subbu, Sigma, suki..Then should be convert toKid, Kubbu, Kigma, Kuki....Thanx,Waiting...

Link to comment
Share on other sites

you can do that with a server side language. Select the names starting with s then do string manipulation and then update the records again.

Thanx, that could be a solution.But I don't want to make any site, but only data-cleaning.Can I do it?Any other solution? I m Using SQL 2000
Link to comment
Share on other sites

As per my understanding ur query,I feel that this is the solution:UPDATE Student SET Student_Name= Replace(Initcap(Student_Name),'S','K') WHERE Initcap(UNIQUE_NAME) LIKE 'S%'Even without the where clause it will work...But to increase the readability , i have added it

Link to comment
Share on other sites

  • 3 weeks later...

declare @nombret varchar(25)UPDATE prueba2set @nombret=substring(nombre,2,24),nombre=Replace(substring(nombre,1,1),'c','r')+@nombretWHERE nombre LIKE 'c%'@nombret is a temporal variableprueba2 is the tablenombre it is the only field that is modifiedsubstring select from nombre the firt caracter and the rest set to @nombretand only it modifies the first characterI hope can help you

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...