Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert numbers in a field

Status
Not open for further replies.

jtammyg

Technical User
Dec 16, 2002
30
US
Hi!

I have the following number format in a column:

9xxx-xxxx

I want to modify it to look like this:

9-1-718-xxx-xxxx

How do I go about achieving this?

Thanks a lot for your help!

 
In order to answer your question, I need more information:

Is this actually a string field with these numbers in it, stored as '9xxx-xxxx' where the x's are numeric digits? If so, how is the string field actually defined in the table - char(9)? varchar(9)?

Another question - do you just want to display the existing data differently, or actually change it in the database?

What version of Pervasive.SQL are you using?
Linda
Pervasive Software Support
 
Hi Linda!

Thank you for your answer. I already found a way to do it.

I wanted to insert the data, so I run the following statement:

update table set phone='9-1-718-' + right(rtrim(ltrim(phone)),8) where length(rtrim(ltrim(phone)))=9 and substring(phone,1,1)='9'

It works!

Thanks again for your response!

Tammy



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top