Hi Guys,
I am trying to run a dynamic query but for some odd reason its not running. Its not even printing. Please can anyone tell me why is the below dynamic query not printing.
DECLARE @CLIENTPK_NEW AS VARCHAR(50)
DECLARE @CGNEEPK AS VARCHAR(50)
DECLARE @TYPE AS VARCHAR(10)
SET @CLIENTPK_NEW='6EF77AAA-1A7B-4D03-A448-D1088DED4134'
SET @CGNEEPK= NULL
SET @TYPE='Mag'
DECLARE @SQL NVARCHAR(MAX)
SET @SQL = '
SELECT
PUBLISHER
FROM CLIENT_SHIPPINGREPORTDATA_FUNCTION('
+ @CLIENTPK_NEW + ' , '
+ @CGNEEPK + ' , '
+ @TYPE +' )' <=== This is the troubled line, but not sure what is error is.
PRINT @SQL <== **Why is this not priniting**
Many thanks