Create procedure [dbo].[proc_Search_Username](@username varchar(25))
as
begin
Declare @AccStatus int
Set @AccStatus = 15
while (@AccStatus = (select account_status from users where username like @username+'%'))
begin
select username from users where username like @username+'%'
end
end
In above Stored Procedure i want to get all users info.. whose username start with "a" at the same time i want to check they account is active or inactive if account is inactive i dont want to display they information... Only active user info.