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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:37:06+00:00 2026-05-27T15:37:06+00:00

Is there a script I can use to find all columns in all tables

  • 0

Is there a script I can use to find all columns in all tables in a SQL catalog that does not have the collation <database default> ?

I have taken over a legacy system and have different collations in the some tables and I would like to find all instances in one hit rather than going through manually.

However I don’t want to change the collation programmatically as I would like to review each table one by one.

enter image description here

  • 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-27T15:37:07+00:00Added an answer on May 27, 2026 at 3:37 pm

    Try this script here:

    DECLARE @DatabaseCollation VARCHAR(100)
    
    SELECT 
        @DatabaseCollation = collation_name 
    FROM 
        sys.databases
    WHERE 
        database_id = DB_ID()
    
    SELECT 
        @DatabaseCollation 'Default database collation'
    
    SELECT 
        t.Name 'Table Name',
        c.name 'Col Name',
        ty.name 'Type Name',
        c.max_length,
        c.collation_name,
        c.is_nullable
    FROM 
        sys.columns c 
    INNER JOIN 
        sys.tables t ON c.object_id = t.object_id
    INNER JOIN 
        sys.types ty ON c.system_type_id = ty.system_type_id    
    WHERE 
        t.is_ms_shipped = 0
        AND 
        c.collation_name <> @DatabaseCollation
    

    It checks for the database default collation and then finds any columns that don’t comply with that.

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

Sidebar

Related Questions

Is there a SQL or PHP script that I can run that will change
Is there a command I can run inside my SQL script so that it
Is there a script i can use to copy some particular sectors of my
Is there an IDE/Tool/script/something that can show call hierarchy and/or data flow in Scala+Java
In SQL Server 2005, is there a way I can create a INSERT script
I have a bunch of <5 matlab scripts. Is there a tool that can
Using SQL Server and T-SQL, how can I update ALL tables tables with a
Is there a JSP script I can run to point to a JPEG file
An ActiveX Script in a DTS package can return DTSTaskExecResult_Success or DTSTaskExecResult_Failure. Is there
There is some problem, i can't understand anyway. look at this code please <script

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.