Showing posts with label character. Show all posts
Showing posts with label character. Show all posts

Wednesday, March 28, 2012

remove character from string

Hi I am filling a table with a select statement and one of the columns
(Time1data)returned from the select statement looks like 10:30, it is a
character type. The table I am trying to put it in is expecting 1030 and is
character 4 type. Just wondering if anyone knows how to remove the : as part
of the select statement?
I tried select Right (Time1data,4) but this just gets the right 4 characters.
Thanks.
Paul G
Software engineer.
Hi Paul,
You can use REPLACE, like this:
SELECT REPLACE(Time1data, ':', '')
FROM ...
HTH,
Plamen Ratchev
http://www.SQLStudio.com
|||It worked! thanks.
Paul G
Software engineer.
"Plamen Ratchev" wrote:

> Hi Paul,
> You can use REPLACE, like this:
> SELECT REPLACE(Time1data, ':', '')
> FROM ...
> HTH,
> Plamen Ratchev
> http://www.SQLStudio.com
sql

remove character from string

Hi I am filling a table with a select statement and one of the columns
(Time1data)returned from the select statement looks like 10:30, it is a
character type. The table I am trying to put it in is expecting 1030 and is
character 4 type. Just wondering if anyone knows how to remove the : as part
of the select statement?
I tried select Right (Time1data,4) but this just gets the right 4 characters.
Thanks.
--
Paul G
Software engineer.Hi Paul,
You can use REPLACE, like this:
SELECT REPLACE(Time1data, ':', '')
FROM ...
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||It worked! thanks.
--
Paul G
Software engineer.
"Plamen Ratchev" wrote:
> Hi Paul,
> You can use REPLACE, like this:
> SELECT REPLACE(Time1data, ':', '')
> FROM ...
> HTH,
> Plamen Ratchev
> http://www.SQLStudio.com

remove character from string

Hi I am filling a table with a select statement and one of the columns
(Time1data)returned from the select statement looks like 10:30, it is a
character type. The table I am trying to put it in is expecting 1030 and is
character 4 type. Just wondering if anyone knows how to remove the : as par
t
of the select statement?
I tried select Right (Time1data,4) but this just gets the right 4 characters
.
Thanks.
--
Paul G
Software engineer.Hi Paul,
You can use REPLACE, like this:
SELECT REPLACE(Time1data, ':', '')
FROM ...
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||It worked! thanks.
--
Paul G
Software engineer.
"Plamen Ratchev" wrote:

> Hi Paul,
> You can use REPLACE, like this:
> SELECT REPLACE(Time1data, ':', '')
> FROM ...
> HTH,
> Plamen Ratchev
> http://www.SQLStudio.com

Remove Character from a table?

I have a table that has several entries.
Some of these entries have $ in them.
I don't want to manually go through all of these and remove the $, so I'm
wondering if there's an easy way to do this with a script or something?
Thanks,
Terry"Terry Matthews" wrote:

>I have a table that has several entries.
> Some of these entries have $ in them.
> I don't want to manually go through all of these and remove the $, so I'm
> wondering if there's an easy way to do this with a script or something?
> Thanks,
> Terry
I believe you want to update using the REPLACE function...
UPDATE SomeTable
SET SomeField = REPLACE(SomeField, '$', '')
WHERE SomeField LIKE '%$%'
Craig|||Terry Matthews (nospam@.hotmail.com) writes:
> I have a table that has several entries.
> Some of these entries have $ in them.
> I don't want to manually go through all of these and remove the $, so I'm
> wondering if there's an easy way to do this with a script or something?
UPDATE tbl
SET col = replace(col, '$', '')
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Great thanks, worked perfectly.
Just put in the column name instead of "somefield"
Thanks
Terry
"Craig Kelly" <cnkelly@.spamnomore.worldnet.att.net> wrote in message
news:gJS9f.11244$qk4.5037@.bgtnsc05-news.ops.worldnet.att.net...
> "Terry Matthews" wrote:
>
> I believe you want to update using the REPLACE function...
> UPDATE SomeTable
> SET SomeField = REPLACE(SomeField, '$', '')
> WHERE SomeField LIKE '%$%'
> Craig
>

Remove Character from a table?

I have a table that has several entries.
Some of these entries have $ in them.
I don't want to manually go through all of these and remove the $, so I'm
wondering if there's an easy way to do this with a script or something?
Thanks,
Terry
"Terry Matthews" wrote:

>I have a table that has several entries.
> Some of these entries have $ in them.
> I don't want to manually go through all of these and remove the $, so I'm
> wondering if there's an easy way to do this with a script or something?
> Thanks,
> Terry
I believe you want to update using the REPLACE function...
UPDATE SomeTable
SET SomeField = REPLACE(SomeField, '$', '')
WHERE SomeField LIKE '%$%'
Craig
|||Terry Matthews (nospam@.hotmail.com) writes:
> I have a table that has several entries.
> Some of these entries have $ in them.
> I don't want to manually go through all of these and remove the $, so I'm
> wondering if there's an easy way to do this with a script or something?
UPDATE tbl
SET col = replace(col, '$', '')
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
|||Great thanks, worked perfectly.
Just put in the column name instead of "somefield"
Thanks
Terry
"Craig Kelly" <cnkelly@.spamnomore.worldnet.att.net> wrote in message
news:gJS9f.11244$qk4.5037@.bgtnsc05-news.ops.worldnet.att.net...
> "Terry Matthews" wrote:
>
> I believe you want to update using the REPLACE function...
> UPDATE SomeTable
> SET SomeField = REPLACE(SomeField, '$', '')
> WHERE SomeField LIKE '%$%'
> Craig
>

Remove Character from a table?

I have a table that has several entries.
Some of these entries have $ in them.
I don't want to manually go through all of these and remove the $, so I'm
wondering if there's an easy way to do this with a script or something?
Thanks,
Terry"Terry Matthews" wrote:

>I have a table that has several entries.
> Some of these entries have $ in them.
> I don't want to manually go through all of these and remove the $, so I'm
> wondering if there's an easy way to do this with a script or something?
> Thanks,
> Terry
I believe you want to update using the REPLACE function...
UPDATE SomeTable
SET SomeField = REPLACE(SomeField, '$', '')
WHERE SomeField LIKE '%$%'
Craig|||Terry Matthews (nospam@.hotmail.com) writes:
> I have a table that has several entries.
> Some of these entries have $ in them.
> I don't want to manually go through all of these and remove the $, so I'm
> wondering if there's an easy way to do this with a script or something?
UPDATE tbl
SET col = replace(col, '$', '')
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Great thanks, worked perfectly.
Just put in the column name instead of "somefield"
Thanks
Terry
"Craig Kelly" <cnkelly@.spamnomore.worldnet.att.net> wrote in message
news:gJS9f.11244$qk4.5037@.bgtnsc05-news.ops.worldnet.att.net...
> "Terry Matthews" wrote:
>
> I believe you want to update using the REPLACE function...
> UPDATE SomeTable
> SET SomeField = REPLACE(SomeField, '$', '')
> WHERE SomeField LIKE '%$%'
> Craig
>sql

Remove Character from a table?

I have a table that has several entries.
Some of these entries have $ in them.
I don't want to manually go through all of these and remove the $, so I'm
wondering if there's an easy way to do this with a script or something?
Thanks,
Terry"Terry Matthews" wrote:
>I have a table that has several entries.
> Some of these entries have $ in them.
> I don't want to manually go through all of these and remove the $, so I'm
> wondering if there's an easy way to do this with a script or something?
> Thanks,
> Terry
I believe you want to update using the REPLACE function...
UPDATE SomeTable
SET SomeField = REPLACE(SomeField, '$', '')
WHERE SomeField LIKE '%$%'
Craig|||Terry Matthews (nospam@.hotmail.com) writes:
> I have a table that has several entries.
> Some of these entries have $ in them.
> I don't want to manually go through all of these and remove the $, so I'm
> wondering if there's an easy way to do this with a script or something?
UPDATE tbl
SET col = replace(col, '$', '')
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp|||Great thanks, worked perfectly.
Just put in the column name instead of "somefield"
Thanks
Terry
"Craig Kelly" <cnkelly@.spamnomore.worldnet.att.net> wrote in message
news:gJS9f.11244$qk4.5037@.bgtnsc05-news.ops.worldnet.att.net...
> "Terry Matthews" wrote:
>>I have a table that has several entries.
>> Some of these entries have $ in them.
>> I don't want to manually go through all of these and remove the $, so I'm
>> wondering if there's an easy way to do this with a script or something?
>> Thanks,
>> Terry
> I believe you want to update using the REPLACE function...
> UPDATE SomeTable
> SET SomeField = REPLACE(SomeField, '$', '')
> WHERE SomeField LIKE '%$%'
> Craig
>

Monday, March 26, 2012

Remove a character from a string

Hi All,

Please guide me how to completely remove a particular character from a string in Sql Server 2000 and display remaining characters of the string.

Thanks in advance.

Regards
Prasanthideclare @.mytxt varchar(50)
set @.mytxt = 'abc123def'

--remove the 2 from the string
set @.mytxt = replace(@.mytxt, '2', '')
select @.mytxt|||Run this simple Query
this will Replace all s from the name field with blank

select replace(name,'s','') from sysobjects