[quoted text, click to view] On Mon, 5 Dec 2005 17:59:01 -0800, Tiffany wrote:
>Hi Hugo,
>
>I used the below script which you had given me.
>
>SELECT REPLACE(model, '-', '') FROM ctv_stage
>
>model is the column which i want to remove all the hyphens. ctv_stage is the
>table name. data type for model is varchar.
>
>May I know what is the problem.
Hi Tiffany,
Did you already check
www.aspfaq.com/5006, as I requested you two times
before? That article clearly describes the THREE elements I need to be
able to help you.
First: DDL, or CREATE TABLE statement.
Second: Sample data, in the form of INSERT statements.
Third: Desired results.
Here's an example of how you should build your next post. You can copy
and paste the SQL below into Query Analyzer and execute to see that the
results of this query are as I expect them: without hyphens. Now please
post ssome SQL that I can run on my end to reproduce your problem.
Without that, I'm unable to help you further.
-- Create a table for testing
CREATE TABLE ctv_stage
(model varchar(100) NOT NULL)
go
-- Put some sample data in it
INSERT INTO ctv_stage (model)
SELECT '1200LD-VCD'
UNION ALL
SELECT 'abc-1234'
UNION ALL
SELECT 'abc-ded-123-dvd'
UNION ALL
SELECT 'No hyphens here'
go
-- Check test data
SELECT model FROM ctv_stage
-- Test the query
SELECT REPLACE(model, '-', '') FROM ctv_stage
go
-- Clean up my test DB
DROP TABLE ctv_stage
This is the output I got when running the scribt above:
model
------------------
1200LD-VCD
abc-1234
abc-ded-123-dvd
No hyphens here
------------------
1200LDVCD
abc1234
abcded123dvd
No hyphens here
Best, Hugo
--