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.
Author |
Topic |
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2011-08-29 : 11:00:24
|
I am having trouble With a Like statement. how do i get the like to work, I am not quite sure how do get it to work.ThanksDECLARE @orgnum varchar(10)DECLARE @orgnum1 varchar(10)set @orgnum1='8-3930'set @orgnum='83930'UPDATE Tesisdev.dbo.TNBCompare SET status='no', ORG= (Select BU from TESIS.DBO.Tesis2 where KEY0 LIKE @orgnum1)WHERE Tesisdev.dbo.TNBCompare.DN = @orgnum |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-29 : 11:02:39
|
dont you have any relationships between two tables?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2011-08-29 : 11:28:43
|
NO Tesis2 table has a column KEY0 that has phone numbers like 1-1111 and TNBCompare has a column DN with numbers like 11111 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-29 : 12:29:42
|
[code]UPDATE tcSET tc.status='no', tc.ORG= t.BUFROM Tesisdev.dbo.TNBCompare tc INNER JOIN(Select KEY0 ,BU from TESIS.DBO.Tesis2) tON REPLACE(t.KEY0,'-','') = tc.DN [/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2011-08-29 : 16:51:00
|
Worked like a charm! Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-30 : 10:03:24
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|