foreign-keys

In SQL Server, intercept and change the value a column is set to

I'm trying to improve a legacy database. One problem is that it's missing a lot of foreign key relationships. In some of the columns involved, the associated application is setting fields to an empty string when it should be setting them to null. What I'd like to do is to intercept any attempt to set that column and replace empty strings...

How does an associated database acquire its foreign key?

I did a bunch of gutting to my default controllers and now I can't get my user_id to populate on create. I was curious how that gets populated. If you're interested, take a look at my routes, and model assocations, and then at then end I'll show you the resulting params..The end result is no user_id being added. routes resources :user...

Can SQLite support this schema?

Hi, imagine I have this table called Department. Each Department can have child Departments. I was thinking of having a column called ParentDepartmentID as foreign key to another department. If this key is null, it means it's a Parent top class department and not child of any other department. I guess you could call this a self referen...