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 8321793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:08:58+00:00 2026-06-08T23:08:58+00:00

Each of our clients has a database with their own data. Each database should

  • 0

Each of our clients has a database with their own data. Each database should have exactly the same structure. How can I find columns whose datatype has been changed, where the table name and column name is the same but the datatype is not? Is there an SQL query that can do this?

  • 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-06-08T23:09:00+00:00Added an answer on June 8, 2026 at 11:09 pm

    If both databases can be restored to the same server, you can compare the two sets of system catalog views to determine the differences:

    SELECT 
        TableName = t.name,
        ColumnName = c.name,
        TypeName = ty.name,
        TableName2 = t2.name,
        ColumnName2 = c2.name,
        TypeName2 = ty2.name
    FROM DB1.sys.columns c
    INNER JOIN DB1.sys.tables t ON c.object_id = t.object_id
    INNER JOIN DB1.sys.types ty ON c.system_type_id = ty.system_type_id
    INNER JOIN DB2.sys.tables t2 ON t.name = t2.Name
    INNER JOIN DB2.sys.columns c2 ON c2.object_id = t2.object_id AND c.name = c2.name
    INNER JOIN DB2.sys.types ty2 ON c2.system_type_id = ty2.system_type_id
    WHERE
        c.system_type_id <> c2.system_type_id
    

    Of course, you can add more columns from the sys.columns catalog view, e.g. precision and scale for types like DECIMAL(18,2), or max_length for string-based types (like VARCHAR(50) etc.) – adapt this base query as needed

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

Sidebar

Related Questions

There are 3 authors in our company blog, each author has own site url
We have a SQL server that has a database for each client, and we
We have tables Site and Content in our database. Each site is operated by
Our application has a table which stores all transactions records of clients in one
After noticing that our database has become a major bottleneck on our live production
Task: For each of our clients, we need to build eight spreadsheets with a
I have a login form on our new website design, and it has a
This is our setup - our customers will have a database server with our
Our company has recently been signed up with a franchise to provide their customers
Our client's web app restarts suddenly at random intervals. For each restart, we've found

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.