SQL Server除查询外不返回正确的Asnwer

时间:2015-08-20 12:43:57

标签: sql-server tsql

ALTER PROCEDURE [dbo].[sp_User_not_regestired_companies]
    @userId as int
AS
BEGIN
    select CompanyId, Name  
    from Company

    except

    select CompanyId, Name    
    from SecurityUserCompanyLevel
    where UserId = @userId 
END

我的问题是当我在select子句中写CompanyId时,它将返回正确的答案。当我在select子句中写Name时,它将返回所有公司的列表

0 个答案:

没有答案