Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Upsizing to SQL and nullable fields
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00704288
Message ID:
00705425
Views:
19
>First thing to do is change all datetime fields in VFP to allow nulls. Working with VFP, SQL Server and Oracle data sources for the past four years I find it much easier to keep the data sources as alike as possible. If you have a large number of tables in the database it is easier to write a program to do the conversion. I've got the code somewhere if you want an example.
>
>I'd be interested in taking a look at your code sample if you get the chance.
>
OPEN DATABASE (database_name)
lnTables = ADBOBJECTS(laTables,"TABLE")
FOR lnTable = 1 TO lnTables
  USE (laTables[lnTable]) EXCLUSIVE
  lnFieldCount = AFIELDS(laFlds,laTables[lnTable])
  FOR lnField = 1 TO lnFieldCount
    IF laFlds[lnField,2] = 'D' OR laFlds[lnField,2] = 'T'
      ALTER TABLE (laTables[lnTable]) ALTER COLUMN (laFlds[lnField,1]) NULL
    ENDIF
  ENDFOR
  USE
ENDFOR
Heavy Metal Pedal - click with care
Previous
Reply
Map
View

Click here to load this message in the networking platform