Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6603053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:57:20+00:00 2026-05-25T18:57:20+00:00

Is it possible to create a foreign key where type of the first column

  • 0

Is it possible to create a foreign key where type of the first column is bit but type of the referenced column is int?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:57:21+00:00Added an answer on May 25, 2026 at 6:57 pm

    No.

    create table X
    (
      c int primary key
    )
    
    create table Y
    (
      c bit references X
    )
    

    Returns:

    Msg 1778, Level 16, State 0, Line 1
    Column 'X.c' is not the same data type as referencing column 'Y.c' in foreign key 'FK__Y__c__34C8D9D1'.
    Msg 1750, Level 16, State 0, Line 1
    Could not create constraint. See previous errors.

    Also see the relevant section in BOL:

    • The REFERENCES clause of a column-level FOREIGN KEY constraint can
      list only one reference column. This column must have the same data
      type as the column on which the constraint is defined.

    • The REFERENCES clause of a table-level FOREIGN KEY constraint must
      have the same number of reference columns as the number of columns in
      the constraint column list. The data type of each reference column
      must also be the same as the corresponding column in the column list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question is two fold, firstly, is it possible to create a foreign key,in
In Sybase, is it possible to create a a foreign key from a table
I have two databases, is it possible to create a foreign key between two
Is it possible to return querysets that return only one object per foreign key?
Is it possible to create a One-to-Many relationship with Code First that uses a
Hi it'd like to know if it's at all possible create a parametric equalizer
Possible Duplicate: Create a temporary directory in Java Duplicate: stackoverflow.com/questions/375910 Is there a way
Possible Duplicate: Create Excel file in Java How to save output in excel format
Is it possible to create federated Subversion servers? As in one server at location
Is it possible to create a trigger that will not be in a transaction?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.