sql - Why do I see a incorrect syntax error -
I have the following SQL query that takes several XML nodes and displays in a table:
< Pre = select doctor name = XC.value ('(name) [1]', 'varchar (50)', gender = XC.value ('(gender) [1]', 'varchar (50)' ), LangSpain = XLang.value ('.', 'Varchar (20)'), InsAccepted = XIns.value [mydb] ('.', 'Varchar (50)'). [Dbo]. [Content] Cross Implemented Cast (XML as [CONTENT_HTML]). Xodes ('/ root /' physicians) as XT CROSS XC.nodes apply ('langAccept') as XT2 (XLANG) CROSS XC.nodes applied ('InsAccept') XT3 (XIns)
I want to CAST content_html
as XML because it is the ntext
format. I get the following error Getting:
Message 156, Level 15, State 1, Line 9
Wrong Syntax with Keyword 'AS'
How do I < /p>
1) On the short term, you
p>
(Cast selection Make (CONTENT_HTML as XML) as content_xml from [mydb] [Dbo]. [Content] c) X cross x.content_xml.nodes as applicable ('/ root / physician') as EXT (xc)
2) or you type data type Can content_html
change?
CREATE TABLE dbo.MyTable (CONTENT_HTML ntext) Insert dbo.MyTable values (n '& lt; a & gt; text & lt; / a & gt;') GO ALTER table dbo .MyTable Add content_xml Update from XML dbo .MyTable SET content_xml = CONVERT (XML, content_html) - Add optional table dbo.MyTable content_ XML XML NULL - Is the mandatory column? GO ALTER TABLE dbo.MyTable drop COLUMN content_html; EXEC sp_rename 'dbo.MyTable.content_xml', 'CONTENT_HTML', 'Column' Select Go * dbo.MyTable by
otherwise
3) If you can add one This column is permanently added to
change table as dbo.content (cast (as CONTENT_HTML XML)) add content_xml
this past In the case, the opposition is
4) WARNING: If the same doctor has two or more langsans and two or more are accepted, then a cross join in price for each person Of issues.
Comments
Post a Comment