Comparing Database Schema in SQL Server and Sybase

A common development problem is to keep the schema of two databases in step.

This lists the tables:

    select tableName=name from sysobjects where type = ‘U’ order by name

This lists the fields per table:

    select tableName = so.name,
       colName = sc.name,
       colLength = sc.length,
       colOrder = sc.colid,
       dataType = st.name 
  from sysobjects so
 inner join syscolumns sc on sc.id = so.id
 inner join systypes st on st.usertype = sc.usertype
 where so.type = ‘U’
 order by so.name, sc.colid
   
Between the two you have the tools needed to compare two database schemas.
The only restriction is the database access.

This does not compare contents – that is a different problem.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s