Yes, we can use the [INFORMATION_SCHEMA].[COLUMNS] system views to verify and compare the information. We are going to create a new table named dbo.article2 with a column with different data type than the dbo.article table. The query compares the data types from these two tables. All the information of the columns can be obtained from the [INFORMATION_SCHEMA].[COLUMNS] system view. We are comparing the table 'article' with the table 'article2' and showing if any of the datatypes are different.
Compare if there are Extra Columns Between Tables Sometimes we need to make sure that two tables contain the same number of columns. To illustrate this we are going to create a table named 'article3' with 2 extra columns named extra1 and extra2. Post a comment or let the author know this tip helped. All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).
*Name *Email Email me updates *** NOTE *** - If you want to include code from SQL Server Management Studio (SSMS) in your post, please copy the code from SSMS and paste the code into a text editor like NotePad before copying the code below to remove the SSMS formatting. Signup for our newsletter I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the and understand I may unsubscribe at any time.