Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2013
    Posts
    14

    Unanswered: How to run stored procedure in perl

    Hi All,

    i am trying to run a stored procedure in this script but i get an error.

    #!/usr/bin/perl
    use strict;
    use Data:umper;

    my $dataserver=$ARGV[0];
    my $username=$ARGV[1];
    my $pass=$ARGV[2];

    if(@ARGV < 1)
    {

    print "Usage :\n";
    print " ./test.pl username dataserver pass\n";
    exit;
    }

    my $result = qx { isql -U$username -S$dataserver -P$pass -s"," -b <<EOF

    set nocount on
    sp_monitorconfig "all"
    go
    exit
    EOF
    };

    print $result;

    the error i get is "Incorrect syntax near 'sp_monitorconfig'."
    Strange thing is normal querys work fine.

    Thanks for help.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Your Perl script is fine. The problem lies in your Transact-SQL.

    The EXECUTE statement is optional if the stored procedure name is the first executable statement in the batch.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Dec 2013
    Posts
    14
    thanks Patp

    i did /*exec sp_monitorconfig "all"*/ and it worked .

    Thanks Again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •