Posted - 07/18/2012 : 19:40:07
| Hello everyone,
I don't know why sql server management studio is not accepting my foriegn key query. This is what I am trying to add to my database.
ALTER TABLE customer_rentals ADD CONSTRAINT fk_customer_rentals_movies FOREIGN KEY(movie_id)
Msg 1778, Level 16, State 0, Line 1
Column 'movies.movie_id' is not the same data type as referencing column 'customer_rentals.movie_id' in foreign key 'fk_customer_rentals_movies'.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
When I check the customer_rental column (movie_id) is in the column as a VARCHAR data type. In the movie column (movie_id) is the primary key with an int data type.