Solved

Executing A Sybase SQL Anywhere 5.5 Stored Procedure From SQL Server

Posted on 2004-03-30
4
1,495 Views
Last Modified: 2012-06-21
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
Comment
Question by:sherbug
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:namasi_navaretnam
Comment Utility
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
 

Author Comment

by:sherbug
Comment Utility
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
 

Author Comment

by:sherbug
Comment Utility
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
 
LVL 15

Accepted Solution

by:
namasi_navaretnam earned 500 total points
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now