> Does SQL have an equivalent to DECODE?

Yes - CASE. Here's a comparison from SQL Server Books Online:

Oracle:
DECODE (test_value,
expression1, value1
[[,expression2, value2] [...]]
[,default_value]
)

SQL Server:
CASE test_value
WHEN expression1 THEN value1
[[WHEN expression2 THEN value2] [...]]
[ELSE default_value]
END

In addition, T-SQL provides several functions which provide similar if-then
functionality, such as NULLIF and COALESCE.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to