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
 General SQL Server Forums
 New to SQL Server Programming
 insert query help needed

Author  Topic 

pratikp0088
Starting Member

2 Posts

Posted - 2012-01-27 : 03:30:59
I have two database say A and B.

A have a1 table having column names userid,pin_no and B database have b1 table having column names id,badge_no.

I want to insert data from a1 to b1 and b1 should get updated as and when a1 updates

ppratik

pratikp0088
Starting Member

2 Posts

Posted - 2012-01-27 : 04:02:15
simply i want to insert userid in id and pin_no into badge_no

ppratik
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-27 : 08:32:35
if A and B are in same server use

use [B]
insert b1
select userid,pin_no
from A.dbo.a1


if they're in different servers (Server1 and Server2), Add A as a linked server in B and then use like


USE [B]
insert b1
select userid,pin_no
from [Server1].A.dbo.a1


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -