I have the following query:
select @Box=Box,@Code=Code,@Validity=Validity,@Type=[Type]
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=C:\Barcodes.xlsx;HDR=YES',
'SELECT Box,Code,Validity,[Type ] FROM [sheet1$]')
where Code <> ''
I am trying to Concatenate : 'C:\\Barcodes.xlsx' , i want to put a value "@Path" to be given by the use dynamically , i tried so far '+' '%' and nothing worked , what should i do in this case?
Not sure what you mean but at a guess?
select
@Box=Box,@Code=Code,@Validity=Validity,@Type=[Type]
FROM
OPENROWSET(
'Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=' + @path + ';HDR=YES',
'SELECT Box,Code,Validity,[Type ] FROM [sheet1$]')
where
Code <> ''
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.