Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ALTER TABLE won't drop DEFAULT with objref
Message
From
22/07/2007 17:53:12
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01242635
Message ID:
01242642
Views:
16
>Shouldn't it be?
>
>cmdstr=[alter table ]+lctable+[ alter column ]+lcfld+[ DROP DEFAULT ]
>
>

Unfortunately I get the error either way. If I MODI the table and manually erase the two defaults that are based on an objref I can then remove the others which call functions with either DROP DEFAULT or just DEFAULT with no expression passed. But if any field has an objref default the alter table will fail on any field.

Strange.

I thought I might be able to hack the DBC but it seems default values are in the same mystery memo with other field attributes and I'm not sure I could programmaticaly STRTRAN is out of there without breaking something.



>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform