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 - 2010-09-17 : 19:49:24
|
I am comparing 2 tables to see if the 2nd table has the correct information in it yet (2 different systems). This statement should tell me what needs to go into the Tesis2 table.SELECT VoipNumber FROM VOIPNumbers WHERE NOT Exists(Select * from Tesis.dbo.tesis2 WHERE Tesis.dbo.tesis2.KEY0 = Voipnumber)My issue is that KEYO has the phonenumber stored as XXX-XXXX and VoIPnumber is XXXXXXX. How do I remove the "-" to do the comparison?ALSO KEY0 is Nvarchar and VoIPNumber is Numeric,Thank you |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2010-09-17 : 20:13:30
|
replace function?Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
|
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2010-09-18 : 00:16:32
|
I am looking to see if Table Tesis has the same information that table VoipPhones has, if not tell me what Tesis is missing. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-09-18 : 09:07:57
|
SELECT v.VoipNumber FROM VOIPNumbers v WHERE NOT Exists(Select 1 from Tesis.dbo.tesis2 WHERE REPLACE(Tesis.dbo.tesis2.KEY0,'-','') = v.Voipnumber)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2010-09-18 : 16:39:39
|
Works great! Thank you. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-09-19 : 11:40:38
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|