Quote Originally Posted by vuyiswam View Post
Thank you for your Help. i did it this way and its working.


Code:
ALTER PROC GET_BASED_PATTERN
(
@SUBJECT VARCHAR(30),
@Pattern  nvarchar(128) output 
)
AS
SET @Pattern = (SELECT TOP 1 TERM.[CYCLETEMPLATES]
FROM tbl_term TERM
INNER JOIN dbo.TBL_ACTV v 
on TERM.ID = V.TERM
INNER JOIN  DBO._Subjects S  ON 
V.TERM = S.[LEVEL]
WHERE CODE = @SUBJECT)
IF @Pattern is null Set @Pattern = '00000000'Select @Pattern
Thank you
Well - that approach seem to violate your first listed example, but it might be because of a bug in the first.
Because your first - the requirement was the pattern had to be larger then 1 in length so it had to be 2 characters or more.