---------下面是生成XML1主表查询定义
SELECT T.c.query(‘MID‘).value(‘.[1]‘, ‘int‘) AS MID ,
T.c.query(‘EventName‘).value(‘.[1]‘, ‘varchar(100)‘) AS EventName ,
@NowDate AS CreateDate ,
T.c.query(‘BeginDate‘).value(‘.[1]‘, ‘datetime‘) AS BeginDate ,
T.c.query(‘EndDate‘).value(‘.[1]‘, ‘datetime‘) AS EndDate ,
T.c.query(‘OpenEventDate‘).value(‘.[1]‘, ‘datetime‘) AS OpenEventDate ,
T.c.query(‘LotteryLen‘).value(‘.[1]‘, ‘int‘) AS LotteryLen ,
T.c.query(‘EventPrice‘).value(‘.[1]‘, ‘decimal(18,2)‘) AS EventPrice ,
T.c.query(‘StockQty‘).value(‘.[1]‘, ‘decimal(18,2)‘) AS StockQty
INTO #tbEventList
FROM @XML1.nodes(‘/row‘) AS T ( c )