Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Copy tables data to another database

Author  Topic 

Willio
Starting Member

20 Posts

Posted - 2007-07-04 : 07:07:36
Hello all,

I'v got a database full with an administration. This database needs to be protected and can not be accessed from the internet. Now we are making an internetpage for the employees and i want to read from the database who's working here.

For the security i want to copy some database data from one database to another... Is that possible? With a script ore something?

Thanks i advance!

Willio

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2007-07-04 : 08:09:58
Dear oh dear,

Right-mouse click on database
Tasks/Export Data
Go to Top of Page

Willio
Starting Member

20 Posts

Posted - 2007-07-04 : 08:45:41
quote:
Originally posted by coolerbob
Right-mouse click on database
Tasks/Export Data



Should say that it's oke. But then i think i forgot to give some information. I needs to be done on the moment something change in the employee table. So I have to write some kind of a trigger....
Go to Top of Page

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2007-07-04 : 11:26:37
tilt!
Go to Top of Page

Willio
Starting Member

20 Posts

Posted - 2007-07-05 : 05:56:12
Could you be more specific?? :-)
Go to Top of Page

Carat
Yak Posting Veteran

92 Posts

Posted - 2007-07-05 : 06:01:22
You have to create a trigger on the table where the data is updated.

CREATE TRIGGER dbo.TestTrigger ON schema.TableName AFTER UPDATE
AS

---------------
Statements
---------------

You can use the tables deleted and inserted to control whether a row has changed .
Go to Top of Page

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2007-07-05 : 12:16:05
quote:
Originally posted by Willio

Could you be more specific?? :-)



Tilt is what you do on a Pinball machine when you're in trouble.
It's an expression for when you're in trouble.
Newbies should not muck around with triggers - I can say that from my own experience.
Does the data need to be copied instantly or can you do it nightly?

Go to Top of Page

Willio
Starting Member

20 Posts

Posted - 2007-07-11 : 04:02:02
Yes oke and how do i get data to another database.

What will be the statement if i have 2 databases with the table employee and i want to copy it.

Greetings

b.t.w. it could be done over night but better is instantly...
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-07-11 : 12:48:57
Can you use replication?
Go to Top of Page

Willio
Starting Member

20 Posts

Posted - 2007-07-12 : 07:58:38
quote:
Originally posted by rmiao

Can you use replication?



If i can trigger the replication and can choose which fields i can replicate.

I will look in to it!

Any other suggestions? :D

Thanks!

Edit: Seems like an replication is a copy of an complete table / database. And now i am looking into problem i would like to preform a query and write the result in another database. The database will be on the same server. That should make it a bit easier right??
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-07-13 : 18:27:35
No, you can choose tables and columns to replicate.
Go to Top of Page
   

- Advertisement -