存储过程无法识别Colx.Query

时间:2011-02-17 03:17:02

标签: sql xml stored-procedures

我正在尝试将datatable传递给存储过程并创建临时表以将datatable中的行插入临时表。我没有完成它,但遇到了Colx.Query无法识别的问题。

ALTER PROCEDURE [dbo].[ImportServiceTypeRates]
@servTypeTbl xml
AS
BEGIN
SET NOCOUNT ON;

IF (NOT EXISTS (SELECT name
            FROM sysobjects
            WHERE (name = N'#TEMP_SERVICETYPE_IMPORT')
              AND (type = 'U')))
BEGIN
    PRINT 'Creating the import table...';
    CREATE TABLE [dbo].[#TEMP_PART_IMPORT] (
        FROM_ZONE           varchar(30)     NOT NULL,
        TO_ZONE             varchar(30)     NOT NULL,
        RATE                decimal(14,2)   NOT NULL,
        SERVICE_TYPE        varchar(255)    NOT NULL);
END

PRINT 'Truncating the import table...';
TRUNCATE TABLE [dbo].[#TEMP_SERVICETYPE_IMPORT];

PRINT 'Importing...'

Select
    cast(Colx.Query('data(FROM_ZONE) ') as varchar)     as FROM_ZONE,
    cast(colx.query('data(TO_ZONE) ') as varchar)     as TO_ZONE,
    cast(colx.query('data(RATE) ') as varchar)     as RATE,
    cast(colx.query('data(SERVICE_TYPE) ') as varchar)     as SERVICE_TYPE
into #TMP from @servTypeTbl.nodes('DocumentElement/servTypeTbl') as Tabx(Colx)
    ....
    ....

Colx未被识别我有什么不对?

0 个答案:

没有答案