How write this sentence with T-SQL

How write this sentence with T-SQL

am 18.07.2007 19:56:05 von simonshang

Hi, all friends. I'm using SQL-SERVER 2000.I have a table like this:
NIF Name
----------------------------------------
A-1234 Company1
B-123-B1 Company2
C-4568 Company4
D-453-DF Company5

I want delete the symbol "-" in the row "NIF". eg. A-1234 change to
A1234, D-453-DF to D453DF

So how can I write the sentence . Should I use the Stored Procedure?
Thank you very much!!
Simon

Re: How write this sentence with T-SQL

am 18.07.2007 21:26:55 von Hugo Kornelis

On Wed, 18 Jul 2007 10:56:05 -0700, simonshang@gmail.com wrote:

>I want delete the symbol "-" in the row "NIF". eg. A-1234 change to
>A1234, D-453-DF to D453DF

Hi Simon,

SELECT REPLACE(NIF, '-', '')
FROM YourTable;

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis

Re: How write this sentence with T-SQL

am 19.07.2007 02:48:49 von Ed Murphy

Hugo Kornelis wrote:

> On Wed, 18 Jul 2007 10:56:05 -0700, simonshang@gmail.com wrote:
>
>> I want delete the symbol "-" in the row "NIF". eg. A-1234 change to
>> A1234, D-453-DF to D453DF
>
> Hi Simon,
>
> SELECT REPLACE(NIF, '-', '')
> FROM YourTable;

Or, if you want to change the data in the table (not just the
data in your query output):

UPDATE YourTable
SET NIF = REPLACE(NIF, '-', '')