Home php教程 php手册 SQL Server根据查询结果,生成XML文件

SQL Server根据查询结果,生成XML文件

Jun 13, 2016 am 10:06 AM
server sql xml no internal Order external document Inquire generate look program result

/*
'bcp' 不是内部或外部命令,也不是可运行的程序?
看看在C:Program FilesMicrosoft SQL Server80ToolsBinn里面有没有bcp.exe这个文件
然后看看path里面加C:Program FilesMicrosoft SQL Server80ToolsBinn这个目录没有.
右键我的电脑--属性--高级--环境变量--在系统变量中找到path--编辑
在变量值的最后加上:
C:Program FilesMicrosoft SQL Server80ToolsBINN
*/
/**********************************************************************
存储过程: P_SaveXML
功能: 生成XML文件
参数: 表名
返回: 指定目录的XML文件
调用方法: 传递中间表TB_TABLECOLUMN_T存在的表名
exec P_ZehuaSavexml 'WQ_STINFO_B,WQ_PHY_D','D:xx.xml'
最后更改日期: 2005-8-17
联系方式: zlp@zehua.com.cn
备注: 根据中间表生成符合标准格式的XML文件
www.knowsky.com
**********************************************************************/
/*
exec P_ZehuaSavexml 'WQ_STINFO_B,WQ_PHY_D','D:xx.xml'
*/
go
create proc P_ZehuaSavexml
@TableCodeS varchar(8000),
@fname varchar(1000)='c: mp.xml' --默认保存的XML文件地址
as
declare @sql nvarchar(200),@sql1 varchar(400)
declare @cnt int,@Table_Name varchar(20)
declare @i int,@TableCode varchar(20)
declare @err int,@src varchar(255),@desc varchar(255)
create table ##t(re nvarchar(4000))
insert ##t
select Re=''
union all select ''
set @i=charindex(',',@TableCodeS)
while @i>0
begin
set @TableCode=left(@TableCodeS,@i-1)
set @sql=''
set @sql=N'select @cnt=count(*),@Table_Name=max(Table_Name) from '
set @sql=@sql N'('
set @sql=@sql N'select top 100 percent * from TB_TABLECOLUMN_T where '
set @sql=@sql N'TABLE_CODE=''' @TableCode ''' and COLUMNS_ISKEY=''√'' '
set @sql=@sql N'order by COLUMNS_SORT '
set @sql=@sql N')'

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to make Google Maps the default map in iPhone How to make Google Maps the default map in iPhone Apr 17, 2024 pm 07:34 PM

How to make Google Maps the default map in iPhone

What is the difference between HQL and SQL in Hibernate framework? What is the difference between HQL and SQL in Hibernate framework? Apr 17, 2024 pm 02:57 PM

What is the difference between HQL and SQL in Hibernate framework?

What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code. What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code. Mar 21, 2024 pm 09:17 PM

What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code.

How to check your academic qualifications on Xuexin.com How to check your academic qualifications on Xuexin.com Mar 28, 2024 pm 04:31 PM

How to check your academic qualifications on Xuexin.com

Clock app missing in iPhone: How to fix it Clock app missing in iPhone: How to fix it May 03, 2024 pm 09:19 PM

Clock app missing in iPhone: How to fix it

12306 How to check historical ticket purchase records How to check historical ticket purchase records 12306 How to check historical ticket purchase records How to check historical ticket purchase records Mar 28, 2024 pm 03:11 PM

12306 How to check historical ticket purchase records How to check historical ticket purchase records

Can't allow access to camera and microphone in iPhone Can't allow access to camera and microphone in iPhone Apr 23, 2024 am 11:13 AM

Can't allow access to camera and microphone in iPhone

How to use LSOF to monitor ports in real time How to use LSOF to monitor ports in real time Mar 20, 2024 pm 02:07 PM

How to use LSOF to monitor ports in real time

See all articles