mercredi 25 mai 2016

Cannot Find either column or aggregate, or name is ambiguous

I'm trying to import a XML table to a SQL table. I created a basic table in the SQL Server database but I'm getting an error:

Cannot find either column "var1" or the user-defined function or aggregate "var1.value", or the name is ambiguous.

Code:

declare @xmldata as xml

set @xmldata = (SELECT CONVERT(XML, BulkColumn)AS Bulkcolumn
                FROM OPENROWSET (BULK '<filename>.xml', SINGLE_BLOB) as X)

INSERT INTO table1(var1, var2, var3)
    SELECT
        var1 = var1.value('var1', 'int'),
        var2 = var2.value('var2', 'int'),
        var3 = var3.value('var3', 'int')

I must've gone wrong somewhere, specifically when I attempt to import it into the SQL Server table.

Aucun commentaire:

Enregistrer un commentaire