Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Replace not working on 2k db in 6.5 compatibility mode

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-02-08 : 07:49:33
John writes "Select Replace('N0P 2L0',' ','') will not return 'N0P2L0' when I run it in query analyzer on a db in 6.5 compatibility mode.

If I change it to Select Replace('N0P 2L0',' ','X') I get 'N0PX2L0' as expected.

Anyone encounter this before?

Is there a workaround, or a setting on the server that controls this?

Thanks in Advance for any help.

John"

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-02-08 : 16:04:29
In SQL Server v6.5 and below an empty string ('') is defined to be a string containing exactly one space character. So your code is dutifully replacing a single space with a single space.

Can you REPLACE 'P ' with 'P'?

HTH

=================================================================
Egotism is the anesthetic that dulls the pain of stupidity. -Frank William Leahy, football coach (1908-1973)
Go to Top of Page
   

- Advertisement -