5>
6> CREATE TABLE dbo.Book(
7> BookID int IDENTITY(1,1) PRIMARY KEY,
8> ISBN char(10) NOT NULL,
9> BookName varchar(250) NOT NULL,
10> AuthorID int NOT NULL,
11> ChapterDESC XML NULL)
12> GO
1>
2> CREATE PROCEDURE dbo.usp_INS_Book
3> @ISBN char(10),
4> @BookName varchar(250),
5> @AuthorID int,
6> @ChapterDESC xml
7> AS
8> INSERT dbo.Book
9> (ISBN, BookName, AuthorID, ChapterDESC)
10> VALUES (@ISBN, @BookName, @AuthorID, @ChapterDESC)
11> GO
1>
2> --Inserting xml Data into a Column
3>
4> INSERT dbo.Book
5> (ISBN, BookName, AuthorID, ChapterDESC)
6> VALUES ('1111','SQL Server',55,
7> CAST('
8~
9~ a
10~ b
11~ c
12~ d
13~ e
14~ f
15~
16~ ' as XML))
17> GO
(1 rows affected)
1>
2>
3> select * from dbo.book
4> GO
BookID ISBN BookName
AuthorID ChapterDESC
----------- ---------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------- ----------- ------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------
1 1111 SQL Server
55 a b c hapter> d e f
(1 rows affected)
1> drop table dbo.book
2> GO
1>