|
Home > Archive > MS SQL Server > April 2005 > How to update table on different Data Base ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to update table on different Data Base ?
|
|
| FAYYAZ 2005-04-28, 7:23 am |
| Hi Everyone,
I have very small question.
Actually I have two Databases on same SQL Server say DATABASE1 and
DATABASE2.
Both databases have one table called TABLE1 as exact copy. I am updating
DATABASE1.TABLE1 using ASP code. I want DATABASE2.TABLE1 also to be updated
with same data but not via ASP code.
Is there any way of pulling or pushing data for TABLE1 only ?
Kind Regards,
Fayyaz
| |
| Jens Süßmeyer 2005-04-28, 7:23 am |
| "Triggers are often used for enforcing business rules and data integrity.
SQL Server provides declarative referential integrity (DRI) through the
table creation statements (ALTER TABLE and CREATE TABLE); however, DRI does
not provide cross-database referential integrity."
FROM
http://msdn.microsoft.com/library/d...reate2_7eeq.asp
HTH, Jens Suessmeyer.
---
http://www.sqlserver2005.de
---
"FAYYAZ" <anyone@anyone.com> schrieb im Newsbeitrag
news:OVFPMX%23SFHA.1896@TK2MSFTNGP14.phx.gbl...
> Hi Everyone,
>
> I have very small question.
>
> Actually I have two Databases on same SQL Server say DATABASE1 and
> DATABASE2.
>
> Both databases have one table called TABLE1 as exact copy. I am
> updating
> DATABASE1.TABLE1 using ASP code. I want DATABASE2.TABLE1 also to be
> updated
> with same data but not via ASP code.
>
> Is there any way of pulling or pushing data for TABLE1 only ?
>
> Kind Regards,
>
> Fayyaz
>
>
>
| |
| Chandra 2005-04-28, 7:23 am |
| Hope this will answer the problem:
CREATE TRIGGER <TRIGGER>
ON DATEBASE1.TABLE1 FOR UPDATE AS
UPDATE DATEBASE2.TABLE1
SET DATEBASE2.TABLE1.COLUMN1 = INSERTED.COLUMN1
DATEBASE2.TABLE1.COLUMN2 = INSERTED.COLUMN2
DATEBASE2.TABLE1.COLUMN3 = INSERTED.COLUMN3
DATEBASE2.TABLE1.COLUMN4 = INSERTED.COLUMN4
DATEBASE2.TABLE1.COLUMN5 = INSERTED.COLUMN5
WHERE DATABASE2.TABLE1.PRIMARY_KEY = INSERTED.PRIMARY_KEY
GO
thanks and regards
Chandra
"FAYYAZ" wrote:
> Hi Everyone,
>
> I have very small question.
>
> Actually I have two Databases on same SQL Server say DATABASE1 and
> DATABASE2.
>
> Both databases have one table called TABLE1 as exact copy. I am updating
> DATABASE1.TABLE1 using ASP code. I want DATABASE2.TABLE1 also to be updated
> with same data but not via ASP code.
>
> Is there any way of pulling or pushing data for TABLE1 only ?
>
> Kind Regards,
>
> Fayyaz
>
>
>
>
|
|
|
|
|