Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1545
  • Last Modified:

Executing A Sybase SQL Anywhere 5.5 Stored Procedure From SQL Server

I am trying to run a SQL Server 7.0 DTS package containing several Tasks.  I have a DataPump task
that executes a stored procedure on the server running Sybase SQL Anywhere V 5.5
and writes the resulting dataset  to a table on a SQL Server 7.0 box.

The stored procedure takes 2 parameters and I am using placeholders and creating 2 global variables inside the DTS to hold the values.  example:  Exec myreport ?,?

When I run this DTS package interactively then it runs fine.

Also when I hardcode the values, it runs fine.  
Example:  Exec myreport '2004-03-25','2004-03-25'

When I try to schedule it then the package within SQL Server it fails with an error = Error:  -2147217904
(80040E10); Provider Error:  0 (0)      Error string:  [Sybase][ODBC Driver]Wrong number of parameters      Error source:  Microsoft OLE DB Provider for ODBC Drivers.

I am also running a SQL Server 2000 Developer edition as a personal server.
When I schedule the identical package to run from my personal server then it
runs fine.

Why can't Sybase read and pass the Global Variables in a scheduled package?
0
sherbug
Asked:
sherbug
  • 2
  • 2
1 Solution
 
namasi_navaretnamCommented:
Have you tried running the package using DTSRUN commnad line utility. You can pass global variables using /a parameter. See books online for other parameters. If excuting package thru DTSRUN works then you can schedule DTSRUN to run along with command line parameters, instead of the scheduling the package itself.

regards-
0
 
sherbugAuthor Commented:
No I have not tried this.  Can the global variables be dynamic?  I have been using RDMS for a number of years, but not so much DTS.  

Let me look up the rules for dtsrun and give it a try.  If all goes OK I will accept this solution and give the points to you.

Thanks, you're a life saver.




0
 
sherbugAuthor Commented:
Parameters can only be specified when using SQL Server 2000.  I am still running off a SQL Server 7.0 box.  

Here is what I tried:

declare @var sysname,@var1 sysname,@var2 sysname
Set @var = (Select PARAM from DB..TABLE_NAME)
Set @var1 = (Select PARAM1 from DB..TABLE_NAME1)
Set @var2 = (Select PARAM2 from DB..TABLE_NAME2)
EXEC master..xp_cmdshell 'DTSRun /S "servername" /N "pkg_name" /G "{EB8955DC-9074-44A0-BF96-56B83986ACF0}" /A "PARAM":"8"=@var /A "PARAM1":"8"=@var1 /A "PARAM2":"8"=@var2 /W "0" /E '


Executing the above returns this error:

output                                                                                                                                                                                                                  
DTSRun:  Invalid switch: /A "startdate":"8"=@var The parameter is incorrect.

DTSRun:  Invalid command options


Any other ideas that may work with SQL Server 7.0?
0
 
namasi_navaretnamCommented:
Well. I thought /a option exists in SQL 7. I do not have SQL 7 installed, thus i could not verify.

I think DTS approch is the best way. but i could not test your first method since i do not have sql 7.

Approach 1)

Could you not output the from sql anywhere table into a text file and then bcp in into sql server table. To do this automatically you will need a C program that can connect to both sql anywhere and sql server.

SELECT *
FROM employee;
OUTPUT TO employee.txt
FORMAT ASCII

Approach 2)

If you have powerbuilder then you can create a program to excute a pipeline object that transfers data from sql anywhere to sql server. You can then schedule the exe created from pb to from sql server.

Approch 3)
Create a VB program that connects to both using ado and transfer the data. Create exe and schedule it.

Hope that helps.

Regards-




0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now