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 2008 Forums
 Transact-SQL (2008)
 return a bit from Case varchar

Author  Topic 

Pete_N
Posting Yak Master

181 Posts

Posted - 2012-01-08 : 12:01:54
I need to return 'Marry' as a bit

SELECT Licence
,(SELECT ServiceID FROM dbo.client WHERE client.Licence = TranSet.Licence ) AS 'ServiceID'
,(SELECT AllowPayments FROM dbo.OAccount WHERE OAccount.OAccountID = TranSet.OAccountID) AS 'CREDITS'
,(SELECT AllowDebits FROM dbo.OAccount WHERE OAccount.OAccountID = TranSet.OAccountID) AS 'DEBITS'
,(SELECT AUDDISEnabled FROM client WHERE client.Licence = TranSet.Licence) AS 'AUDDIS'
,(Select TOP (1) CASE ISNULL(ClientLedger,'') WHEN '' THEN '0' ELSE '1' END
FROM TransactionIMP
WHERE TransactionIMP.LedgerKey = (SELECT CAST(@LedgerKey AS uniqueidentifier))) AS 'MARRY'
FROM dbo.TranSet
WHERE ledgerkey = (SELECT CAST(@LedgerKey AS uniqueidentifier))

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-08 : 13:45:18
CAST(CASE WHEN ISNULL(ClientLedger,'')='' THEN 0 ELSE 1 END AS bit) AS Marry

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Pete_N
Posting Yak Master

181 Posts

Posted - 2012-01-08 : 14:28:17
quote:
Originally posted by visakh16

CAST(CASE WHEN ISNULL(ClientLedger,'')='' THEN 0 ELSE 1 END AS bit) AS Marry

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/




cheers, that done the trick
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-08 : 23:14:41
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -