USE [son_db]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[udfCsdDes]
(
@baid VARCHAR(8),
@cknum VARCHAR(8),
@ckline INT
)
RETURNS VARCHAR(4800) AS
BEGIN
DECLARE @description VARCHAR(4800)
SELECT @description = ''
SELECT @description = @description + ' ' + des FROM csddes WHERE baid = @baid AND cknum = @cknum AND ckline = @ckline ORDER BY dsline
RETURN LTRIM(RTRIM(@description))
END
You can call this udf in any query by passing the bankid, check number and check line variable, typically from the csddt table. Example will follow in the next post.
No comments:
Post a Comment