This topic is locked

varchar and char linking

1/23/2007 12:32:57 PM
ASPRunnerPro General questions
J
JOHNF777 author

I have an MSSQL table (TABLE1) that has a field (FIELD1) defined as varchar(20) and I'm doing a lookup to another table (TABLE2) with FIELD2 defined as char(12).
It saves the record in TABLE1 fine. But when I go into the EDIT page, FIELD1 does not display correctly (blank? or Null?).
Any workaround for this?
Thanks.

Sergey Kornilov admin 1/23/2007

Use VARCHAR in both tables.
CHAR fields are filled with spaces to ensure value is always 12 characters long.

J
JOHNF777 author 1/23/2007

I can't change both of them to VarChar or Char.
I wish I can, that's why I'm looking for a workaround.
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=14832&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

Sergey Kornilov admin 1/23/2007

There is no good workaround as values do not match.
If you cannot change original tables create views for the table with CHAR field and convert it to VARCHAR.