-
Oct 12th, 2021, 02:49 AM
#1
Thread Starter
Enjoy the moment
[RESOLVED] trying to replace function something not working
hey
im trying to remove a currenct symbol from a filed
im missing something in my code
need some help please
if the address field contains this '/' then replace it with a empty string
Code:
select [Address] as Address,REPLACE([Address],'/','') from customers
tnx for any help
salsa
-
Oct 12th, 2021, 02:56 AM
#2
Lively Member
Re: trying to replace function something not working
It looks like a query, if it is you have to write it like this:
Code:
SELECT Replace(Address. '/', '') As Address FROM customers
-
Oct 12th, 2021, 03:00 AM
#3
Thread Starter
Enjoy the moment
Re: trying to replace function something not working
not working amigo
still i can see the the symbo'/' in the adress field
example
sunsent blv 9/12
need to be
sunset blv 912
-
Oct 12th, 2021, 03:01 AM
#4
Thread Starter
Enjoy the moment
Re: trying to replace function something not working
table name - Customers field name - Adress
-
Oct 12th, 2021, 03:14 AM
#5
Re: trying to replace function something not working
This is a SQL question and has absolutely nothing to do with VB.NET. SQL questions belong in the Database Development forum. I have asked the mods to move this thread.
You should also specify what database you're using because syntax may vary from one to another.
-
Oct 12th, 2021, 07:50 AM
#6
Re: trying to replace function something not working
This doesn't look right:
Address.
Why the period? Maybe a comma?
Please remember next time...elections matter!
-
Oct 12th, 2021, 07:52 AM
#7
Thread Starter
Enjoy the moment
Re: trying to replace function something not working
Originally Posted by TysonLPrice
This doesn't look right:
Address.
Why the period? Maybe a comma?
also dosnt work
Code:
SELECT Replace(Address,'/', ' ') As Address FROM customers
-
Oct 12th, 2021, 08:29 AM
#8
Re: trying to replace function something not working
I think it is probably pilot error:
create table #Customers(address varchar(10))
insert into #Customers(address) values('123 / 456')
SELECT Address As Address FROM #customers
SELECT Replace(Address,'/', ' ') As Address FROM #customers
drop table #Customers
Please remember next time...elections matter!
-
Oct 12th, 2021, 08:59 AM
#9
Re: trying to replace function something not working
Moved to DB section
Your syntax looks correct.
Are you getting any error messages? Is this TSQL (SQLServer)? Can you show us the result your query is giving you?
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Oct 12th, 2021, 09:09 AM
#10
Thread Starter
Enjoy the moment
Re: trying to replace function something not working
Originally Posted by FunkyDexter
Moved to DB section
Your syntax looks correct.
Are you getting any error messages? Is this TSQL (SQLServer)? Can you show us the result your query is giving you?
NO ERROR friend.
it just dosnt do anything
example
sunsent blv 9/12
need to be
sunset blv 912
table name - Customers field name - Adress
-
Oct 12th, 2021, 09:30 AM
#11
Re: trying to replace function something not working
You are doing something wrong you are not showing us. It works!!! At least on Microsoft SQL Server. What are you using?
create table #Customers(address varchar(30))
insert into #Customers(address) values('sunsent blv 9/12')
SELECT Address As Address FROM #customers
SELECT Replace(Address,'/', ' ') As Address FROM #customers
drop table #Customers
Please remember next time...elections matter!
-
Oct 12th, 2021, 10:40 AM
#12
Re: trying to replace function something not working
Maybe you mean the extra space? Take it out:
Replace(Address,'/', '')
Please remember next time...elections matter!
-
Oct 12th, 2021, 10:41 AM
#13
Re: trying to replace function something not working
Are you trying to SELECT from the table and display it ... or UPDATE the data in the table (so that later selects will have the correct data)?
-tg
-
Oct 12th, 2021, 11:51 AM
#14
Thread Starter
Enjoy the moment
Re: trying to replace function something not working
Originally Posted by techgnome
Are you trying to SELECT from the table and display it ... or UPDATE the data in the table (so that later selects will have the correct data)?
-tg
UPDATE the data in the table (so that later selects will have the correct data)?
replace and update
-
Oct 12th, 2021, 12:00 PM
#15
Re: trying to replace function something not working
I'm done pulling teeth
Please remember next time...elections matter!
-
Oct 12th, 2021, 02:03 PM
#16
Re: [RESOLVED] trying to replace function something not working
So... try an UPDATE statement then... SET the Address to the replaced values...
It's not that hard.
UPDATE someTable
SET someField = someValue
Where SomeCondition
If you want to update all the rows in the table, don't have a where clause. Just the update and set.
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|