Solved

Executing A Sybase SQL Anywhere 5.5 Stored Procedure From SQL Server

Posted on 2004-03-30
4
1,517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 10718769
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
ID: 10723882
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
ID: 10724990
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
ID: 10728202
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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With the rising number of cyber attacks in recent years, keeping your personal data safe has become more important than ever. The tips outlined in this article will help you keep your identitfy safe.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

636 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