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)
 assign variable to case

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2007-11-26 : 06:12:22
Hi,
looking at the following query, how do I assign a vatiable such as @Bid to the field Bid_Size please?

select Bid_Size =
case
when charindex('A', ltrim(rtrim(Bid_Size))) > 0 then replace(Bid_Size, 'A', '')
end
from
tblPricesSourcesImportHistory

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2007-11-26 : 06:45:05
select @bid =
case Bid_Size
when charindex('A', ltrim(rtrim(Bid_Size))) > 0 then replace(Bid_Size, 'A', '')
end
from
tblPricesSourcesImportHistory
Go to Top of Page
   

- Advertisement -