Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

inline if
I want to execute something like

select  iif(type='credit',am
ount*-1,amount) from table

how can i do that?  help file says iif is used in Multidimensional
Expressions but that seems overly complicated for this task.

any ideas?


Report this thread to moderator Post Follow-up to this message
Old Post
Dima Gofman
09-21-05 02:24 PM


Re: inline if
Dima Gofman (dg@cfa-solutions.com)  writes:
> I want to execute something like
>
> select  iif(type='credit',am
ount*-1,amount) from table
>
> how can i do that?  help file says iif is used in Multidimensional
> Expressions but that seems overly complicated for this task.

SELECT CASE type WHEN 'credit' THEN -1 ELSE 1 END * amount

See further the CASE expression in Books Online.


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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp


Report this thread to moderator Post Follow-up to this message
Old Post
Erland Sommarskog
09-21-05 02:24 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 02:23 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006