Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
arkiboys
Advocate II
Advocate II

copy activity - pre-copy script

hi,

In the pre-copy script box of the copy activity, I place this tsql statement but the pipeline gives this error.

any suggestions? thank you

 

my script:

@concat('delete from db_name.tbl_name where file_path = ', 'Source/mydata-new/mydata-03-May-2024.csv')

 

error:

Message=A database operation failed with the following error: 'Incorrect syntax near 'csv'.',Source=,''Type=System.Data.SqlClient.SqlException,Message=Incorrect syntax near 'csv'

1 ACCEPTED SOLUTION
NandanHegde
Super User
Super User

@arkiboys  Couple of things for which we need details :

1) what is the database (type) on which you are executing your pre copy script?

2) based on the expression : 
@concat('delete from db_name.tbl_name where file_path = ''Source/mydata-new/mydata-03-May-2024.csv')

This seems to be pretty static, not sure why you used the concat here?

 

3. Also as stated by Nikhil, please provide the screenshot of the log of the Copy activity so we see what SQL command was generated and actually executed




----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com

View solution in original post

2 REPLIES 2
NandanHegde
Super User
Super User

@arkiboys  Couple of things for which we need details :

1) what is the database (type) on which you are executing your pre copy script?

2) based on the expression : 
@concat('delete from db_name.tbl_name where file_path = ''Source/mydata-new/mydata-03-May-2024.csv')

This seems to be pretty static, not sure why you used the concat here?

 

3. Also as stated by Nikhil, please provide the screenshot of the log of the Copy activity so we see what SQL command was generated and actually executed




----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com
v-nikhilan-msft
Community Support
Community Support

Hi @arkiboys 

Thanks for using Fabric Community. 

Can you please provide the screenshot of the pre copy script which you used in the pipeline?

 

Thanks

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.