Clicky

Hello All.

I am trying to do an update on one table when there is a matching record in another table on a diffrent database below is my code. She builds find but does not work ... any IDEAS?

 SELECT     a.*, b.*                            FROM         dbo.tblPayment AS a INNER JOIN                                                   GradAPP.dbo.Student_INFO AS b ON a.IP = b.IP                            WHERE     (a.PaymentType = 2)                                                       UPDATE    b                                                        SET              b.PaymentStatus = 1                                                        WHERE     (a.Successfull = 1) AND (b.PaymentStatus = 0)                             
1: 2: 3: 4: 5: 6: 7: 

Select allOpen in new window

asked 12/16/2011 01:40

HawaiiDragon's gravatar image

HawaiiDragon ♦♦


4 Answers:
like this ?
1:
2:
3:
4:
5:
6:
7:
UPDATE GradAPP.dbo.Student_INFO
   SET PaymentStatus = 1
 WHERE exists (select ip from dbo.tblpayment as a 
                where a.Successfull = 1 
                 and a.ip=GradAPP.dbo.Student_INFO.ip
                 and a.paymenttype=2)
   AND PaymentStatus = 0
link

answered

Lowfatspread's gravatar image

Lowfatspread

This is what I have tried to no avail

error
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "Wdb_CCPayment.dbo.tblPayment.Successful" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "Wdb_CCPayment.dbo.tblPayment.IP" could not be bound.
1:
2:
3:
4:
UPDATE GradApp.dbo.STUDENT_INFO
sET Gradapp.dbo.student_Info.PaymentStatus = 1

WHERE (Wdb_CCPayment.dbo.tblPayment.Successful = 1) and (Gradapp.dbo.student_Info.pAYMENTsTATUS = 0) and (Gradapp.dbo.student_Info.IP = Wdb_CCPayment.dbo.tblPayment.IP)
link

answered 2011-12-16 at 09:54:32

HawaiiDragon's gravatar image

HawaiiDragon

UPDATE GradAPP.dbo.Student_INFO
   SET PaymentStatus = 1
 WHERE exists (select ip from WDB_CCPayment.dbo.tblpayment as a
                where a.Successful = 1
                 and a.ip=GradAPP.dbo.Student_INFO.ip
                 and a.paymenttype=2)
   AND PaymentStatus = 0

Low fat you rock!!!
link

answered 2011-12-16 at 10:05:18

HawaiiDragon's gravatar image

HawaiiDragon

UPDATE GradAPP.dbo.Student_INFO
   SET PaymentStatus = 1
 WHERE exists (select ip from WDB_CCPayment.dbo.tblpayment as a
                where a.Successful = 1
                 and a.ip=GradAPP.dbo.Student_INFO.ip
                 and a.paymenttype=2)
   AND PaymentStatus = 0

Low fat you rock!!!
link

answered 2011-12-16 at 10:13:17

HawaiiDragon's gravatar image

HawaiiDragon

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: 12/16/2011 01:40

Seen: 281 times

Last updated: 12/16/2011 04:13