0

I'm trying to create a CONCAT() that gets the last number in the exp_id column, then adds the filename to display as a separate column. The column would display the following.

copy \\\resfs\reo\reoexps\87\5\7040445i.pdf C:\temp\images 
CONCAT('copy \\\resfs\reo\reoexps\87\',', SUBSTRING(exp_id, 1,CHAR_LENGTH(exp_id) -1) '\', file_name, 'C:\temp\images') AS D,

enter image description here
enter image description here

enter image description here

2 Answers2

1

try this:

CONCAT('copy ','\\','\\','\\','resfs\\reo\\reoexps\\87\\', SUBSTRING(CAST(exp_id AS char), 1,CHAR_LENGTH(exp_id) -1),'\\', file_name, ' C:\\temp\\images') AS D
Danilo Bustos
  • 1,083
  • 1
  • 7
  • 9
0

The backslash (\) is used as an escape character. Use a double backslash (\\) where you want a literal backslash:

CONCAT('copy \\\\resfs\\reo\\reoexps\\87\\', SUBSTRING(exp_id, 1, CHAR_LENGTH(exp_id) -1), '\\', file_name, 'C:\\temp\\images') AS D
Michael Krikorev
  • 2,126
  • 1
  • 18
  • 25
  • For Some reason is says: Error Code: 1583, Incorrect parameters in the call to native function 'CONCAT' – Darius Castillo Feb 16 '17 at 19:00
  • select CONCAT('copy \\\\resfs\\reo\\reoexps\\87\\', SUBSTRING(exp_id, 1,CHAR_LENGTH(exp_id) -1) '\\', file_name, 'C:\\temp\\images') AS D from resnet.property_exps as pe – Darius Castillo Feb 16 '17 at 19:02