Question: I currently have (tables changed):

**User**

```
UserID uniqueidentifier,
CompanyID uniqueidentifier, (for future reference)
.. more unrelated fields

(PK: UserID)

```

**UserRating**

```
UserID uniqueidentifier,
MovieID uniqueidentifier,
RatingTypeID uniqueidentifier,
Rating tinyint

(PK: UserID, MovieID, RatingTypeID)

```

**RatingType**

```
RatingTypeID uniqueIdentifier,
Title varchar(25)

(PK: RatingTypeID)

```

The RatingType table contains "Favorite", "Need to Watch", etc. So actual Rating value is how much they liked a Favorite, or how badly the want to watch a movie etc. 

Now I introduce a new table:

**Company**

```
 CompanyID uniqueidentifier,
 .. more unrelated fields

```

The idea is that if a user becomes part of a company, due to requirements that cannot change, all the Ratings need to be Company ratings and not User Ratings. I'm not a normalization guru, but for some reason creating another table (below) seems redundant, but maybe I'm thinking to much into it.

**CompanyRating**

```
CompanyID uniqueidentifier,
MovieID uniqueidentifier,
RatingTypeID uniqueidentifier,
Rating tinyint

(PK: CompanyID, MovieID, RatingTypeID)

```

This feels incorrect because it almost matches the rating table and if I need to do any averages it becomes more difficult to average across two tables. Is there a better design for my needs?

Answer: 
I would strongly suggest metadata in the connection in order to trace back to the application. In the connection string, there is an Application Name. There is also session data which can be used in the form of [CONTEXT\_INFO](http://msdn.microsoft.com/en-us/library/ms180125.aspx)

<https://stackoverflow.com/questions/323494/sql-server-modifying-the-application-name-property-for-auditing-purposes>

Of course all this requires application changes, but it is good for tracing and auditing in general, so baking it in from the beginning is really useful.
How about these techniques using ToTraceString?

<http://blog.cincura.net/227674-how-to-show-sql-command-created-by-entity-framework/>
http://www.dotnetcurry.com/ShowArticle.aspx?ID=647

Collect and correlate with your trace.