Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change fieldtype sql - select
Message
From
17/05/2008 19:47:08
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Change fieldtype sql - select
Miscellaneous
Thread ID:
01317905
Message ID:
01317905
Views:
53
Hi,

When I browse my sqlyog I find the fields
online
and
tlUpdate
with fieldtype 'Character' , online is populated with 'TRUE', 'FALSE', .NULL., tlUpdate is populated with a Datetimeexpression or .NULL.

I could first select them as characterfields and replacing the .NULL. with '' using coalesce, make a second select to change the chracterfields to the correct fieldtype with according values.

Just wondering if this could not be done in one select?
FOR me the most logical approach would be: 

TEXT TO sqltxt noshow pretext 15 TEXTMERGE
	select
		CAST(coalesce(online,'TRUE',.T.,.F.) as L) as online ,
		CAST(coalesce(tlupdate,'') as T) as tlUpdate  
		from HORSART_WORKS
ENDTEXT
lcResult = sqlexec(lnRet, lcSql,"curHorsart_Works")
IF lcResult < 0
  * Error
ELSE
	DO my thing
ENDIF

however this gives no result

Regards,

Koen
Next
Reply
Map
View

Click here to load this message in the networking platform