The table contains the Persons data and the Enterprise ID of their manager. Can get the Managers name using the txtManagerEnterpriseID at the same time like so
Name ManagerID Manager name
Fred 12345 Sally
Getting Error: A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
DougP
Name ManagerID Manager name
Fred 12345 Sally
Getting Error: A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
Code:
Declare @Managername as nvarchar(100)
Declare @ManagerEID as nvarchar(20)
Select txtEnterpriseID ,
txtSurName + ', ' + txtGivenName as 'Name' ,
txtManagerEnterpriseID ,
@ManagerEID = txtManagerEnterpriseID,
@Managername ,
txtEmployeeID ,
(Select txtSurName + ', ' + txtGivenName
as 'ManagerName' from dbo.tblLDAP
Where txtManagerEnterpriseID = @ManagerEID) ,
From dbo.tblLDAP
DougP