You are here: Re: Simple function for returning a character based on search criteria.. « MsSQL Server « IT news, forums, messages
Re: Simple function for returning a character based on search criteria..

Posted by Erland Sommarskog on 02/20/07 22:57

Jorgen [DK/2600] (nyhedsgruppe_hejhej_@gmail.com) writes:
> Ah.. this one is actually a bit more complex.
>
> My problem is that in a amount field I have both % and Quantity mixed
> together. So the formula should check the "format" column for the amount
> field, if the format columns contains "%" it return the value - if not, i
> writes zero in my expression.

SELECT CASE format WHEN '%' THEN amount ELSE 0 END

I don't know if this fits your bill. But if it does not, please post:

o CREATE TABLE statement for your table(s)
o INSERT statements with sample data.
o The desired result given the sample.

This helps to clarify what you are looking for, and makes it easy to copy
and paste to develop a tested solution.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

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

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