SQL Server¸ù¾Ý²éѯ½á¹û,Éú³ÉXMLÎļþ
SQL Server¸ù¾Ý²éѯ½á¹û,Éú³ÉXMLÎļþ
À´Ô´£º²»Ïê ×÷ÕߣºØýÃû ʱ¼ä£º2009-3-6 22:15:58 ·¢²¼£ººÚ¿ÍÈí¼þÔ°
/*
'bcp' ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò£¿
¿´¿´ÔÚC:\Program Files\Microsoft SQL Server\80\Tools\BinnÀïÃæÓÐûÓÐbcp.exeÕâ¸öÎļþ
È»ºó¿´¿´pathÀïÃæ¼ÓC:\Program Files\Microsoft SQL Server\80\Tools\BinnÕâ¸öĿ¼ûÓÐ.
ÓÒ¼üÎҵĵçÄÔ--ÊôÐÔ--¸ß¼¶--»·¾³±äÁ¿--ÔÚϵͳ±äÁ¿ÖÐÕÒµ½path--±à¼
ÔÚ±äÁ¿ÖµµÄ×îºó¼ÓÉÏ:
C:\Program Files\Microsoft SQL Server\80\Tools\BINN
*/
/**********************************************************************
´æ´¢¹ý³Ì: 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.389hack.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:\tmp.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='<?xml version="1.0" encoding="gb2312"?>'
union all select '<ZehuaTableInfoXml>'
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
Ïà¹ØÎĵµ£º
XML(eXtensible Markup Language)ÊÇÍòάÍøÁªÃË(World Wide Web Consortium W3C)¶¨ÒåµÄÒ»ÖÖ¿ÉÀ©Õ¹±êÖ¾ÓïÑÔ¡£
¿ÉÀ©Õ¹ÐÔÖ¸ÔÊÐíÓû§°´ÕÕXML¹æÔò×Ô¶¨Òå±ê¼Ç(tags ±êÇ©)¡£
Ç¿ÏÇáËɱí´ï¶à²ã½á¹¹µÄÊý¾Ý£»¿ÉÀ©Õ¹¡£
Óŵ㣺ƽ̨Î޹أ¬ÓïÑÔÎ޹ء£Éè¼ÆÄ¿±êÊÇÃèÊöÊý¾Ý²¢¼¯ÖÐÓÚÊý¾ÝµÄÄÚÈÝ£¬ÓëÏÔʾ·ÖÀë¡£
ÌáÐÑ£º² ......
ÒªÏë³É¹¦·ÃÎÊ SQL Server Êý¾Ý¿âÖеÄÊý¾Ý£¬ÎÒÃÇÐèÒªÁ½¸ö·½ÃæµÄÊÚȨ£ºÒ»¡¢»ñµÃ×¼ÐíÁ¬½Ó SQL Server ·þÎñÆ÷µÄȨÀû£»¶þ¡¢»ñµÃ·ÃÎÊÌض¨Êý¾Ý¿âÖÐÊý¾ÝµÄȨÀû£¨select, update, delete, create table ...£©¡£¼ÙÉ裬ÎÒÃÇ×¼±¸½¨Á¢Ò»¸ö dba Êý¾Ý¿âÕÊ»§£¬ÓÃÀ´¹ÜÀíÊý¾Ý¿â mydb¡£
1. Ê×ÏÈÔÚ SQL Server ·þÎñÆ÷¼¶±ð£¬´´½¨µÇ½ÕÊ»§£¨creat ......
¾«ÃîSQLÓï¾äÊÕ¼¯
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿âCREATE DATABASE database-name 2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿âdrop database dbn ......