Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Andy Kramek
  Where is Andy Kramek?
 Hot Springs Village
 Arkansas - United States
 Andy Kramek
 To: Daniel Hofford
  Where is Daniel Hofford?
 Ocala
 Florida - United States
 Daniel Hofford
 Tags
Subject: RE: joining files with update sql
Thread ID: 154465 Message ID: 154758 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Wednesday, December 19, 2007 12:06:35 PM         
   


Hi Dan

> Sorry to jump in here but I have a question about how to get data types to agree in a join statement in SPT.
>
> That is, I want to say left join tablea on t1.field=t2.field - but t1.field is char and t2.field is int. Is there way to turn one into the other in the SPT select statement? Something like CAST()?

You can use CAST() or you can use any of the string functions to convert integers to strings or vice versa:

*** Join on Integer
WHERE INT(VAL( t1.field )) = t2.field
WHERE CAST( t1.field AS INT ) = t2.field

*** Join on Char String
WHERE ALLTRIM(STR( t2.field )) == ALLTRIM(t1.field)
WHERE ALLTRIM( PADL( t2.field, 10 )) == ALLTRIM(t1.field)


Regards
Andy Kramek
Microsoft MVP (Visual FoxPro)
Tightline Computers Inc, Akron Ohio, USA

ENTIRE THREAD

joining files with update sql Posted by Bob Stranks @ 12/16/2007 5:38:38 PM
RE: joining files with update sql Posted by suhas hegde @ 12/16/2007 6:46:48 PM
RE: joining files with update sql Posted by Bob Stranks @ 12/16/2007 7:59:52 PM
RE: joining files with update sql Posted by Bernard Bout @ 12/17/2007 8:01:55 AM
RE: joining files with update sql Posted by Bob Stranks @ 12/17/2007 4:58:32 PM
RE: joining files with update sql Posted by Andy Kramek @ 12/17/2007 12:59:34 PM
RE: joining files with update sql Posted by Bob Stranks @ 12/17/2007 4:57:53 PM
RE: joining files with update sql Posted by Daniel Hofford @ 12/19/2007 5:12:01 AM
RE: joining files with update sql Posted by Andy Kramek @ 12/19/2007 12:06:35 PM