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 2005 Forums
 Transact-SQL (2005)
 Select query data replace space with underscore

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2009-10-22 : 12:41:29
Is it possible to have underscores replaced with spaces for field b.contractName?

select distinct a.progid, a.projid, b.contractid, b.contractno,b.contractName
from TABleUserAccess a,TABleContracts b
where a.userid=@UserId
and a.progid=@ProgID
and a.projid = @ProjID
and a.contractid = b.contractid

Thank you very much for the helpful info.

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-10-22 : 12:46:14
yes . you use the REPLACE function :)

select distinct a.progid, a.projid, b.contractid, b.contractno,REPLACE(b.contractName,'_', ' ') as F1IsYourFriend
from TABleUserAccess a,TABleContracts b
where a.userid=@UserId
and a.progid=@ProgID
and a.projid = @ProjID
and a.contractid = b.contractid

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -