CREATE FUNCTION fn_GetSMSCreditBalance (@customerCode VARCHAR(50))
RETURNS INT
AS 
BEGIN
   RETURN
	(SELECT	SUM(ISNULL(S.qty,0))
	FROM	pal_SMSCreditLog S
	WHERE	S.customerCode = @customerCode)
END
