You are here: Re: sql datatype help « MsSQL Server « IT news, forums, messages
Re: sql datatype help

Posted by Simon Hayes on 09/13/05 12:47

1 is an integer, '01' is a string. If you want to pad your integers
with leading zeroes, it would be best to do it on the client side, as
that's usually the best place for presentation and formatting. If you
really need to do it when you retrieve the values from the database
then this is one possible way:

select
case when IntColumn between 0 and 9 then '0' + cast(IntColumn as
char(1)) else cast(IntColumn as varchar(10)) end
from dbo.MyTable

Simon

 

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

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