Reputation: 249
This I am sure is a fairly simple question. Clients are entering data into a column that looks like this 600/4768/4. I need to be able to remove the / once the data has been entered. How would I do this?
It is usually entered in this format as it is being referenced from another source in this pattern.
Upvotes: 0
Views: 110
Reputation: 95
You could do it either in program before data is submitted, or in sql. Exactly how depends on what you're programming with, an what database you're using.
in MySql you can do this: replace('00/4768/4', '/', ''); Most any rdbms will have a similar function.
http://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_replace
I usually find it's easier to do this kind of thing in the program than in sql though.
Upvotes: 1
Reputation: 471
USe REPLACE if you want to update in SQL like
REPLACE(<column_Name>,'/',' ')
whole query will look like
Update <table_name>
set <column_Name> = REPLACE(<column_Name>,'/','')
hope this helps
Upvotes: 0
Reputation: 585
While inserting client data in to column you can use the REPLACE function, I believe, you are using SQLServer. Below is the example how you can use replace.
REPLACE('600/4768/4','/','');
Upvotes: 0
Reputation: 13496
select REPLACE('600/4768/4','/','')
While user enters the data take it and then replace the "/" and then store in the table
Upvotes: 0
Reputation: 3701
You can use REPLACE function in your SQL query:
replace( string1, string_to_replace, [ replacement_string ] )
Upvotes: 0
Reputation: 166396
Using SQL SERVER you can try REPLACE (Transact-SQL)
Replaces all occurrences of a specified string value with another string value.
Usage:
SELECT REPLACE('abcdefghicde','cde','xxx');
Upvotes: 0