Error while using BCP in from within a Perl Script

R

rajpreetsidhu

Greetings,

I am trying to bcp in data into a table from inside a perl script.
Though the data gets inserted into the table but still I am getting
following error :

sh: Starting: execute permission denied
sh: 8: execute permission denied
sh: syntax error at line 4: `(' unexpected
sh: Starting: execute permission denied
sh: 8: execute permission denied
sh: syntax error at line 4: `(' unexpected

Code looks like :

sub bcp_data{

print "bcp $dest_table in $file_out -c -t '|' -U $source_username -P
$source_passwd -S $source_server -e $log \n";
my $returncode = `bcp $dest_table in $file_out -c -t "|" -U
$source_username -P $source_passwd -S $source_server -e $log`; #
backticks
system "$returncode";
exec "$returncode";
}


TIA.

Regards,
Rajpreet
 
P

Peter Makholm

sh: Starting: execute permission denied
sh: 8: execute permission denied
sh: syntax error at line 4: `(' unexpected
sh: Starting: execute permission denied
sh: 8: execute permission denied
sh: syntax error at line 4: `(' unexpected

These errors come form you shell (hint: it starts with 'sh:'). Are you
trying to run you perl script with /bin/sh?

Did you start you script with '#! /usr/bin/perl'?

//Makholm
 
P

Peter Makholm

Peter Makholm said:
These errors come form you shell (hint: it starts with 'sh:'). Are you
trying to run you perl script with /bin/sh?

Did you start you script with '#! /usr/bin/perl'?

Sorry, wrong answers.

You're trying to execute the content of $returncode as a
shellscript. To debug problems with doing this you might want to print
the content of $returncode.

//Makholm
 
R

Rajpreet

Sorry, wrong answers.

You're trying to execute the content of $returncode as a
shellscript. To debug problems with doing this you might want to print
the content of $returncode.

//Makholm

I tried printing the contents and everything works fine. Even if I try
doing BCP in from comand prompt with the printed value, it works fine
without any error. Problem comes only while running from within the
perl script.
Pl suggest.

Regards,
Rajpreet
 
R

Rajpreet

I tried printing the contents and everything works fine. Even if I try
doing BCP in from comand prompt with the printed value, it works fine
without any error. Problem comes only while running from within the
perl script.
Pl suggest.

Regards,
Rajpreet- Hide quoted text -

- Show quoted text -

Yes, I got your point Makholm.

Thanks a lot! It works now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top