Procedure Call Between Two Different SQL SERVER

Aug 1, 2006

Hi,

I have two SQL SERVER server1 and server2. A server1's stored procedure should call server2's stored procedure. how can i do this.please explain me in detail.i am new to this concept.

VENKAT

View 4 Replies


ADVERTISEMENT

CAll Oracle Procedure From SQL Server

Jan 12, 2003

I have been trying to execute Oracle Stored Procedure From SQL Server using Linked Server without luck. The scenario is explained in detail below ..

Environment :
SQL Server Version : 2000
OS : Win NT 4.0 SP5

Oracle Version : 8.0
OS : Win NT 4.0 SP5
User : Scott

Oracle Procedure
Name : TEST_PROC
Parameters: None
The procedure look something like this ...
Create or Replace PROCEDURE TEST_PROC
AS
BEGIN
Insert into Table1 Values('A');
END;

Scenario One
Executing the stored procedure using Linked Server (JDEV), configured Using OLEDB For Oracle, results in the following error

Server: Msg 7212, Level 17, State 1, Line 1
Could not execute procedure 'TEST_PROC' on remote server 'JDEV'.
[OLE/DB provider returned message: One or more errors occurred during processing of command.]
[OLE/DB provider returned message: Syntax error in {call...} ODBC Escape.]

Scenario One
Executing the stored procedure using Linked Server (SCOTT), Configured Using OLEDB for ODBC, results in the following error

Could not execute procedure 'TEST_PROC' on remote server 'SCOTT'.
[OLE/DB provider returned message: One or more errors occurred during processing of command.]
[OLE/DB provider returned message: Syntax error in {call...} ODBC Escape.]

Could you please help me out with a workaround. In case SQL-DMO is the only workaround, can you provide some sample programs.
The bigger picture is, replicating Execution of a SQL Server Stored Procedure on Oracle.

View 3 Replies View Related

Linked Server Procedure Call

May 30, 2013

I am trying to call a DB2 procedure in SQl server through a linked server object. I use the IBMDADB2 provider for the linked server. on the DB2 I have a simple procedure with 2 in and 1 out paramater. on DB2 it works no problem.but in SQL server I just cannot get it to work.

so my code:
DB2IBM is the name of the linked server.

declare @I_DIS smallint
declare @I_UID char(8)
declare @ID_TICK int

alternative 1:
Exec ('Call btp.GET_TICK(?,?,?)',@I_DIS, @I_UID, @ID_TICK OUTPUT) AT DB2IBM

alternative 2:
EXECUTE DB2IBM..BTP.GET_TICK 2,'19', @ID_TICK

in both cases I got the same error:

OLE DB provider "IBMDADB2.DB2COPY1" for linked server "DB2IBM" returned message " CLI0100E Wrong number of parameters. SQLSTATE=07001".

so how can I call this procedure?

View 5 Replies View Related

Stored Procedure Fails On Call From V6.5 To V7 MS SQL Server

Aug 24, 2000

I am having a problem trying to run a stored procedure
from a MS SQL Server version 6.5 server. The stored
procedure calls another stored procedure on a MS SQL
Server version 7.0 server.

The job task always fails with the error message...
"Login failed for user 'sa'. (Message 18456)".

I can run the stored procedure from the T-Query window
on the 6.5 server successfully but it will not run
as a job task.

Does anyone have any suggestions?

View 1 Replies View Related

Invalid Procedure Call... Error With SQL Server 7

Feb 5, 1999

I'm having trouble with the following code. I get a "Invalid procedure call or argument" error in response to OpenResultset. The same command works in MSQuery and when ADO is used. Does anyone have any insight?

We're using VB5.0 SP2 and SQL Server 7 Beta 3.

Option Explicit

Sub Main()
Dim objC As RDO.rdoConnection
Dim objColsRS As RDO.rdoResultset
Dim objQ As rdoQuery

Set objC = New RDO.rdoConnection
With objC
.Connect = "Driver={SQL Server};Server=KENBNT;UID=SYSADM;PWD=SYSADM;DATABA SE=QT;"
.EstablishConnection
Set objQ = objC.CreateQuery("", "select name from syscolumns")
Set objColsRS = objQ.OpenResultset
End With
Set objColsRS = Nothing
Set objQ = Nothing
Set objC = Nothing
End Sub

View 2 Replies View Related

Call Remote Server In A Stored Procedure(6.5)

Nov 27, 2001

Hi,
I was wondering is anyone can help me out on this one,
I want to run a query, but I need to reference a Database that exists on a different server. I am using SQL 6.5
Any suggestions would be welcomed,
Thanks a mill,
Fin

View 1 Replies View Related

SQL Server 2008 :: Call SSIS Package From Procedure

Mar 5, 2015

I am having few queries related to follow.

1. Is it possible to call SSIS package from procedure .
2. Also want to supply parameters to procedure.
3. Can multiple users execute that procedure simultaneously.
4. If yes then will it cause any issue if it is run simultaneously by 10 users.

View 3 Replies View Related

Insert Multiple Records Using One Stored Procedure Call. SQL SERVER 7

Mar 19, 2008

Hi I have asp.net page with approx 28 dropdowns. I need to insert these records using one stored procedure call. How can I do this while not sacrificing performance?
 
Thanks, Gary

View 9 Replies View Related

SQL Server 2008 :: Find All Items That Call A Stored Procedure

Nov 2, 2015

We have a process that uses a stored procedure: sp_MysteryProcedure....

The problem I am having is: I am 95% certain the issue lies with this stored procedure, but I cannot find the process that calls this procedure. It could be a SQL Server Job that calls the procedure directly, it could be an SSIS (*.dtsx) process that calls this procedure, or some other random process.

One of the big issues is we have tons of *.dtsx packages that call a bunch of stored procedures, but it doesn't seem a normal Windows Search (Start --> Search) searches these files (or perhaps something else is going on with this search).

So my question is multi-part.....

1). How would one go about finding a rouge process that loads data via a stored procedure if we believe we know the stored procedures name?
2). How do you search *.dtsx files?

View 9 Replies View Related

SQL Tools :: Server Agent - Remote Procedure Call Failed (0x800706be)

Jun 20, 2011

I can't access SQL Server 2008 R2 remotely on Windows 2008

1.  TCP/IP Enabled for SQL Server Network Configuration Protocols, SQL Native Client 10.0 configuration clients, and SQL Native Client 10.0 configuration clients(32 bit)

2.  Firewall disabled to make sure its not interferring with things.

I noticed the SQL Server Agent is Stopped.  Not sure if this is the issue.  When I try and turn this from disabled to Automatic or Manual, I get this error:

Remote procedure call failed (0x800706be)

It shouldn't be this difficult.

View 23 Replies View Related

SQL Server 2014 :: How To Call Dynamic Query Stored Procedure In Select Statement

Jul 23, 2014

I have created a stored procedure with dynamic query and using sp_executesql . stored procedure is work fine.

Now i want to call stored procedure in select statement because stored procedure return a single value.

I search on google and i find openrowset but this generate a meta data error

So how i can resolve it ???

View 7 Replies View Related

How Do I Call A Stored Procedure To Insert Data In SQL Server In SSIS Data Flow Task

Jan 29, 2008



I need to call a stored procedure to insert data into a table in SQL Server from SSIS data flow task.
I am currently trying to use OLe Db Destination, but I am not sure how to map inputs to OLE DB Destination to my stored procedure insert.
Thanks

View 6 Replies View Related

Can I Call A Procedure In One Database From A Procedure In Another?

Oct 5, 2007



Hi,
I have an integration solution that backs into two databases. Database A is custom and Database B is integrated from a COTS product. The manufacturer of B supplies a formal interface as stored procedures (and I intend to honor that contract by limiting my access to B through those stored procs).
Now, I have a search that is going to involve a subselect in the form of the following pseudocode:

select a,b from dbA.user.TableX where exists (select a from dbB.user.TableY)

I am trying to avoid creating 2 temporary cursors in the integration application and doing things in-memory (b/c of performance concerns).

So, my q is:
How can I make this happen within database A?

View 3 Replies View Related

How To Call Below Procedure

Apr 30, 2008

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 4/30/2008 2:25:41 PM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ostat_CDS_rpt47_2006]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[ostat_CDS_rpt47_2006]
GO


/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 23/04/2008 11:26:14 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 22/04/2008 14:35:33 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 21/04/2008 11:46:08 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 16/04/2008 17:18:04 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 04/04/2008 12:44:34 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 31/03/2008 12:03:31 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 31/03/2008 11:11:07 ******/


/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 09/03/2008 14:31:30 ******/
-- ostat_CDS_rpt47_2006 2008,03,17,17

CREATE procedure ostat_CDS_rpt47_2006
@pYear int,
@pMonth int,
@pDay1 int,
@pDay2 int

as
begin

declare @sql varchar(4000)
declare @tb1 varchar(128)
declare @tb2 varchar(128)

set @tb1= 'margin..ncds0421'
set @tb2='Report.dbo.ob_apr08'

set @sql=
'
insert into '+@tb2+'
select yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,0 isCallback,
cast(callcost as decimal (10,5)) cost,count(*) attempt,
sum(case when connectflg=1 then 1 else 0 end) connected,sum(talktime) Talktime
from '+@tb1+'
where yyyy='+ltrim(str(@pYear))+'
and mm='+ltrim(Str(@pMonth)) +'
and dd between '+ltrim(Str(@pDay1))+' and '+ltrim(Str(@pDay2))+'
and talktime >0 and trunkin is null
group by yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,cast(callcost as decimal (10,5))
order by yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,cast(callcost as decimal (10,5))
'
--print (@sql)
exec (@sql)

end









GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

View 2 Replies View Related

How To Call A Store Procedure

Aug 1, 2007

I have a stored procedure that creates a normalized table from an existing denorm table. So I just need a simple way to call this SP from an aspx page. It would be good though to know how many records were effected, but this is not a requirement.

View 5 Replies View Related

How To Call A Stored Procedure Using C#

Aug 29, 2007

I have a stored procedure I created in SQL server 2005. Now I need to call the stored procedure in C#. Can someone help me out here? What is the C# code I need to call this stored procedure? I have never done this before and need some help.
CREATE PROCEDURE [dbo].[MarketCreate]
(  @MarketCode  nvarchar(20),  @MarketName  nvarchar(100),  @LastUpdateDate  nvarchar(2),)
ASINSERT INTO Market(  MarketCode  MarketName  LastUpdateDate)VALUES(  @MarketCode  @MarketName  @LastUpdateDate
)

View 5 Replies View Related

Want To Call Procedure From VS 2005

Apr 26, 2008

dear all
 i am using VS 2005 and sqlserver 2005....
 i created one procedure [dbo].[Rptdailyactivity_jul](@cond Varchar(8000), @Type varchar(100),@groupname4fsumm varchar(100) ,@Fromdate4fsumm datetime, @todate4fsumm datetime)
i want to call this procedure from VS how???
i tried based on the following code...
usig the following code i can able to manipulate tables...but how i can able to call procedure based on this code??and how i will pass parameters???
      ************
          Dim Conomandb As New System.Data.SqlClient.SqlConnection("Data Source=HJIOertsv;Initial Catalog=tr;Integrated Security=True")            If Conomandb.State = 1 Then Conomandb.Close()            Conomandb.Open()
            Dim Comomandb1 As New System.Data.SqlClient.SqlCommand(strSQL, Conomandb)            Dim rsOman1 As System.Data.SqlClient.SqlDataReader = Comomandb1.ExecuteReader()
             If rsOman1.Read() Then                        fghghfghf
             End If            Comomandb1.Cancel()            Comomandb1.Dispose()            rsOman1.Close()            ''*********************

View 4 Replies View Related

How To Call Sql Store Procedure In Asp.net

Sep 22, 2004

I create a store procedure in sql, how do I call it?

thankss

View 2 Replies View Related

How To Call A Stored Procedure In Asp.net

Mar 31, 2006

I have created a stored procedure only with an insert statement in sql server 2005.
How can i call this stored procedure through code in ASP.NET page using vb.
i want to pass one parameter that comes from a text box in asp.net page.
my emailid is: g12garg@yahoo.co.in pls reply.
Thank you
Gaurav

View 2 Replies View Related

Call For BCP Within A Stored Procedure

Aug 7, 2001

Does anyone give me syntax for adding a bcp script within a stored procedure..I had done it once 3 yrs back does'nt seem to work now, and I do not know where I am going wrong??
Thanks

View 2 Replies View Related

How Can I Use Stored Procedure To Call Dll

Aug 7, 2001

Hi, If I have a dll file and I know the interface of that dll file. How can I use stored procedure to call this dll file? Thank you.

View 1 Replies View Related

How Can I Use Stored Procedure To Call Dll

Aug 7, 2001

Hi, If I have a dll file and I know the interface of that dll file. How can I use stored procedure to call this dll file? Thank you.

View 2 Replies View Related

Remote Procedure Call

Jul 25, 2002

I have a SQL2000(sp2) database (ServerA) and a SQL7(sp2) database(ServerB)
From the SQL2000 database I want to call a remote stored procedure on ServerB and store the result set in a table on ServerB.

E,g

insert TableA
exec ServerB...sp_GetStuff

If I try this by making serverB a remote server,
I get the following error message
Server: Msg 18456, Level 14, State 1, Line 1
Login failed for user 'sa'.
If I make ServerB a Linked server, I get the error
Server: Msg 8501, Level 16, State 1, Line 1
MSDTC on server '' is unavailable.
Server: Msg 7391, Level 16, State 1, Line 1
The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.

Now the MSDTC on ServerB won't start - It returns error 3221229574 to which the solution seems to be to reinstall MSDTC which looks like a very messy job with registry hacks and also the threat of reformatting the hard drive So I don't want to do this if possible

I really don't want a distibuted transaction anyway so I tried to stop the transaction being promoted using
SET REMOTE_PROC_TRANSACTIONS OFF

But this has no effect

Any ideas would be appreciated"

View 1 Replies View Related

Call SQL Stored Procedure

Nov 9, 2005

Greetings,

Even though this may be not right place with this issue I would like to try!
I facing with the problem “Object Variable or With Block variable not set” while I am trying to execute the stored procedure from Ms. Access form.
I need some help very badly or maybe a good sample of code that works in this issue is very welcome.

Many thanks in Advance

View 1 Replies View Related

Stored Procedure Call

Jul 4, 2006

hi,

i created a stored procedure and below is the code segment of it;

create Procedure test1
@price as varchar(50) output,
@table as varchar(50) = ''
AS


Declare @SQL_INS VarChar(1000)


SELECT @SQL_INS = 'select ['+@price+'] from ['+@table+']'

Exec (@SQL_INS)

Procedure gets 2 parameters, one of them is just INPUT parameter and the other one is both OUTPUT and INPUT. What i wanna do is to get the result set of this procedure to use in my application.

View 5 Replies View Related

Call Stored Procedure From Another SP

Dec 11, 2007

Hi, i wanna know if we can call a stored procedure from another one. If yes, what's the syntax?
Thanks

View 3 Replies View Related

How To Call Store Procedure

Mar 12, 2008

Hi, how to call the shrink_file proc from shrink_file_caller proc as below??



CREATE PROCEDURE [dbo].[Shrink_File]
@DBName VARCHAR(100),
@err INT OUTPUT
AS
...
GO

CREATE PROCEDURE [dbo].[Shrink_File_Caller]
@DBName VARCHAR(100),
@err INT OUTPUT
AS
SET NOCOUNT ON;
DECLARE @nsql NVARCHAR(4000);

SET @nsql = '' + @DBName + '.dbo.Shrink_File ''' + @DBName + ''', @err OUTPUT' ;
EXEC sp_executesql @nsql,N'@err INT OUTPUT', @err = @err OUTPUT;

GO

declare @err int;

EXEC Shrink_File_CALLER 'DATABASE1', @err

select @err as err;


I get the error:

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'DATABASE1'.

(1 row(s) affected)

View 9 Replies View Related

How To Call Stored Procedure In VC++

Oct 6, 2007



Respected Sir/MAm

i am working on VC++ (visual studio2005 with sql200).i have created one stored procedure to insert data into table.
i want to call this strd procedure in the VC++ main.cpp file....

Could you please help me for the correct syntax code with example.


Thank You.
Upali

View 4 Replies View Related

Stored Procedure's Call

Apr 7, 2008

Hi there. My problem is: I have two stored procedures.
1. SELECT A FROM B
2. SELECT C FROM D WHERE A = EXEC First procedure

The meaning: First procedure gets some Id from B table. The second one gets a DataSet by this Id number. The problem is that when I getting an Id from first proc I use SELECT, than in the second one I use EXEC, and in the end, seconf procedure returns two DataSets. The first contains an Id from first procedure, second contains a valid DataSet. Therefore my application falls because it suppose that valid data in first DataSet. Hoow can I call to stored procedure from another stored procedure without creating two DataSets?
P.S. I already tried to use return instead of select in the first procedure. Same result.
Thank you

View 8 Replies View Related

How Can I Call A Dll/exe From My Procedure/trigger

Nov 30, 2007

Hi I am trying to run a dll or exe from a procedure or trigger in the database.

I have tried EXEC master ..xp_cmdshell '\xx empdivConsoleApplication1.exe' and
use master exec dbo.StoredProcedure1

If I run the exe from explorer all is working, but from a trigger or procedure in the database nothing happens only executed successfully.

I loaded the assembly and procedure into the master database



Code Block
CREATE PROCEDURE [dbo].[ClassLibrary3] AS EXTERNAL NAME
[ClassLibrary3].[ClassLibrary3.Class1].[StoredProcedure1]





My C# code:


Code Block
public partial class StoredProcedures
{ [Microsoft.SqlServer.Server.SqlProcedure]

public static void StoredProcedure1()
{ //------first a select to get some data String prosjekter = "";
String connString = @"Data Source=serverOFFICESERVERS;Initial Catalog=WSS_Content;Integrated Security=SSPI";
SqlConnection conn = new SqlConnection(connString);
SqlCommand sqlcmd = new SqlCommand("Select nvarchar3 prosjekt from dbo.AllUserData where tp_listId = @listid", conn);
sqlcmd.Parameters.AddWithValue("@listid", "xxx"); try { conn.Open(); SqlDataReader r = sqlcmd.ExecuteReader();
while (r.Read())
{ prosjekter += "" + r["prosjekt"] + "" + "";
}
r.Close(); conn.Close();
} catch (Exception)
{ conn.Close(); }
//-----write some changes back to a program pocketForm pf = new pocketForm();
try {
pf.LoadFromFile("C:/temp/div/xxx.xpf");
string xmlstring = pf.FormXML;
int id, item, items; id = xmlstring.IndexOf("xxxxx");
item = xmlstring.IndexOf("", id);
items = xmlstring.IndexOf("", item);
xmlstring = xmlstring.Remove(item, items - item);
xmlstring = xmlstring.Insert(item, prosjekter);
pf.FormXML = xmlstring;
pf.StatusModifiedLocally = true;
WebService.Login("http://xxxx.no", "xx", string.Empty, string.Empty);
WebService.Save(pf);
} catch (Exception)
{
}

What am I missing here ? Please answer this as I have tried everything with no success. Regards Ivar

View 5 Replies View Related

Asynch Call DTS Or Stored Procedure 1.1

Jul 10, 2006

Hi,
I would like to trigger a DTS or a stored procedure from asp.net 1.1 BUT
I don't want to wait for it to finish. In fact the DTS/Storeproc calculates values into different tables.
Those values are not needed immediately. The calculation takes between 20 or 30 minutes.
Do you have any idea how to do it ?
Thanks

View 3 Replies View Related

How Do I Call A Store Procedure With Parameter?

Aug 9, 2006

I have searched this forum for how to call a store procedure with
parameter and so far no result has answered my question yet. I have the
following store procedure:


SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author:        <Author,,Name>

-- Create date: <Create Date,,>

-- Description:    <Description,,>

-- =============================================

CREATE PROCEDURE sqlSearch

    -- Add the parameters for the stored procedure here

    @strSearch varchar(250)

AS

BEGIN

    -- SET NOCOUNT ON added to prevent extra result sets from

    -- interfering with SELECT statements.

    SET NOCOUNT ON;



    -- Insert statements for procedure here

    WHERE ([name_nws] LIKE '%" + @strSearch + "%' OR
[title_nws] LIKE '%" + @strSearch + "%'OR [sub_nws] LIKE '%" +
@strSearch + "%' OR [sum_nws] LIKE '%" + @strSearch + "%' OR
[content_nws] LIKE '%" + @strSearch + "%')

END

GO

I got this far in my code on how to call the parameter store procedure.
string strConn = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString; SqlConnection sqlConn = new SqlConnection(strConn); SqlCommand sqlComm = new SqlCommand(); sqlComm.Connection = sqlConn; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "sqlSearch"; sqlComm.Parameters.Add("@strSearch", SqlDbType.VarChar);  I don't know what do next.

Help is much appreciated.

View 4 Replies View Related

Call Stored Procedure In Loop

Oct 26, 2006

I have gridview display a list of users. I have added a column for a check box. If the box is checked I move the users to another table.I need to pass some parameter of or each row to a stored proc. My question. In the loop where I check if the checkbox is selected I need to call the stored procedure.Currently I do an open and closed inside the loop.What is best and most effficent  method of doing this should I open and close the connection outside the loop and change the procs parameters as loop through. System.Data.SqlClient.SqlConnection conn =
new System.Data.SqlClient.SqlConnection(
System.Configuration.ConfigurationManager.ConnectionStrings["connString"].ConnectionString);
System.Data.SqlClient.SqlCommand commChk = new System.Data.SqlClient.SqlCommand("storedProc", conn);
commChk.CommandType = System.Data.CommandType.StoredProcedure;
commChk.Parameters.AddWithValue("@mUID", ddMainUser.SelectedValue.ToString());
commChk.Parameters.AddWithValue("@sUId", gvUsers.Rows[i].Cells[2].Text);
commChk.Connection.Open();
commChk.ExecuteNonQuery();
conn.Close();   If so exactly how do I do this? How do I reset the parmaters for the proc?  I haven't done this before where I need to loop through passing parameter to the same proc. thanks    

View 2 Replies View Related







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