Home > Backend Development > PHP Tutorial > SQL Server generates XML files based on query results_PHP tutorial

SQL Server generates XML files based on query results_PHP tutorial

WBOY
Release: 2016-07-13 17:02:36
Original
977 people have browsed it

/*
'bcp' is not recognized as an internal or external command or operable program?
Check if there is a bcp.exe file in C:Program FilesMicrosoft SQL Server80ToolsBinn
Then add C:Program FilesMicrosoft SQL Server80ToolsBinn to the path and see if there is no such directory.
Right-click My Computer--Properties- -Advanced--Environment variables--Find path in system variables--Edit
Add at the end of the variable value:
C:Program FilesMicrosoft SQL Server80ToolsBINN
*/
/***************************************************** ******************
Stored procedure: P_SaveXML
Function: Generate XML file
Parameters: Table name
Return: XML file in the specified directory
Calling method: Pass the table name that exists in the intermediate table TB_TABLECOLUMN_T
exec P_ZehuaSavexml 'WQ_STINFO_B,WQ_PHY_D','D:xx.xml'
Last change date: 2005-8-17
Contact information: zlp@zehua.com.cn
Remarks: Generate XML files in standard format based on the intermediate table
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' --Default saved XML file address
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')'

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631022.htmlTechArticle/* 'bcp' is not recognized as an internal or external command or operable program? Check if there is bcp.exe file in C:Program FilesMicrosoft SQL Server80ToolsBinn. Then check the path and add...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template