Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 CASE Function

Author  Topic 

obiwaugh
Starting Member

27 Posts

Posted - 2004-12-12 : 02:26:04
I'm trying to do this:

CASE "JOB"."ACTION"
WHEN 'TER' THEN '1'
ELSE '0'
END

I get this error saying that I can't use a varchar datatype as an argument....does this mean that the CASE function can only evaluate numerical fields? I didn't think that was the case....no pun intended.

What's going on here?

Kristen
Test

22859 Posts

Posted - 2004-12-12 : 03:46:26
Looks fine to me - provided that JOB.ACTION is a char/varchar field.

Post the full statement? Maybe the problem is elsewhere in the statement.

Kristen
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-12 : 10:07:21
CASE [JOB].[ACTION]
WHEN 'TER' THEN '1'
ELSE '0'
END

You don't have quoted identifiers on so " is taken as a string delimitter.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -