SQL加密数据
王燕杰
在网络上发送数据都会发生一些严重的安全问题,网络最大的担忧在于有人可以捕获数据,sqlserver支持采用证书来加密
1.创建证书
create master key encryption by
password = 'administrator123'
--用密码admini--
create certificate c1
encryption by password = 'administrator123'
with subject = 'c1 certificate',
start_date='03/08/2009',
expiry_date = '02/08/2020';
go
2.创建测试表,name字段为要加密的列,数据类型为varbinary
注意:加密的类型必须是varbinary,因为加密的数据是类型varbinary
create table testB(id int identity(1,1),name varbinary(5000))
3.使用加密函数向测试表中写入一条测试数据
insert into testB(name)
select encryptbycert(cert_id('c1'),'test')
4.利用下面的语句来提取加密数据
select * from testB
5.利用以下语句来解密数据
select id ,cast(decryptbycert(cert_id('c1'),name ,
N'administrator123')as varchar(20)) from testB
完成了
相关文档:
问题: 一台服务器上运行了SQL Server,SQL Server Agent,Distributed Transaction,Coordinator这三个服务,请问这台服务器是一台什么样的服务器?这三个服务具体有什么作用?
这是一台数据库服务器.
SQL Server 这是主数据库服务,而且形成了SQL Server的支柱。它用于存储和提取数据。
SQL Server Agent 也叫SQL Server代 ......
数据类型:
一、 整数数据类型
INT(INTEGER) 4
SMALLINT 2
TINYINT 1
BIGINT & ......
操作数据库结构的常用Sql
下面是Sql Server 和 Access 操作数据库结构的常用Sql,内容由海娃整理,不正确与不完整之处还请提出,谢谢。
新建表:
create table [表名]
(
[自动编号字段] int IDENTITY (1,1) PRIMARY KEY ,
[字段1] nVarChar(50) default '默认值' null ,
[字段2] ntext null ,
[字段3] dateti ......
这个逻辑关系乍看起来比较复杂,弄清楚了就好!
有两个表,
student(
id,
name,
primary key (id)
);
studentInfo(
id,
age,
address,
foreign key(id) references outTable(id) on delete cascade on update cascade
);
当我们删除student表的时候自然希望studentInfo里的相关信息也被删除,这就是外键起作用 ......
本译文采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议发布,转载请保留此信息
译者:马齿苋 | 链接:http://www.dbabeta.com/2010/oracle-sql-server-comparison-i.html
作者:Sadequl Hussain | 原文:http://www.sql-server-performance.com/articles/dba/oracle_sql_server_comparison_p1.aspx
一 ......