Error while using BCP in from within a Perl Script
Error while using BCP in from within a Perl Script
am 10.01.2008 11:11:13 von 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
Re: Error while using BCP in from within a Perl Script
am 10.01.2008 11:17:45 von Peter Makholm
rajpreetsidhu@gmail.com writes:
> 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
Re: Error while using BCP in from within a Perl Script
am 10.01.2008 11:21:33 von rajpreetsidhu
My script starts like #!/opt/local/perl/bin/perl .
Regards,
Rajpreet
Re: Error while using BCP in from within a Perl Script
am 10.01.2008 11:22:00 von Peter Makholm
Peter Makholm writes:
> rajpreetsidhu@gmail.com writes:
>
>> 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'?
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
Re: Error while using BCP in from within a Perl Script
am 10.01.2008 11:30:58 von rajpreetsidhu
On Jan 10, 3:22=A0pm, Peter Makholm wrote:
> Peter Makholm writes:
> > rajpreetsi...@gmail.com writes:
>
> >> 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'?
>
> 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
Re: Error while using BCP in from within a Perl Script
am 10.01.2008 11:33:50 von rajpreetsidhu
On Jan 10, 3:30=A0pm, Rajpreet wrote:
> On Jan 10, 3:22=A0pm, Peter Makholm wrote:
>
>
>
>
>
> > Peter Makholm writes:
> > > rajpreetsi...@gmail.com writes:
>
> > >> 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'?
>
> > 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- Hide quoted text -
>
> - Show quoted text -
Yes, I got your point Makholm.
Thanks a lot! It works now.