Calling DB2 Store Procedures From SQL Server 2000

Feb 5, 2004

I am trying to call DB2 stroe procedure from within SQL server 2000 using DTS. I have the IBM odbc driver installed on the server. I have created an ACtiveX script to run in DTS and it fails staing it could not findor load the DB2 store procedure.

Has anyone come across doing this and how they did it?

THanks for the help....

View 4 Replies


ADVERTISEMENT

Calling Sql Server Stored Procedures From C#

Apr 3, 2008



I have a simple stored procedure:


create procedure sp_testres

@mult1 int,

@mult2 int,

@result int output

as

select @result = (10*@mult1) + @mult2

go



When I call it


declare @result int

exec sp_testres 5, 6, @result output

print @result

(Result is correctly shown as 56).

I then in C# wrote the following:



m_cmd.CommandText = "sp_testres";

SqlParameter param2 = new SqlParameter("@mult2", SqlDbType.Int);

param2.Value = 6;

SqlParameter param1 = new SqlParameter("@mult1", SqlDbType.Int);

param1.Value = 5;

SqlParameter param3 = new SqlParameter("@result", SqlDbType.Int);

param3.Direction = ParameterDirection.Output;

m_cmd.CommandType = CommandType.StoredProcedure;

m_cmd.Parameters.Add(param1);

m_cmd.Parameters.Add(param2);

m_cmd.Parameters.Add(param3);

m_cmd.ExecuteNonQuery();


This works and param3.Value holds the result value.
I also notice that I can supply the parameters in any order, and things work fine.

What I want to know is: can I call the stored procedure with parameters, where I haven't supplied the parameter name, and just rely on the parameter order matching instead?

View 5 Replies View Related

SQL Server 2008 :: Importing SSIS Package Into File Store And Calling It Within A Job

Oct 9, 2015

I've imported an SSIS package into Management Studio (2008 R2) and I've set up a SQL Server Agent job to call the package but it fails due to error code: 0xc00160aa.

As far as I can tell this is because it is unable to read the location of the package despite it being a file system location within Management studio. Also I can run the package manually within Management Studio, but when I try to call it via the job it fails.

View 0 Replies View Related

Stoping Sql Server Agent Using Store Procedures

Jul 10, 2007

Hi
all i need little help regarding stored procedure.
i have some job say ".one." that runs daily on sql server agent But i have some holiday schedule as well in database
suppose if a holiday come and i want to stop that job on sql server agent on that particular holiday.
can anybody help me writing it ..
how to do it by calling SQL server agent to stop and start with date in stored procedure.
Regards

View 8 Replies View Related

SQL Server 2008 :: List Store Procedures Contents?

Jul 27, 2015

who i can to list the content of all store procedures and funtions in text file ?

View 3 Replies View Related

Calling SQL 2000 Server SP Using JDBC

Jul 6, 2006

Hi this is my first post

I really needs some help

I have been stressing with issue for last few days.

I have a stored Procedure ramApplicationAddTest, I can run it through SQL Query Analyser without any problem.

I can call this using JDBC and it works, here is how I make call I make to SP

var con1 = DBDriver.getConnection ("alias:ProclaimConnect");
var stmt = con1.prepareCall( "{call ramApplicationAddTest(?,?,?,?,?)}");
stmt.setString(1,'BuildApp');
stmt.setString(2,'BASwimPool');
stmt.setString(3,'Test Test....');
stmt.setString(4,'');
stmt.setFloat(5,0);
stmt.execute();
stmt.close();
con1.close();

I also have another SQL 2000 Stored Procedure called
RamApplicationAddTest1, I can run this SP also through SQL Query Analyser without any problem.

But when I try to run this using JDBC it, gives me following Exception.

SQLState[ERR-Unexpected]ErrorCode[0]Message[java.lang.NullPointerException
at com.hs.form.jdbc.JDBCErrorhandler.isMssqlConnectio nErrorInTx(JDBCErrorHanlder.

An exception 'DatabaseQueryException' has occurred at DatabaseQueryClientWinInetImpl.cpp (291).

var con2 = DBDriver.getConnection ("alias:ProclaimConnect");
var stmt = con2.prepareCall( "{call ramApplicationAddTest1(?,?,?)}");
stmt.setString(1,’BuildApp’);
stmt.setString(2,’BASwimPool’);
stmt.setString(3,’Test’);
stmt.execute();
stmt.close();
con2.close();

I hope somebody can give me some hints to fix this.

Amar

View 1 Replies View Related

Calling Store Procedure

Mar 10, 2008

I have created a database and stored procedure there.I want to execute that store procedure having dot net in my front end,i.e i want to execute store procedure from .net.How can I do that.Pls help me.

View 1 Replies View Related

Script To Export Tables,store Procedures And Data In SQL Server Management Studio Expres

Nov 23, 2006

how i can do a script to export tables,store procedures and data in SQL Server Management Studio Expres

I just arrive to do a script for tables and stores procedures



help please

View 3 Replies View Related

Calling Store Procedure From Aspx

Jun 7, 2004

hi , I would appreicate your help, I have created a store procedure in MS sql server 2000 to be called from aspx page.
The store procedure will have multiple functions:
checking if a file exist in c:data
if file exist, it will use zip file command line to unzip the file and then run DTS package to upload the database.

The issue I am having is when I run the store procedure from MS query analyzer,I get a confirmation that the whole procedure ran successfully, but when I call the same procedure from aspx, althought the store procedure ran successfully, but I did not get any confirmation to the user in the aspx page to notify the user that the process successed.... here is my code in where I think is not working,
CREATE PROCEDURE p_on_demand_dts_sales_option_price_report_3_ftest
@id int , @msg_output varchar(28) output
as
declare @varcmd varchar(255),@FileExist int
select @varcmd = null
select @varcmd ='dir :Data_on_demandsales_option_price_report.csv' -- check if file exist
EXEC @FileExist = master..xp_cmdshell @varcmd
set @msg_output = 'The file exists'
Return 44

+++ The above store procedure use command line to check if the csv file exist, its suppose will return a output parameter and a return # BUT it did not. To my surprise, when I modify the above store procedure like this, it work
-----
CREATE PROCEDURE p_on_demand_dts_sales_option_price_report_3_ftest
@id int , @msg_output varchar(28) output
as
set @msg_output = 'The file exists'
Return 44

The second procedure does not do anything, except take input parameter and return a message output and return, this work.

since the second procedure works, it means that the code in aspx is correct, but I have no clue why it does not return output parameter and return # in the first procedure.

I would really appreciate anyone who could help.
thanks

ehx5

View 4 Replies View Related

Calling The Same Store Procedure Repeatly, But Only Work In The First Time

Apr 18, 2006

I had try calling a function, that call a store procedure, repeatly using a for loop, but I notice it will only get the expected part_id in the first time, and return an empty string sub-sequentially without throwing an exception. So I had try using a sql query instead, but the same thing happen. Below is my function, can you point out to me what's wrong?
My original version that calls a store procedure
Public Shared Function getPartId(ByVal part_supplierserialnumber As String) As String
Dim mySqlCommand As New SqlCommand
Dim mySqlConnection As SqlConnection = New SqlConnection(GetERATSConnectionString())
Dim myPart_id As String
mySqlCommand.CommandType = CommandType.StoredProcedure
mySqlCommand.CommandText = "getPartId"
mySqlCommand.Connection = mySqlConnection
mySqlCommand.Parameters.Add(New SqlParameter("@part_supplierserialnumber", part_supplierserialnumber))
Try
mySqlConnection.Open()
myPart_id = mySqlCommand.ExecuteScalar()
Catch ex As Exception
myPart_id = ""
Finally
mySqlConnection.Close()
mySqlConnection.Dispose()
End Try
Return myPart_id
End Function
My Store procedure
create procedure getPartId@part_supplierserialnumber as nvarchar(50)as
select top 1 part_id from tblPtSingapore where part_supplierserialnumber = @part_supplierserialnumber order by part_datecreated desc
 
GO
The new version I tried which happen the same thing
Public Shared Function getPartId(ByVal part_supplierserialnumber As String) As String
Dim myPart_id As String
Dim strSql As String = "select top 1 part_id from tblPtSingapore where part_supplierserialnumber = '" & part_supplierserialnumber & "' order by part_datecreated desc"
Dim mySqlConnection As SqlConnection = New SqlConnection(GetERATSConnectionString())
Dim mySqlCommand As New SqlCommand(strSql, mySqlConnection)
Try
mySqlConnection.Open()
myPart_id = mySqlCommand.ExecuteScalar()
Catch ex As Exception
myPart_id = ""
Finally
mySqlConnection.Close()
mySqlConnection.Dispose()
End Try
Return myPart_id
End Function

View 2 Replies View Related

Executing Store Procedre By Calling It From An Insert Trigger?

Feb 10, 2000

hi, I have a trigger on a table for insert, once there is new data into that table I want to run a nother store procedure by passing all input from inserted to the store procedure as input parameter. can I do that.

Thanks

Ali

View 4 Replies View Related

T-SQL (SS2K8) :: Calling SSIS Package Through Store Procedure

Dec 4, 2014

I am calling Store Procedure from my C# Code and inside the SP, I am calling my SSIS Package.It is working fine. On my local because I have all rights to run xp_cmdshell COMMAND. Now I have to transfer this SP to QA and Prod and I don't have rights to run xp_cmdshell COMMAND.

Here is my SP.

declare @cmd varchar(1000)
SET @ssispath = 'SSIS Package Path where my .dtsx package'
set @ExcelF = 'Passing My source file name and full path'

select @cmd = 'C:"program files (x86)""Microsoft SQL Server"100DTSBinnDTEXEC.exe /F "' + @ssispath + '"'
select @cmd = @cmd + ' /X86 /SET Package.Variables[User::ExcelF].Properties[Value];"' + @ExcelF + '" /X86 '
exec master..xp_cmdshell @cmd

My question is, is there other way to run/execute above Store Procedure/SSIS without XP_CMDSHELL Command?

View 6 Replies View Related

Calling Eventcreate Command From Xp_cmdshell Store Procedure

Feb 15, 2008



Hi,

I want log event in event logger using xp_cmdshell store procedure.
I am calling eventcreate dos command.


xp_cmdshell 'C:> eventcreate /S \servername /L Application /T Success /SO Application Name /ID 1754 /D €œDescription of event€? '

I am getting error....


Incorrect syntax near 'eventcreate' /S \206.245.13.94' /L Application' /T Error' /SO WIPError'/ID 123'/D "Testing"'.


please help me.

thanks,

Chetan S. Raut.

View 5 Replies View Related

Calling Stored Procedures From C#

Jul 1, 2007

Hi All...  I'm calling a stored procedure from C#.  I'm sending it input parameters as follows:SqlCommand c = new SqlCommand("AddAuthor", myConnection);c.CommandType = CommandType.StoredProcedure;
c.Parameters.Add(new SqlParameter("@LastName", SqlDbType.VarChar, 100));c.Parameters["@LastName"].Value = "Last";
c.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.VarChar, 100));c.Parameters["@FirstName"].Value = "First";
In my opinion, that works nice - and it's easy.  The reference I'm using says I can also specify "output" parameters - instead of supplying a value, one needs to change a property called direction. 
But my stored procedure doesnt return any output parameters per se, but it does return a value.  That is the last statement in the stored procedure is "RETURN @@IDENTITY" - it returns the identity field after an INSERT...  So how do I get that value back in my C# code?
Thanks for the help in advance.  Happy 4th to all!  : )    -- Curt
 

View 4 Replies View Related

Calling Stored Procedures Via Vb.net

Jan 16, 2008

Hi,
 I was wondering if someone can tell me why my sub for calling stored procedures doesn't work.The string strFinFileId is not null.
I keep getting the following error System.IndexOutOfRangeException: Total
Here's my sub.
 '//get GrandTotal    Protected Sub GetGrandTotal(ByVal finfileid As String)        Dim myConnection As SqlConnection        Dim connString As String        Dim strFinFileId As String        Dim strGrandTotal As Decimal
        strFinFileId = finfileid        connString = ConfigurationManager.ConnectionStrings("PMOConnectionString1").ConnectionString
        myConnection = New SqlConnection(connString)        'you need to provide password for sql server        myConnection.Open()
        Dim sql1 As String
        sql1 = "GetGrandTotal " & Convert.ToInt32(strFinFileId)
        Dim myCommand As SqlCommand
        'Response.Write(sql1)        'Response.End()
        myCommand = New SqlCommand(sql1, myConnection)
        Dim reader As SqlDataReader = myCommand.ExecuteReader()        While reader.Read()            strGrandTotal = reader.Item("Total")            LabelGrandTotal.Text = strGrandTotal            'Response.Write(strFinFileId)            'Response.End()
        End While        reader.Close()        myConnection.Close()    End Sub
 Cheers
Mark :) 
 

View 2 Replies View Related

Help W. Calling Stored Procedures

Apr 16, 2008

I have a stored procedure written to update a table:
The stored procedure  has the following parameters:
@Original_TypeID int,
@Type_Desc varchar(35),
@Contact_Name varchar(20),
@Contact_Ad1 varchar(25),
@Contact_Ad2 varchar(25),
@Contact_City varchar(10),
@Contact_Phone varchar(12),
@Contact_Fax varchar(12),
@Contact_Email varchar(35)
And I want to call this procedure when the "update" button is clicked, my code is:Protected Sub UpdateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString)Dim myCommand As SqlCommandDim UpdteParam As New SqlParameter()
myConnection.Open()myCommand = New SqlCommand("[dbo].[sp_Update_Types]", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
????????????????????????myCommand.Parameters.Add(UpdateParam)
 
???????????myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub
 
Can you please help me with the ????? areas? I don't know how to pass the parameters into the procedure, and also the second set of ??? s, I'm not sure if I am executing the command correctly.
Thank you.

View 3 Replies View Related

Stored Procedures Calling DLL's

Jun 21, 2001

I'm relatively new to SQL Server and I was wondering if there is any way to call a DLL from a regular stored procedure? I believe I've read that the extended stored procedure is a DLL and therefore should be able to call another DLL. Can this also be verified? We're looking to speed up some sections of Visual Basic code which does some heavy I/O work. I've also asked this once before but didn't get an absolute answer - can you write the extended stored procedures in Visual Basic or is C/C++ the only language supported right now?

Thanks.

Caroline Kaplonski
ckaplonski@buckconsultants.com

View 2 Replies View Related

Calling Stored Procedures

Jul 20, 2005

Hi AllI was wondering if there is a way to call a stored procedure from insideanother stored procedure. So for example my first procedure will call asecond stored procedure which when executed will return one record and iwant to use this data in the calling stored procedure. Is this possible ?Thanks in advance

View 18 Replies View Related

Calling Stored Procedures From Different DBs

Jul 20, 2005

Is it possible to have a stored procedure in database A while callingit from database B and have it manipulate the tables in database B(whatever the calling database happens to be)?We have a large-scale app that uses many complex stored procedures,and as of now, we're copying the SPs to every new database that iscreated, and it will soon become a nightmare for propagating updatesand fixes. We'd like to keep a master set of the SPs in one DB and"use" them from other DBs so that they only query data and manipulatetables in the calling DB. I hope someone has some suggestions. Thanks.

View 1 Replies View Related

How To Store An Email On SQL Server 2000?

Jul 30, 2007

Is it possible to store an email in SQL server 2000? Do we need to define our own data type for that, if yes then how? or do we have to store it as an object, again how? I want to save email after sending it by my ASP .NET application and then retrieve it at a later stage.......Anyone please help?

View 2 Replies View Related

Store Objects In Sql Server 2000

Oct 25, 2004

How can we store native .NET objects like arraylists, hashtables in Sql Server? Is this possible? If so, can anybody provide some insight on how to do this?

Thanks

View 4 Replies View Related

How To Store Only Date In MS SQL Server 2000

Feb 2, 2006

hi..
i am taking date and time from user as input in different screen.
some times i need only date to be stored and some time only time.
as we have data type datetime in MS SQL Server 2000, it takes both date and time in one field.
so how to take only date or only time from user and store in database.

View 2 Replies View Related

Calling Stored Procedures In SQL Statement

Aug 25, 2007

How can we call Stored Procedure inside any SQL Statement
For Example.
If we have procedure name sprocCurrentPriority
select * from tablename where colmunname = exec sprocCurrentPriority

View 7 Replies View Related

Calling Stored Procedures On Different Servers

Oct 4, 2004

I'm using reporting services to build a report and I plan on using a stored procedure to gather my data for the report. My question is:

I know it's possible to call a stored procedure from a stored procedure, both within the same dB and in different dB's, but is it possible to call a SP that's on a different server? My gut says "definitely not. at least not easily." But I wanted to see if anyone had any thoughts on this before I pursue a different course of action.

View 3 Replies View Related

Calling Stored Procedures In MS Access

Nov 3, 2000

can anyone tell me how to call SQL stored procedures in MS Access97...
appreciate any help

View 4 Replies View Related

Calling Stored Procedures From A Web Page

Jan 15, 2001

I am currently developing web pages based on data pulled from SQL Server with ASP. I've mastered the art of SELECTing, INSERTing, etc, but want to know if it is possible to run STored Procedures from a page by clicking on a button on a particualr web page.

View 1 Replies View Related

Off Topic - Calling Procedures From MS Access

Nov 15, 1999

Hi all!

Is there a possibility to call (and receive records) SQL Server (or other databases) procedure from MS Access?

View 1 Replies View Related

Calling Stored Procedures Using Plain ADO In C#

Sep 7, 2006

Hello All,

We are trying to figure out how to make a stored procedure call and pass some inputs using C# and plain ADO. We are able to call an empty stored procedure but cannot pass parameters into a stored procedure.

Does anyone have sample code in C# whereby we can open a connection and pass inputs into a stored procedure? The following is a sample code we are using:


ADODB.Parameter param = new ADODB.Parameter();

param=cmd.CreateParameter("@StoreID", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamInput,sizeof(int) , 9);

cmd.Parameters.Append(param);

          ADODB.Recordset rsInv = cmd.Execute(out objAffected, ref objAffected,-1 );

In the above example, we create a parameter of type integer and try to add it to the ADO Command object. It is supposed to return a recordset. It returns a recordset with record count -1.

 

Sincerely,

Dwight Kulkarni

View 3 Replies View Related

How To Store The Image Files In Sql Server 2000

Aug 9, 2007

I just want to store pic.bmp file in server using image datatype but don't getting how to do that ..
i want to know about both the actions storing and retrieving from the image data type..
like

create table amit
(
im image,
);


insert into values ()...
select * form Amit will it work...

View 6 Replies View Related

Calling Stored Procedures Inside Cursors

Aug 13, 2001

I have created a cursor using the following type of syntax:

DECLARE MyCursor CURSOR FOR
SELECT ID FROM tblEmployees
OPEN MyCursor
BEGIN
FETCH NEXT FROM MyCursor
END
CLOSE MyCursor

Instead of the SELECT statement (SELECT ID FROM tblEmployees), I actually have a very complex select statement. I have created a stored procedure to handle this select. However, I cannot find a way to call a stored procedure in place of the SELECT statement in the cursor. Is this possible? Thanks.

View 2 Replies View Related

Calling Stored Procedures In A Select Statement

Feb 26, 2004

I am trying to call a stored procedure inside a SQL SELECT statement. Has anybody had to do this in the past? I have a SELECT statement in a Microsoft Access database and I need that SELECT statement to call the stored procedure in the SQL server. Any help would be appreciated

View 4 Replies View Related

How To Set-up Sql Server 2000 In Win2k3 Server To Store Big-5 Chinese Data

Jul 23, 2005

I am using Windows 2003 Server English Version. I wanna store the big-5data so I install the sql server 2000 as if i install it in the Windows2000 with Server Collation of the Chinese_Taiwan_Stroke_CL_AS.However, the data are stored into the database server in unicodeinstead of big-5 in that of windows 2000 OS.I would like to ask how i can set so that the Sql Server 2000 can storethe big-5 data

View 6 Replies View Related

How To Store Flash Files Into The Sql Server 2000 Database

Mar 1, 2008

Hi

How to store flash files into the sql server 2000 database and again display them back in asp.net/C# user interface?thanks 

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved