0

I don't see the syntax issue below. I'm using a subquery, because I'm building it up to do a cross-apply once I get that figured out.

 SELECT 
   BulkColumn
   FROM
     (
      SELECT CAST(BulkColumn AS xml) as BulkColumn 
            FROM OPENROWSET(BULK'c:\Flight03.xml',SINGLE_CLOB) as T
      )

Error: Incorrect syntax near ')'.
       Line # refers to the closing parenthesis at the bottom

The subquery, when run by itself works fine:

      Select CAST(BulkColumn AS xml) as BulkColumn 
            FROM OPENROWSET(BULK'c:\Flight03.xml',SINGLE_CLOB) as T

So shouldn't I just be able to wrap it with parentheses and use it in another query?

Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) Sep 24 2019 13:48:23 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: )

2 Answers 2

2

You need a name for your subquery. Try this:

SELECT 
   BulkColumn
   FROM
     (
      SELECT CAST(BulkColumn AS xml) as BulkColumn 
            FROM OPENROWSET(BULK'c:\Flight03.xml',SINGLE_CLOB) as T
      ) Sub
Sign up to request clarification or add additional context in comments.

Comments

1

after subquery in from u must set name for it

select ... From (...) *name*

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.