Philippe Renaud
asked on
SQL Query
Hello, I need help to modify some data inside a table.
I have text in a lot of rows in that format: 1234567890
I need to insert inside each field dots. I need it to be: 1234.56.78.90
I have some alrady in my table as that format (with dots) wich is fine and I do not need to change them.
for the rest.. i need a modification. How could I do that inside a SQL query ? any idea?
I have text in a lot of rows in that format: 1234567890
I need to insert inside each field dots. I need it to be: 1234.56.78.90
I have some alrady in my table as that format (with dots) wich is fine and I do not need to change them.
for the rest.. i need a modification. How could I do that inside a SQL query ? any idea?
select case when charindex('.',field) > 0 then field else substring(field,1,4) + '.' + substring(field,5,2) + '.' + substring(field,7,2) + '.' + substring(field,9,2) end as formatted_text from table
ASKER
I need to do in update of the table so I guess i just add:
update table set field as
(then your code) ?
update table set field as
(then your code) ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.