convert database table into XML schema file

后端 未结 3 1082
萌比男神i
萌比男神i 2021-02-06 18:50

I am using SQL Server 2005. Is there any command or GUI tool (e.g. any menu/function from SQL Server management studio) to convert database table into XML schema file (.xsd)?

3条回答
  •  名媛妹妹
    2021-02-06 19:25

    Declare @SQL nvarchar(1000) SET @SQL= 'bcp.exe '+ '"select * from yourdbname.yourschema.yourtablename for xml path (''record''), ROOT (''tabel'')"' +' queryout '+ 'c:\yourfilename.xsd' +' -w -r -t -SyourServerName -T'

    print @SQL EXEC Master..xp_CmdShell @SQL

    Replace allvalues starts with 'your', accordingly

提交回复
热议问题