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 2000 Forums
 Transact-SQL (2000)
 Please help how to Update...

Author  Topic 

danielc
Starting Member

49 Posts

Posted - 2006-08-04 : 14:45:05
I must say this is a great forum, quick responses...

My question is:

I am planning to create a stored procedure to update several tables on DB2 from DB1 that only has one table. DB1 resides on the same server as DB2. As stated earlier DB1 has one table with 46 feilds(columns). The 46 feilds(columns) need to update different tables on DB2. Feild names are different on DB's.

DB1
StudentID
FirstName
LastName
MiddleName
etc..

DB2
STU.FN
STU.LN
STU.ID

update STU set PG = G1FirstName + ' ' + G1LastName
from db1.dbo.StudentEnrollment
where STU.ID = StudentEnrollment.StudentID

Would I have to write 46 update statements in the sproc?

Thanks all,

Daniel

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-08-04 : 14:54:43
What do u mean by "Data elements" ? Post some sample data & expected results.

Srinika
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-08 : 12:56:28
You can use seperate update statements or use While Loop
But you need to give more informations

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -