Table: News
User: CEO
Rights: God(insert/update/delete)
User: Manager
Rights: insert/update
User: Editor
Rights: update
How to implement this?
----- Original Message -----
From: S.Isaac Dealey <[EMAIL PROTECTED]>
Date: Tue, 6 Jan 2004 22:20:43 -0600
To: CF-Talk <[EMAIL PROTECTED]>
Subject: Re: SQL formatting question
> I have a table with column of phone numbers. The phone
> numbers have been entered in a number of different formats
> some containing . or - or /. Some with area codes with ().
> What I want to do is get them all the same. Now I can take
> all the records and get them all in a simple 10 digit
> sequence but I then want to convert them all to
> (123)456-7890 format. The field that houses the phone
> number is a varchar(50) field.
I'd create a udf to convert the values in your db to the format you
want for phone numbers... probably something like
function phoneformat(num) {
num = rereplace(num,"[^0-9]","","AlL");
return "(#left(num,3)#)#mid(num,4,3)#-#mid(num,7,4)#";
}
Once you've got that you can apply it prior to inserting or updating
records and then rifle through the existing numbers in the database
and set them all once just to make them all uniform and then from that
point the insert/update templates will handle formatting.
hth
s. isaac dealey 214-823-9345
team macromedia volunteer http://www.macromedia.com/go/team
chief architect, tapestry cms http://products.turnkey.to
onTap is open source http://www.turnkey.to/ontap
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

