You are here: Re: Converting a varchar to int « MsSQL Server « IT news, forums, messages
Re: Converting a varchar to int

Posted by Ed Murphy on 12/13/06 04:25

Erland Sommarskog wrote:

> Ed Murphy (emurphy42@socal.rr.com) writes:

>> SELECT Loan#
>> FROM Table1
>> WHERE '-'+Codes+'-' like '-2-'
>> OR '-'+Codes+'-' like '-13-'
>> OR '-'+Codes+'-' like '-1-'
>
> Seems like some % are missing.

Yes, of course you're right, should be

WHERE '-'+Codes+'-' like '%-2-%'
OR '-'+Codes+'-' like '%-13-%'
OR '-'+Codes+'-' like '%-1-%'

but the approach of "use a stored procedure to copy the data to a
better-normalized table" is probably better. (Oh, and that new
table should probably have an index on the Code column.)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация