3>
4>
5> CREATE TABLE dbo.Book(
6> BookID int IDENTITY(1,1) PRIMARY KEY,
7> ISBN char(10) NOT NULL,
8> BookName varchar(250) NOT NULL,
9> AuthorID int NOT NULL,
10> ChapterDESC XML NULL)
11> GO
1> CREATE PROCEDURE dbo.usp_INS_Book
2> @ISBN char(10),
3> @BookName varchar(250),
4> @AuthorID int,
5> @ChapterDESC xml
6> AS
7> INSERT dbo.Book
8> (ISBN, BookName, AuthorID, ChapterDESC)
9> VALUES (@ISBN, @BookName, @AuthorID, @ChapterDESC)
10> GO
1> DECLARE @Book XML
2> SET @Book =
3> CAST('
4~
5~ chapter 1
6~ chapter 2
7~ chapter 3
8~ chapter 4
9~
10~ ' as XML)
11>
12> INSERT dbo.Book
13> (ISBN, BookName, AuthorID, ChapterDESC)
14> VALUES ('1111111','SQL Server',55,@Book)
15> GO
(1 rows affected)
1> select * from dbo.book
2> GO
BookID ISBN BookName
AuthorID ChapterDESC
----------- ---------- -------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
--------------------------------- ----------- --------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------
1 1111111 SQL Server
55 chapter 1 apter id="2"> chapter 2 chapter 3 chapter 4 <
/Book>
(1 rows affected)
1>
2> drop table dbo.book
3> GO