Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Here is the case: There are lot of columns in my databases inside one sqlserver that contains the same data but there is a big inconsistency in datatypes lenght for them. For example I have column called "name" in schemas stage and dbo in DB1 and the same column in DB2. In all those places this column has different lenght of data type:

  • stage.name is defined as varchar(10),
  • dbo.name is defined as varchar(20),
  • column "name" in DB2 is defined as varchar(max)

Is there any tool that can help me to fix that? I mean different that writing SQL queries agains Information_schema.columns and then genereting manually alter scripts to implement changes.

question from:https://stackoverflow.com/questions/65682261/columns-datatypes-inconsistency

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
121 views
Welcome To Ask or Share your Answers For Others

1 Answer

As they are in different schemas and even in a different database, do you know for sure that they actually represent the same piece of information? A generic term like name could mean many things in different contexts - e.g. Australian State Names have a very specific max size that I can define, but a City Name could vary hugely. Don't change anything without understanding the actual domain of the data and then ensure the size is appropriate.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...