set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[ListUserName] @Gid int=0, @ActiveOnly bit=0 AS if @gid=0 SELECT UName, UID, GID, SecureLevel, PassWord, Disable FROM Users WHERE (not (Disable = @ActiveOnly) OR Disable = 0 OR Disable is null) order by uname else SELECT UName, UID, GID, SecureLevel, PassWord, Disable FROM Users WHERE (GID = @gid and (not (Disable = @ActiveOnly) OR Disable = 0 OR Disable is null)) order by uname