Solved

Create a table with XML column

Posted on 2013-01-29
3
235 Views
Last Modified: 2013-04-11
Hi Experts,
I am trying to create a simple table with 2 columns as below.  Is there a simple way to create the table and insert data to it?  Specially to Resume column being XML data type, I had hard time understanding it?  Thank you in advance.

Column   Data Type
-----------   --------------
Id             Integer
Resume   XML
0
Comment
Question by:RadhaKrishnaKiJaya
3 Comments
 
LVL 10

Accepted Solution

by:
deviprasadg earned 500 total points
ID: 38833993
CREATE TABLE RESUMES(
ID INT,
Resume   XML)

GO

INSERT INTO RESUMES
SELECT 1,'<RESUME><NAME>NAME</NAME><ADDRESS>ADDRESS DETAILS</ADDRESS></RESUME>'

--OR

INSERT INTO RESUMES
SELECT 2,CAST('<RESUME><NAME>NAME2</NAME><ADDRESS>ADDRESS2 DETAILS</ADDRESS></RESUME>' AS XML)

GO

SELECT * fROM RESUMES

GO

Open in new window

0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 38834094
Can you Please clarify what issue you run into?
The xml data type is nothing else than VARCHAR + some integrity checks + some xml functions you can apply on the columns...
0
 

Author Closing Comment

by:RadhaKrishnaKiJaya
ID: 39070719
Thank you.
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question