Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ALTER TABLE won't drop DEFAULT with objref
Message
De
22/07/2007 16:13:27
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
ALTER TABLE won't drop DEFAULT with objref
Divers
Thread ID:
01242635
Message ID:
01242635
Vues:
73
I inherited a DBC full of tables that have default values set at the table level. Generally this is something I don't do since I use views exclusively to insert records, but normally within my framework the values being there is no problem.

But some of the DEFAULT values are object references like

This.oapplication.osecurity.cuserid

Make sense in the context of a VFE app but not a good thing for my conversion program as I massage and upsize the data for SQL Server.

Okay, so I want to get rid of the default values for all fields in all the tables.

In a prg I cycle through the tables and fields, and for each field I do

cmdstr=[alter table ]+lctable+[ alter column ]+lcfld+[ DEFAULT ]
&cmdstr

If the table contains any default values with This. I get an error the first time I try to run this ( even if that field isn't the one that has the objref default value ) saying I can only use "This" inside a method. Of course I am not trying to use it, just drop it. Seems alter table should be smart enough to know that ...

Am I using the ALTER TABLE syntax wrong to clean out a default value?

I could a class, I guess, and run this stuff as a method etc so obj ref would make sense but seems like there should be a way to do this without that.

Thoughts?

TIA


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform