开发者

Generate Sql DB Script in C#

I have a sql table that contains Table Columns Properties like TableName, ColumnName, Datatype, IsPrimary, IsNullable, DefaultValu开发者_如何学Ce, Length etc and also a versionId. So my requirement is comparing two versionIds and then generating scripts in C# like alter table.

Please tell me how to do this programatically.

Thanks in Advance


it is not a simple task by any stretch, the simplest way is to generate scripts for both versions and then do a diff like check - but there is SO much in SQL that can occur that it will require a lot of custom logic to be built.

Visual Studio does include Schema Compare which is what you want to build, maybe you can integrate that into your stuff.


If SQL Server, you could shell out using Process.Start() and run the tablediff Utility

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜