sql ½âÎöxml ÎÊÌâÇó½Ì
SQL code:
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<status>0</status>
<desc>success</desc>
<content>
<field name="²âÊÔÃû" type="string">²âÊÔÄÚÈÝÖµ</field>
</content>
</response>
Çë´ïÈËʹÓô¢´æ¹ý³Ì ½âÎö³öÈçÉÏxmlÖÐfield ×ֶεÄ"²âÊÔÄÚ´ÓÖµ"
ÔÚÍøÉÏÕÒÁËÒ»¶Î´úÂë,²»Ö§³ÖxmlÖаüº¬ÈκÎÖÐÎÄ×Ö·û.
¸½ÔÚÍøÉÏÕҵĴúÂë
SQL code:
DECLARE @HDOC INT --Îĵµ¾ä±ú
DECLARE @XMLSTRING VARCHAR(200) --XML×Ö·û´®
SET @xmlString ='<?xml version="1.0"?>
<ROOT>
<USER ID="1" Name="SBQCEL"/>
<USER ID="2" Name="PEACELI"/>
<USER ID="3" Name="SHEEPCHANG"/>
</ROOT>'
--ʹÓÃϵͳ´æ´¢¹ý³ÌSP_XML_PREPAREDOCUMENT·ÖÎöXML×Ö·û´®
EXEC SP_XML_PREPAREDOCUMENT @HDOC OUTPUT, @xmlString
--ʹÓÃOPENXML´ÓSQL Server µÄÄÚ²¿»º´æ²éѯÊý¾Ý
SELECT * from OPENXML(@HDOC,N'/ROOT/USER')
WITH
(
ID INT,
Name VARCHAR(10)
)
--ʹÓÃϵͳ´æ´¢¹ý³ÌSP_XML_REMOVEDOCUMENTÊÍ·ÅÄÚ´æ
EXEC SP_XML_REMOVEDOCUMENT @HDOC
Õâ¸ö²»¶® °ï¶¥
SQLServer2005
Ïà¹ØÎÊ´ð£º
´ó¼Ò°ïæ¿´¿´Õâ2¸ösqlÓï¾äÄĸö²éѯµÄËٶȸü¿ìµã¡£Ð»Ð»°ïæ¡£±È½Ï׿±¡£ÔÚ×öÐÔÄܲâÊÔ¡£
select * from
±íA LEFT OUTER JOIN ±íB ON (±íA.id || ' ' =±íB.id) ,±íC , ±íD, ±íE
WhereÆäËûÌõ¼þ
select * ......
sqlÎÒÏëµÃµ½Ò»×Ö·û´®Îª:
sldkf|||sdeww
erkv|||rltdk
jemcl|||ligf
¾ÍÊÇ|||ºóÃæµÄ×Ö·ûÓÐʲôº¯ÊýÄܵõ½Âð£¿ÊÇÔÚsqlÓï¾äдµÄ£¬²»ÊÇÔÚÒ³ÃæÐ´µÄ£¬ÄÇλ¸ßÊÖÀ´Ö¸½ÌÏ£¬ÐÂÊÖ£¬Ð»Ð»
ÔνñÌì²»ÊÇдÁËô
select parsen ......
ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......
CREATE PROCEDURE [selectvipcompany]
@username varchar(50),
@companyname varchar(50),
@endtime varchar(1)
AS
declare @sql varchar(1000)
set @sql=''
if (@username<>null and @username ......