473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Replace function

hi
I need to replace data on a field.
I know the function replace(coulmn_name,original_value,new_value)
But i want to replace more than one value - can it be done?

For example i have a field name Type. 'P' is Passport, 'V' is Visa.
I want to change 'P' to passport and 'V' to Visa.

thanks!
Aug 15 '07 #1
7 2115
Purple
404 Expert 256MB
Hi ronennoga and welcome to TSDN,

You could do this using T-SQL where you can use IF statements to test the fields value and conditionally set the change to value.

Take a look here for some more info..

Regards Purple
Aug 15 '07 #2
Hi ronennoga and welcome to TSDN,

You could do this using T-SQL where you can use IF statements to test the fields value and conditionally set the change to value.

Take a look here for some more info..

Regards Purple
hi Purple - thanks for your help
can u please give an example or a more specific link? i couldn't find it....

Many thanks
Noga
Aug 15 '07 #3
Purple
404 Expert 256MB
Hi Noga,

here is the link to the If... Else reference in the T-SQL reference.

Regards Purple
Aug 15 '07 #4
You could also use CASE to execute conditional logic (like IF and ELSE) inside a block statement.

For example:
Expand|Select|Wrap|Line Numbers
  1. Select Case [type] 
  2. When 'P' Then 'Passport'
  3. When 'V' Then 'Visa'
  4. Else [type]
  5. End as [aliasname]  --or orginal fieldname, this can be whatever you want.
  6.  
MSDN Reference (CASE)
Aug 15 '07 #5
Purple
404 Expert 256MB
Good suggestion bwestover,

especially valuable with more than a couple of conditions to be tested for..

Purple
Aug 15 '07 #6
worked like a charm...
thank u very much
Aug 16 '07 #7
Purple
404 Expert 256MB
ronennoga,

Very pleased to hear it.

Regards Purple
Aug 16 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Barnes | last post by:
Does anyone know of a good way to use the JavaScript string.replace() method in an ASP form? Here is the scenario: I have a form that cannot accept apostrophes. I want to use the replace() so...
6
by: Danny | last post by:
I need an asp command to strip out from a string all extra punctuation such as apostrophe, comma, period, spaces dashes, etc etc and just leave the letters. Can anybody give me some ideas? ...
4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
12
by: Brian | last post by:
I want to use regxp to check that a form input contains at least 1 non-space charcter. I'd like to only run this if the browser supports it. For DOM stuff, I'd use if (documentGetElementById) {}...
3
by: Dave | last post by:
I have an Access 2K application that is distributed to about a dozen users (all with identical NT environments and identical Access versions, object libraries and service packs). I am using the VBA...
5
by: pembed2003 | last post by:
Hi all, I need to write a function to search and replace part of a char* passed in to the function. I came up with the following: char* search_and_replace(char* source,char search,char*...
19
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not...
5
by: djc | last post by:
I need to prepare a large text database field to display in an asp.net repeater control. Currently I am replacing all chr(13)'s with a "<br/>" and it works fine. However, now I also want to be able...
4
by: Lauren Wilson | last post by:
Hi folks, We have a need to replace sub strings in certain message text. We use the Office Assistant to display help and often use the imbedded formatting commands. Those of you who have used...
10
by: pamelafluente | last post by:
I need to replace all the occurences of a string within another string (or stringbuilder): Function ReplaceInsensitive(ByVal InputString As String, _ ByVal SubstringReplaced As String, _ ByVal...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.