Solved

Executing A Sybase SQL Anywhere 5.5 Stored Procedure From SQL Server

Posted on 2004-03-30
4
1,500 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This tutorial shows how to create a greeting card by combining two image layers and a text layer on a PC using a free image editing app.
An article on effective troubleshooting
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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