varchar(max) in FK constraint? CREATE TABLE topic on BOL - by Martin Smith

Status : 


Sign in
to vote
ID 775598 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/2/2013 8:30:34 AM
Access Restriction Public



"A column of type varchar(max) can participate in a FOREIGN KEY constraint only if the primary key it references is also defined as type varchar(max)."

Well I suppose technically it is correct but AFAIK it is not possible to create a PK with such a column so this can never arise. 

I presume that this is intended to make the point that the length of varchar columns must be the same on both sides of the relationship.
Sign in to post a comment.
Posted by Microsoft on 7/16/2013 at 6:06 PM
I've removed the incorrect statement and replaced it with a general statement that states referencing columns must match in length and scale.

Gail Erickson
Posted by Microsoft on 1/2/2013 at 5:33 PM
Thanks for reporting this issue Martin. We will review and update the topic accordinglhy.

Kind regards,
Gail Erickson
SQL Server Documentation team