sql server - How to avoid going throw (select case when)- cases that takes a lot of time -
i must work bank-statements means have work big string , cut small parts able order every line bills belongs. far good. problem patindex
, charindex
, substring
take lot of time when has work "big data". example, have 100 (string) lines in bank statement have able order every line right bill. 100 lines, there 90% simple cases not take time because simple substring work. rest of 10%, there lot of work takes time. problem if select case when sql-code takes same time in case have 100% of lines complicated or 5% of them. means each line whole code evaluated , right decision taken problem.
how can avoid this?
select case when @var = 'bla' do-something takes 10 min evaluated when @var = 'john' do-something takes 5 min evaluated when @var = 'sarah' do-something takes short time else do-somethig takes 10 min evaulated.
now when data 4000 lines 'sarah' in of them takes same time if data 'bla' takes lot of time. means cases every time evaluated no matter kind of them , decided case right one. or did miss here?
Comments
Post a Comment