Harreni
asked on
Fixing Table alias inside a dynamic SQL query
I had this question after viewing Fixing Temp Table inside dynamic query.
How to fix the table alias here:
Thanks a lot in advance.
Harreni
How to fix the table alias here:
DECLARE @AsIsTable nvarchar(MAX);
DECLARE @ChangingAsIsColumnsToTheEquivelantValuesSQL varchar (MAX);
SET @ChangingAsIsColumnsToTheEquivelantValuesSQL = N'SELECT
ID
,(SELECT ServiceTypeID FROM [dbo].[tb_List_ServiceType] WHERE ServiceTypeName = R.ServiceTypeName) As ServiceTypeID
FROM' +@AsIsTable + ' AS R';
EXECUTE(@ChangingAsIsColumnsToTheEquivelantValuesSQL)
Thanks a lot in advance.
Harreni
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER