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
 Transact-SQL (2005)
 Help with update

Author  Topic 

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-10-07 : 09:35:08
Can anyone help I can't see what is wrong with this

UPDATE Newsletter_test
SET PathName = SELECT replace(InfFilePath,'Srvone','SRVtwo') FROM insightNewsletterFiles_test




--------------------------
SQL Server MCP & MCTS

Sachin.Nand

2937 Posts

Posted - 2009-10-07 : 09:40:29
UPDATE T1 SET T1.PathName =REPLACE(T2.InfFilePath,'Srvone','SRVtwo')
FROM Newsletter_test T1
INNER JOIN insightNewsletterFiles_test T2 ON T1.someid=T2.someid

PBUH
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-07 : 09:44:33
quote:
Originally posted by NeilG

Can anyone help I can't see what is wrong with this

UPDATE Newsletter_test
SET PathName = SELECT replace(InfFilePath,'Srvone','SRVtwo') FROM insightNewsletterFiles_test




--------------------------
SQL Server MCP & MCTS


So, you meant there were no relations between the tables?

Madhivanan

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

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-10-07 : 09:46:08
No there wasn't
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-10-07 : 09:46:22
isn't sorry
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2009-10-07 : 09:52:23
Then maybe u will hv to sth lk this

UPDATE T1 SET T1.PathName =REPLACE(T2.InfFilePath,'Srvone','SRVtwo')
FROM Newsletter_test T1
INNER JOIN insightNewsletterFiles_test T2 ON T1.PathName<>'Why my life sucks???'

I hope u dont hv path named that.

PBUH
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-07 : 10:01:20

UPDATE Newsletter_test
SET PathName = (SELECT replace(InfFilePath,'Srvone','SRVtwo') FROM insightNewsletterFiles_test)

Madhivanan

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

- Advertisement -