I need help.
There is a program that generates file names and using an SQL query I need to specify how the name should be generated.
I want the file name to look like this: ”fv’ + [column value] + ‘.pdf’
I manage to get the value with the query:
`SELECT (
SELECT 'fv' + CAST(MI.MPDF_ZamSklepID AS varchar) + '.pdf'
FROM [dbo].[XYZPDF] MI
JOIN cdn.tranag TA ON MI.MPDF_ZamERPID = TA.TRN_TRNID
) AS ZamSklepID_FV`
However, the problem is that it always gives me the first value, and I want the value to be different for each record, depending on what value is in the MPDF_ZamERPID column.
I manage to get the value with the query:
`SELECT (
SELECT 'fv' + CAST(MI.MPDF_ZamSklepID AS varchar) + '.pdf'
FROM [dbo].[XYZPDF] MI
JOIN cdn.tranag TA ON MI.MPDF_ZamERPID = TA.TRN_TRNID
) AS ZamSklepID_FV`
Kamil Kuzio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.