You must Sign In to post a response.
  • Category: XML

    How to generate table script from XSD files in .net ?

    Are you looking for a way to generate table script from XSD files in .net ? then read this thread to know more about it

    Hi All,
    I just want to try to do this in .net code . Code will return table scripts taking input as XSD file info. This is possible by using XML spy , but whether it can be done using .net ?
    R R Mishra
  • #729500

    Check the below links

  • #729876
    You can use this code snippet for generate Table Script from XSD

    <#PrepareToRender(); #>


    foreach (DataTable Data1 in dset.Tables) {

    tableName= data1.ToString();


    CREATE TABLE <#= YourtableName #>



    PushIndent(" ");
    foreach (DataColumn dsoc in data1.Columns) {
    WriteLine( dsoc.ToString() + " " + MapToSqlType(dsoc.DataType.Name) + ",");




    DataSet dset;
    string tableName;
    void PrepareToRender()
    dset = new System.Data.DataSet();
    string MapToSqlType(string clrType)
    case "String":
    return "Varchar(50)";
    case "Int32":
    return "int";
    return clrType;


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.