473,394 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Stored Procedure to upload data from one db to remote db

I have a situation where I want to take data from a local sql server
2000 db and update a remote database. I have the sql all set, was
wondering if this can be done in a timed interval with a stored
procedure on the local db.

Thanks in advance for your time
Dean-O
Jul 20 '05 #1
4 4083

"rockie12" <ro******@dtnspeed.net> wrote in message
news:d1**************************@posting.google.c om...
I have a situation where I want to take data from a local sql server
2000 db and update a remote database. I have the sql all set, was
wondering if this can be done in a timed interval with a stored
procedure on the local db.

Thanks in advance for your time
Dean-O


It depends what data you want to copy. If you want to copy all changes from
the source database to the target, then you could look at log shipping or
replication. If you want to copy only a subset of data, then replication
would still be an option (you can replicate data conditionally), but you
might find it easier to write your own procedure.

Also, you need to bear in mind what the network connection is like. If both
servers are on the same LAN, then you could use linked servers to INSERT
directly from one to the other. But if you have a less reliable connection,
then you would probably want a different approach.

If this isn't helpful, you might want to give some more detail about exactly
what you need to do. You could also post in
microsoft.public.sqlserver.replication if you're interested in that
possibility.

Simon
Jul 20 '05 #2
Hi

Simon has given you some alternatives, other alternatives may be DTS or
running the SQL (as a stored procedure). With SQL Server, if you wish to
schedule a timed event then usually SQLServerAgent is used to schedule
these. Agent jobs can be configured using Enterprise manager or using the
stored procedures sp_add_job, sp_add_jobstep and sp_add_jobschedule.

Each step can run a specific type of process (subsystem) such as 'CMDEXEC' -
an operating system command or executable. This could be used to run DTSRun
which can start a DTS job another alternative solution! 'TSQL' - a
transact-SQL statement (which can be a stored procedure).

John

"rockie12" <ro******@dtnspeed.net> wrote in message
news:d1**************************@posting.google.c om...
I have a situation where I want to take data from a local sql server
2000 db and update a remote database. I have the sql all set, was
wondering if this can be done in a timed interval with a stored
procedure on the local db.

Thanks in advance for your time
Dean-O

Jul 20 '05 #3
More detail on the situation. The databases are one different
servers. I want to set up a situation where the remote database will
have a procedure that will run when the home base database is
available and update the home base database. Sort of a sync function.

I am new to sql server. I have done much with MySql and have taken
care of this type of function with a Java program that runs as a
windows event.

Thanks in advance
Dean-o

"John Bell" <jb************@hotmail.com> wrote in message news:<fw*********************@news-text.cableinet.net>...
Hi

Simon has given you some alternatives, other alternatives may be DTS or
running the SQL (as a stored procedure). With SQL Server, if you wish to
schedule a timed event then usually SQLServerAgent is used to schedule
these. Agent jobs can be configured using Enterprise manager or using the
stored procedures sp_add_job, sp_add_jobstep and sp_add_jobschedule.

Each step can run a specific type of process (subsystem) such as 'CMDEXEC' -
an operating system command or executable. This could be used to run DTSRun
which can start a DTS job another alternative solution! 'TSQL' - a
transact-SQL statement (which can be a stored procedure).

John

"rockie12" <ro******@dtnspeed.net> wrote in message
news:d1**************************@posting.google.c om...
I have a situation where I want to take data from a local sql server
2000 db and update a remote database. I have the sql all set, was
wondering if this can be done in a timed interval with a stored
procedure on the local db.

Thanks in advance for your time
Dean-O

Jul 20 '05 #4
rockie12 (ro******@dtnspeed.net) writes:
More detail on the situation. The databases are one different
servers. I want to set up a situation where the remote database will
have a procedure that will run when the home base database is
available and update the home base database. Sort of a sync function.


A simple-minded approach is to use linked servers:

UPDATE HOMESRV.database.dbo.tbl
SET col1 = local.col1,
col2 = local.col2,
...
FROM HOMESRV.database.dbo.tbl home
JOIN localtbl local ON home.keycol = local.keycol

You may need to add INSERT and DELETE as well.

You set up a linked server with sp_addlinkedserver.

I'm not really sure whether this is the best way. Maybe replication is
better. In that case, you don't have to bother about starting the
process once you get connected. Then again, replication takes some time
to set up.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Luis | last post by:
I'm using a SQL Server 2000 stored procedure similar to the one below to upload data to a database. This data is collected from the user on a number of asp pages and stored in session variables...
0
by: Charley | last post by:
Hi, My local procedure needs to call a remote stored procedure which dblink name is built at the run time depending on the input parameter to the local procedure. Therefore depending on the...
1
by: sbh | last post by:
I need to copy data from a table on one Oracle server to another. Scenario: Need to create a stored procedure in server a, database aa that will copy data from server b, database bb, table bbb to...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
2
by: Tim.D | last post by:
Hello people, Thanks to Serge, PM, Knut and a host of others I have now successfully completed my very first SQL Stored Procedure. Takes some 13mins or so to run, but that was expected as it...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
5
by: Pedro Vera | last post by:
I am helping somebody setup one of the asp.net starter kits. I converted it from sql express to sql server with no real issues, and I got it running local perfectly. On my first attempt to run...
14
by: jehugaleahsa | last post by:
Hello: I am working with Oracle .NET Stored Procedures. I would like to know how to return the results of a SELECT statement. I have tried returning a OracleRefCursor and a DataTable, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.