Avatar of Will
Will
Flag for United States of America asked on

Trying to convert the following sql query (msssql) into a Parameter for execution. I am completely lost how to place the apostrophes. Can someone get me started? Thanks

set @SQL=
SELECT 

@DP= Y.times.query('DateDispatched').value('.', 'varchar(19)'),
@ER=Y.times.query('DateEnroute').value('.', 'varchar(19)')

FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK @FILENAME,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes('/PCRDATA/Times') AS Y(Times)
	if exists(select* from [dbo].[MICU] where PRID=@PRID)	
	UPDATE  [dbo].[MICU] 
	
	SET dbo.MICU.Dispatched= @DP,dbo.MICU.Enroute= @er
	where dbo.MICU.PRID=@PRID

ELSE

 INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values(@PRID,@DP,@er)

Open in new window

Microsoft SQL ServerSQL

Avatar of undefined
Last Comment
Pawan Kumar

8/22/2022 - Mon
Pawan Kumar

Please use this . I have handled the single quotes for your.

set @SQL= '
SELECT 
@DP= Y.times.query(''DateDispatched'').value(''.'', ''varchar(19)''),
@ER=Y.times.query(''DateEnroute'').value(''.'', ''varchar(19)'')

FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK ' + @FILENAME + ' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes(''/PCRDATA/Times'') AS Y(Times)
	if exists(select* from [dbo].[MICU] where PRID= ' + @PRID + ' )	
	UPDATE  [dbo].[MICU] 
	
	SET dbo.MICU.Dispatched=  ' + @DP + ' ,dbo.MICU.Enroute=  ' + @er + ' 
	where dbo.MICU.PRID= ' + @PRID + '
ELSE
 INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values( ' + @PRID + ',' + @DP + ' , ' + @er + ')'

Open in new window

Will

ASKER
Thank you Pawan.  I get the following error when executing.  I am thinking I may still be missing an '
Msg 245, Level 16, State 1, Procedure MICU_XML3, Line 33
Conversion failed when converting the varchar value '
SELECT 
@DP= Y.times.query('DateDispatched').value('.', 'varchar(19)'),
@ER=Y.times.query('DateEnroute').value('.', 'varchar(19)')

FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK c:\pcr\xml\48633430.XML ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes('/PCRDATA/Times') AS Y(Times)
	if exists(select* from [dbo].[MICU] where PRID= ' to data type int.

Open in new window

Will

ASKER
I looked a little more carefully,  looks like the filename is not wrapped in '    tried a couple of variants didn't work.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Will

ASKER
I was able to get the ' wrapped around the filename still get same error
Will

ASKER
Msg 245, Level 16, State 1, Procedure MICU_XML3, Line 33
Conversion failed when converting the varchar value '
SELECT 
@DP= Y.times.query('DateDispatched').value('.', 'varchar(19)'),
@ER=Y.times.query('DateEnroute').value('.', 'varchar(19)')

FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK 'c:\pcr\xml\48633430.XML' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes('/PCRDATA/Times') AS Y(Times)
	if exists(select* from [dbo].[MICU] where PRID=' to data type int.

Open in new window

Will

ASKER
My primary key is an int and my @prid is an int  do I have to construct the query differently with the apostrophes?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Pawan Kumar

could you please give me data types of
@PRID , @DP , @er
Pawan Kumar

Please use this.. Updated ..

DECLARE @FILENAME AS VARCHAR(100) = 'Pawan.txt'
DECLARE @DP AS VARCHAR(100) = 'Package'
DECLARE @PRID INT = 10
DECLARE @er AS VARCHAR(12) = 'Err'
DECLARE @SQL AS VARCHAR(MAX) = ''

set @SQL= '
SELECT 
@DP= Y.times.query(''DateDispatched'').value(''.'', ''varchar(19)''),
@ER=Y.times.query(''DateEnroute'').value(''.'', ''varchar(19)'')

FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK ' + '''' + @FILENAME + '''' + ' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes(''/PCRDATA/Times'') AS Y(Times)
	if exists(select* from [dbo].[MICU] where PRID= ' + '''' + CAST(@PRID AS VARCHAR(200)) + '''' + ' )	
	UPDATE  [dbo].[MICU] 
	
	SET dbo.MICU.Dispatched=  ' + ''''+ @DP + '''' + ' ,dbo.MICU.Enroute=  ' + '''' + @er + '''' + ' 
	where dbo.MICU.PRID= ' + '''' + CAST(@PRID AS VARCHAR(200)) + '''' + '
ELSE
 INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values( ' + '''' + CAST(@PRID AS VARCHAR(200)) + '''' 
	+ ',' + '''' + @DP + '''' + '  , ' + '''' + @er + '''' + ')'

EXEC (@SQL)

Open in new window

Will

ASKER
Good morning.  Thanks again

@PRID , @DP , @er are all varchar(20).  The changes didn't work.  for some reason the query returns a null for @sql (have it updated a separate data table
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Pawan Kumar

can you run below and give me output of the below print statement.
Pass your actual values.

DECLARE @FILENAME AS VARCHAR(100) = 'Pawan.txt'
DECLARE @DP AS VARCHAR(100) = 'Package'
DECLARE @PRID INT = 10
DECLARE @er AS VARCHAR(12) = 'Err'
DECLARE @SQL AS VARCHAR(MAX) = ''

set @SQL= '
SELECT 
@DP= Y.times.query(''DateDispatched'').value(''.'', ''varchar(19)''),
@ER=Y.times.query(''DateEnroute'').value(''.'', ''varchar(19)'')

FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK ' + '''' + @FILENAME + '''' + ' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes(''/PCRDATA/Times'') AS Y(Times)
	if exists(select* from [dbo].[MICU] where PRID= ' + '''' + CAST(@PRID AS VARCHAR(200)) + '''' + ' )	
	UPDATE  [dbo].[MICU] 
	
	SET dbo.MICU.Dispatched=  ' + ''''+ @DP + '''' + ' ,dbo.MICU.Enroute=  ' + '''' + @er + '''' + ' 
	where dbo.MICU.PRID= ' + '''' + CAST(@PRID AS VARCHAR(200)) + '''' + '
ELSE
 INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values( ' + '''' + CAST(@PRID AS VARCHAR(200)) + '''' 
	+ ',' + '''' + @DP + '''' + '  , ' + '''' + @er + '''' + ')'

PRINT (@SQL)

Open in new window

Will

ASKER
SELECT
@DP= Y.times.query('DateDispatched').value('.', 'varchar(19)'),
@ER=Y.times.query('DateEnroute').value('.', 'varchar(19)')

FROM (
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK 'Pawan.txt' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes('/PCRDATA/Times') AS Y(Times)
      if exists(select* from [dbo].[MICU] where PRID= '10' )      
      UPDATE  [dbo].[MICU]
      
      SET dbo.MICU.Dispatched=  'Package' ,dbo.MICU.Enroute=  'Err'
      where dbo.MICU.PRID= '10'
ELSE
 INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values( '10','Package'  , 'Err')
Pawan Kumar

Now please execute your last statement with actual parameters and give me the errors you are getting.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Will

ASKER
I tried a print of it and go no re
declare @DP varchar(20)
declare @ER varchar(20)
declare @ATS varchar(20)
declare @ATP varchar(20)
declare @TODEST varchar(20)
declare @TRANSFER varchar(20)
declare @AVAIL varchar(20)
declare @DISPATCHLATLON varchar(25)
declare @INCIDENTLOC varchar(30)
DECLARE @SCENELONLAT VARCHAR(30)
declare @PRID int set  @PRID=48633430
declare @PRID_S varchar(10) set @PRID_S='48633430'
declare @FILENAME VARCHAR(30) SET @FILENAME='c:\pcr\xml\'+@PRID_S+'.XML'
DECLARE @SQL AS VARCHAR(MAX) = '';
-- @PRID=47697063;


set @SQL= '
SELECT 
@DP= Y.times.query(''DateDispatched'').value(''.'', ''varchar(19)''),
@ER=Y.times.query(''DateEnroute'').value(''.'', ''varchar(19)'')

FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK ' + '''' + @FILENAME + '''' + ' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes(''/PCRDATA/Times'') AS Y(Times)
	if exists(select* from [dbo].[MICU] where PRID= ' + '''' + CAST(@PRID AS VARCHAR(200)) + '''' + ' )	
	UPDATE  [dbo].[MICU] 
	
	SET dbo.MICU.Dispatched=  ' + ''''+ @DP + '''' + ' ,dbo.MICU.Enroute=  ' + '''' + @er + '''' + ' 
	where dbo.MICU.PRID= ' + '''' + CAST(@PRID AS VARCHAR(200)) + '''' + '
ELSE
 INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values( ' + '''' + CAST(@PRID AS VARCHAR(200)) + '''' 
	+ ',' + '''' + @DP + '''' + '  , ' + '''' + @er + '''' + ')'

print (@SQL)

Open in new window

sponse
Pawan Kumar

Thanks, checking.
Will

ASKER
Thank you!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Pawan Kumar

Update code for you .

declare @DP varchar(20)  = 'DP'
declare @ER varchar(20) = 'Enroute'
declare @ATS varchar(20) 
declare @ATP varchar(20)
declare @TODEST varchar(20)
declare @TRANSFER varchar(20)
declare @AVAIL varchar(20)
declare @DISPATCHLATLON varchar(25)
declare @INCIDENTLOC varchar(30)
DECLARE @SCENELONLAT VARCHAR(30)
declare @PRID int set  @PRID=48633430
declare @PRID_S varchar(10) set @PRID_S='48633430'
declare @FILENAME VARCHAR(30) SET @FILENAME='c:\pcr\xml\'+@PRID_S+'.XML'
DECLARE @SQL AS VARCHAR(MAX) = '';
-- @PRID=47697063;

set @SQL= 
'SELECT 
@DP= Y.times.query(''DateDispatched'').value(''.'', ''varchar(19)''),
@ER=Y.times.query(''DateEnroute'').value(''.'', ''varchar(19)'')
FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK ' + '''' + @FILENAME + '''' + ' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes(''/PCRDATA/Times'') AS Y(Times)
if exists( select TOP 1 1 from [dbo].[MICU] where PRID= ' + '''' + @PRID_S + '''' + ' )	
	UPDATE [dbo].[MICU]	
	SET dbo.MICU.Dispatched= ' +'''' + @DP + '''' + ',dbo.MICU.Enroute= ' + '''' + @ER + '''' + 
	' WHERE dbo.MICU.PRID = ' + '''' + @PRID_S + '''' + '
ELSE
INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values('	+ '''' + @PRID_S + '''' + ',' + '''' + @DP + '''' + ',' + '''' + @ER + '''' + ')'
PRINT (@SQL)

Open in new window


OUTPUT I am getting..

/*------------------------
OUTPUT
------------------------*/
SELECT 
@DP= Y.times.query('DateDispatched').value('.', 'varchar(19)'),
@ER=Y.times.query('DateEnroute').value('.', 'varchar(19)')
FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK 'c:\pcr\xml\48633430.XML' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes('/PCRDATA/Times') AS Y(Times)
if exists( select TOP 1 1 from [dbo].[MICU] where PRID= '48633430' )	
	UPDATE [dbo].[MICU]	
	SET dbo.MICU.Dispatched= 'DP',dbo.MICU.Enroute= 'Enroute' WHERE dbo.MICU.PRID = '48633430'
ELSE
INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values('48633430','DP','Enroute')

Open in new window

Will

ASKER
Looks like my bulk import is not working.  set ER and DP to 'err' and query prints

SELECT 
@DP= Y.times.query('DateDispatched').value('.', 'varchar(19)'),
@ER=Y.times.query('DateEnroute').value('.', 'varchar(19)')

FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK 'c:\pcr\xml\48633430.XML' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes('/PCRDATA/Times') AS Y(Times)
	if exists(select* from [dbo].[MICU] where PRID= '48633430' )	
	UPDATE  [dbo].[MICU] 
	
	SET dbo.MICU.Dispatched=  'ERR_DP' ,dbo.MICU.Enroute=  'ERR_ER' 
	where dbo.MICU.PRID= '48633430'
ELSE
 INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values( '48633430','ERR_DP'  , 'ERR_ER')

Open in new window

Pawan Kumar

Are you getting data from this ?
SELECT 
@DP= Y.times.query('DateDispatched').value('.', 'varchar(19)'),
@ER=Y.times.query('DateEnroute').value('.', 'varchar(19)')
FROM 
( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK 'c:\pcr\xml\48633430.XML' ,
     SINGLE_BLOB) AS T(y)
) AS T(y)
CROSS APPLY y.nodes('/PCRDATA/Times') AS Y(Times)

Open in new window

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Will

ASKER
Works!!  what was the error?
Pawan Kumar

Great ...

We missed this ..assignment.

declare @DP varchar(20)  = ''
declare @ER varchar(20) = ''

if we use this declare @DP varchar(20) then the dynamic string does not work as it is NULL so we have set it ''.
Will

ASKER
Msg 137, Level 15, State 1, Line 2
Must declare the scalar variable "@DP".
Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'AS'.
SELECT 
@DP= Y.times.query('DateDispatched').value('.', 'varchar(19)'),
@ER=Y.times.query('DateEnroute').value('.', 'varchar(19)')
FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK 'c:\pcr\xml\48633430.XML' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes('/PCRDATA/Times') AS Y(Times)
if exists( select TOP 1 1 from [dbo].[MICU] where PRID= '48633430' )	
	UPDATE [dbo].[MICU]	
	SET dbo.MICU.Dispatched= 'DP',dbo.MICU.Enroute= 'Enroute' WHERE dbo.MICU.PRID = '48633430'
ELSE
INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values('48633430','DP','Enroute')

(1 row(s) affected)

Open in new window

Your help has saved me hundreds of hours of internet surfing.
fblack61
Pawan Kumar

Please use this complete code.

DECLARE @DP varchar(20) = ''
DECLARE @ER varchar(20) = ''
DECLARE @PRID int set  @PRID=48633430
DECLARE @PRID_S varchar(10) set @PRID_S='48633430'
DECLARE @FILENAME VARCHAR(30) SET @FILENAME='c:\pcr\xml\'+@PRID_S+'.XML'
DECLARE @SQL AS VARCHAR(MAX) = '';
SET @SQL= 
'SELECT 
@DP= Y.times.query(''DateDispatched'').value(''.'', ''varchar(19)''),
@ER=Y.times.query(''DateEnroute'').value(''.'', ''varchar(19)'')
FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK ' + '''' + @FILENAME + '''' + ' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes(''/PCRDATA/Times'') AS Y(Times)
if exists( select TOP 1 1 from [dbo].[MICU] where PRID= ' + '''' + @PRID_S + '''' + ' )	
	UPDATE [dbo].[MICU]	
	SET dbo.MICU.Dispatched= ' +'''' + @DP + '''' + ',dbo.MICU.Enroute= ' + '''' + @ER + '''' + 
	' WHERE dbo.MICU.PRID = ' + '''' + @PRID_S + '''' + '
ELSE
INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values('	+ '''' + @PRID_S + '''' + ',' + '''' + @DP + '''' + ',' + '''' + @ER + '''' + ')'
EXEC(@SQL)

Open in new window

Will

ASKER
looks like its failing here:

@DP= Y.times.query(''DateDispatched'').value(''.'', ''varchar(19)''),
@ER=Y.times.query(''DateEnroute'').value(''.'', ''varchar(19)'')
Pawan Kumar

Please use this --complete code-

DECLARE @DP varchar(20) = ''
DECLARE @ER varchar(20) = ''
DECLARE @PRID int set  @PRID=48633430
DECLARE @PRID_S varchar(10) set @PRID_S='48633430'
DECLARE @FILENAME VARCHAR(30) SET @FILENAME='c:\pcr\xml\'+@PRID_S+'.XML'
DECLARE @SQL AS VARCHAR(MAX) = '';
SET @SQL= 
'SELECT 
@DP= Y.times.query(''DateDispatched'').value(''.'', ''varchar(19)''),
@ER=Y.times.query(''DateEnroute'').value(''.'', ''varchar(19)'')
FROM ( 
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK ' + '''' + @FILENAME + '''' + ' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes(''/PCRDATA/Times'') AS Y(Times)
if exists( select TOP 1 1 from [dbo].[MICU] where PRID= ' + '''' + @PRID_S + '''' + ' )	
	UPDATE [dbo].[MICU]	
	SET dbo.MICU.Dispatched= ' +'''' + @DP + '''' + ',dbo.MICU.Enroute= ' + '''' + @ER + '''' + 
	' WHERE dbo.MICU.PRID = ' + '''' + @PRID_S + '''' + '
ELSE
INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values('	+ '''' + @PRID_S + '''' + ',' + '''' + @DP + '''' + ',' + '''' + @ER + '''' + ')'
EXEC(@SQL)

Open in new window

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Will

ASKER
same problem :

Msg 137, Level 15, State 1, Line 2
Must declare the scalar variable "@DP".
Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'AS'.
SELECT
@DP= Y.times.query('DateDispatched').value('.', 'varchar(19)'),
@ER=Y.times.query('DateEnroute').value('.', 'varchar(19)')
FROM (
SELECT CAST(y AS XML)
FROM OPENROWSET(
     BULK 'c:\pcr\xml\48633430.XML' ,
     SINGLE_BLOB) AS T(y)
     ) AS T(y)
CROSS APPLY y.nodes('/PCRDATA/Times') AS Y(Times)
if exists( select TOP 1 1 from [dbo].[MICU] where PRID= '48633430' )      
      UPDATE [dbo].[MICU]      
      SET dbo.MICU.Dispatched= '',dbo.MICU.Enroute= '' WHERE dbo.MICU.PRID = '48633430'
ELSE
INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values('48633430','','')
Pawan Kumar

Got the error. Checking.
Pawan Kumar

Please use this ..

DECLARE @DP varchar(20) = ''
DECLARE @ER varchar(20) = ''
DECLARE @PRID int set  @PRID=48633430
DECLARE @PRID_S varchar(10) set @PRID_S='48633430'
DECLARE @FILENAME VARCHAR(30) SET @FILENAME='c:\pcr\xml\'+@PRID_S+'.XML'
DECLARE @SQL AS VARCHAR(MAX) = '';

IF OBJECT_ID('tempdb..#tempDATA') IS NOT NULL DROP TABLE #tempDATA
CREATE TABLE #tempDATA ( DP VARCHAR(20) , ER VARCHAR(20) )

INSERT INTO #tempDATA
EXEC ( '
	SELECT 
		  Y.times.query(''DateDispatched'').value(''.'', ''varchar(19)''),
		  Y.times.query(''DateEnroute'').value(''.'', ''varchar(19)'')
	FROM 
	( 
		SELECT CAST(y AS XML)
		FROM OPENROWSET(
		 BULK ' + '''' + @FILENAME + '''' + ' ,
		 SINGLE_BLOB) AS T(y)
	) AS T(y)
	CROSS APPLY y.nodes(''/PCRDATA/Times'') AS Y(Times) ' 
)

SELECT TOP 1 @DP = DP , @ER = ER FROM #tempDATA

IF EXISTS( select TOP 1 1 from [dbo].[MICU] where PRID = '''' + @PRID_S + '''' )	
	UPDATE [dbo].[MICU]	
	SET dbo.MICU.Dispatched= '''' + @DP + '''' + ',dbo.MICU.Enroute= ' + '''' + @ER + ''''
	WHERE dbo.MICU.PRID =  '''' + @PRID_S + ''''
ELSE
INSERT INTO [dbo].[MICU] (PRID,Dispatched,Enroute) values('''' + @PRID_S + '''' + ',' + '''' + @DP + '''' + ',' + '''' + @ER + '''' )

Open in new window

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Will

ASKER
doesn't make sense:
Msg 109, Level 15, State 1, Line 36
There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
Will

ASKER
I ran the sql up to before the if "exists" and I am getting valid data to print:

(1 row(s) affected)
2017-11-26T09:37:00
2017-11-26T09:39:00
48620039
ASKER CERTIFIED SOLUTION
Pawan Kumar

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Will

ASKER
I fixed I removed the quotes around the @PRD_S, @DP and @ER.  Thank you so much.  Have a great day!!
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Will

ASKER
Thanks so much. Pawan!!
Pawan Kumar

Great ! Glad to help as always:)