Android Question change column sql

harinder

Active Member
Licensed User
Longtime User
I want the correct syntax for changing column name of a database. Following not working where I want to change names of 2 columns, one from old to new, other from good to bad..thnx

B4X:
Dim chngQuery As String= "ALTER TABLE " &Main.DBTable & " CHANGE COLUMN  old new CHANGE COLUMN good bad"
        Main.SQL1.ExecNonQuery(chngQuery)
 

OliverA

Expert
Licensed User
Longtime User
When he could simply use the following without printf and get the same result unless he wants to prefix the minutes with a 0 if 1 digit
All examples provided by @harinder throughout this thread show 2 digit minutes (for the xx:xx hour/minute combo)
printf looks intimidating
I'm familiar with "printf" due to some C exposure in the past.
not too common
If backwards compatibility is a must (see comments to this stackoverflow post: https://stackoverflow.com/a/21956882), one may look into the alternative solution I linked to above that uses substr and concatenation.

Note: The question by @harinder should have probably been posted as a new forum question. At that point, others with more SQL knowledge may have lent a helping hand.
 
Upvote 0

harinder

Active Member
Licensed User
Longtime User
Yes Mahares..point taken..but also that if H and M are taken separately, manipulated and another routine added to store HH:MM in its particular column, then it takes quite a few coding lines to accomplish the task...plus isn't sql faster to handle this task? thnx
 
Upvote 0

harinder

Active Member
Licensed User
Longtime User
Note: The question by @harinder should have probably been posted as a new forum question. At that point, others with more SQL knowledge may have lent a helping hand.
Point taken for future compliance, but my post wherein I clarified with the reframing of my query giving exact table info was to clarify what I exactly wanted, else this thread was hanging at a loose end....
 
Upvote 0
Top