SQL XML
--Creating xml Data Type Columns
CREATE TABLE dbo.Book
(BookID int IDENTITY(1,1) PRIMARY KEY,
ISBNNBR char(10) NOT NULL,
BookNM varchar(250) NOT NULL,
AuthorID int NOT NULL,
ChapterDESC XML NULL)
DECLARE @Book XML
SET @Book =
CAST('<Book name="SQL Server 2000 Fast Answers">
<Chapters>
<Chapter id="1"> Installation, Upgrades... </Chapter>
<Chapter id="2"> Configuring SQL Server </Chapter>
<Chapter id="3"> Creating and Configuring Databases </Chapter>
<Chapter id="4"> SQL Server Agent and SQL Logs </Chapter>
</Chapters>
</Book>' as XML)
CREATE PROCEDURE dbo.usp_INS_Book
@ISBNNBR char(10),
@BookNM varchar(250),
@AuthorID int,
@ChapterDESC xml
AS
INSERT dbo.Book
(ISBNNBR, BookNM, AuthorID, ChapterDESC)
VALUES (@ISBNNBR, @BookNM, @AuthorID, @ChapterDESC)
GO
--Inserting xml Data into a Column
INSERT dbo.Book
(ISBNNBR, BookNM, AuthorID, ChapterDESC)
VALUES ('570X000000',
'SQL Server 2005 T-SQL Recipes',
55,
CAST('<Book name="SQL Server 2005 T-SQL Recipes">
<Chapters>
<Chapter id="1"> SELECT </Chapter>
<Chapter id="2"> INSERT,UPDATE,DELETE </Chapter>
<Chapter id="3"> Transactions, Locking, Blocking, and Deadlocking </Chapter>
<Chapter id="4"> Tables </Chapter>
<Chapter id="5"> Indexes </Chapter>
<Chapter id="6"> Full-text search </Chapter>
</Chapters>
</Book>' as XML))
DECLARE @Book XML
SET @Book =
CAST('<Book name="SQL Server 2000 Fast Answers">
<Chapters>
<Chapter id="1"> Installation, Upgrades... </Chapter>
<Chapter id="2"> Configuring SQL Server </Chapter>
<Chapter id="3"> Creating and Configuring Databases </Chapter>
<Chapter id="4"> SQL Server Agent and SQL Logs </Chapter>
</Chapters>
</Book>' as XML)
INSERT dbo.Book
(ISBNNBR, BookNM, AuthorID, ChapterDESC)
VALUES ('1590591615',
相关文档:
平时很少用SQL Server 2008,偶尔用一次,还真是遇到了一些问题,几经周折,从官网上才找到解决办法:
问题描述:登陆后,点击数据库,出现服务器主体 "xxxcom" 无法在当前安全上下文下访问数据库 "db_xxx_com"。
问题原因:SQL Server 2008 bug
问题解决办法(非原创,参考官网):
1、用SQL Server Management Studi ......
Global.asax文件中
在页面跳转时,防止传值的参数中SQL注入:
void Application_BeginRequest(object sender, EventArgs e)
{
ProcessRequest();
}
void ProcessRequest()
{
try
......
Oracle的sql*plus是与oracle进行交互的客户端工具。在sql*plus中,可以运行sql*plus命令与sql语句。
我们通常所说的DML、DDL、DCL语句都是sql语句,它们执行完后,都可以保存在一个被称为sql buffer的内存区域中,并且只能保存一条最近执行的sql语句,我们可以对保存在sql buffer中的sql 语句进行修改,然后再次执行。
除 ......
下列语句部分是Mssql语句,不可以在access中使用。
SQL分类:
DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE)
DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT)
DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)
首先,简要介绍基础语句:
1、说明:创建数据库
CREATE DATABASE data ......
drop table #Tmp --删除临时表#Tmp
create table #Tmp --创建临时表#Tmp
(
ID int IDENTITY (1,1) not null, --创建列ID,并且每次新增一条记录就会加1
WokNo &n ......