Home Dashboard Directory Help
Search

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


Status: 

Closed


1
0
Sign in
to vote
Type: Bug
ID: 775598
Opened: 1/2/2013 8:30:34 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

From http://msdn.microsoft.com/en-us/library/ms174979.aspx

"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.
Details
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.

cheers,
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
Sign in to post a workaround.