Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2013-09-11 : 08:05:00
|
Hello there, I have mapped a variable in a Execute SQL task,The parameter name is 0I am using the below scriptdeclare @fileVariable varchar(100)declare @file varchar(100)set @fileVariable = ?select @file = SUBSTRING (@fileVariable, CHARINDEX('r\cu', @fileVariable) +1, LEN(@fileVariable))select @file = right(@file, len(@file) -charindex('\', @file))delete customer_staging where filename = @fileand I get the following errorThe query failed to parse. The batch could not be analysed because of compile errors.The code works fine ssms, could someone point me in the right direction please.RegardsRob |
|
tm
Posting Yak Master
160 Posts |
Posted - 2013-10-10 : 10:20:43
|
Check ByPassPrepare property for Execute SQL Task.Refer to .. http://www.sqlsafety.com/?p=196You may have ByPassPrepare set to false. Cannot parse due to parameter. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-10 : 10:27:31
|
You may be better off making code batch a procedure and then making filevariable as a parameter Then call it asEXEC Procname ? and then map parameter 0 to your variable. This worked for me------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|