adquery left join alias

时间:2012-11-12 13:08:02

标签: left-join alias

所以我有here的以下代码:

BEGIN
--Create a temp table for the AD results.
DECLARE @ADTest TABLE (Column0 varchar(200), Column1 varchar(200), Column2 varchar(200))
--Get the AD data using the stored procedure.
INSERT INTO @ADTest
EXEC sp_QueryAD 'SELECT adspath, samAccountName, objectGUID FROM ''LDAP://OU=IT,OU=Us,OU=We,OU=Tg,OU=Ts,DC=co,DC=te,DC=com'' WHERE objectclass=''user''', 1
--Join the temp table and production table from SQL Server to join the AD results SQL Data
select alias.* from dbo.ad_users alias LEFT JOIN @ADTest adresult on adresult.Column0 = alias.GUID
END

我从exec sp_queryAD获取结果,但是当我尝试加入两个表时,我得到0结果。我对sql很新,所以任何帮助都应该受到赞赏。我将表dbo设置为TeamDFW-TEST,将表作为ad_users。但我不确定如何设置桌子。

任何想法..谢谢......

0 个答案:

没有答案