SQL文加密
use Tempdb
go
if object_ID('fn_ACITEncryption') is not null
drop function fn_ACITEncryption
go
create function fn_ACITEncryption
(
@Str nvarchar(4000),--加密的字符串
@Flag bit=1,--1、加密 0、解密
@Key nvarchar(50)--密文
)
returns nvarchar(4000)--這里可轉換成二進制
with Encryption
as
begin
Declare @LenStr int,@i int,@Str2 nvarchar(4000),@Split nvarchar(2),@LenKey int
select @Str=@Str+'A',@LenStr=len(@Str),@i=1,@Str2='',@LenKey=Len(@Key+'A')-1
while @i<@LenStr
select @Split=substring(@Str,@i,1),
@Split=nchar((unicode(@Split)+case @Flag when 1 then unicode(substring(@Key+'A',@i%@LenKey+1,1))-1
when 0 then 65535-unicode(substring(@Key+'A',@i%@LenKey+1,1))
else 0 end)%65535+cast(@Flag as int)),
@Str2=@Str2+@Split,@i=@i+1
return @Str2
end
go
select dbo.fn_ACITEncryption(N'Roy',1,'123') as 加密后字符串
/*
加密后字符串
------------------------------
¢ª
(1 個資料列受到影響)
*/
select dbo.fn_ACITEncryption(N'¢ª',0,'123') as 解密后字符串
/*
解密后字符串
--------------------------
Roy
(1 個資料列受到影響)
*/
相关文档:
http://blog.csdn.net/java2000_net/archive/2008/04/05/2252640.aspx
http://sqlserver.chinahtml.com/2006/SQL-mssql11432786154012.shtml
http://www.cnblogs.com/garnai/archive/2007/09/19/898221.html
http://tech.ccidnet.com/art/1099/20050223/214511_1.html
http://www.wangchao.net.cn/bbsdetail_43009.html ......
下面是指导文档。请跟着一步步的做。就能成功连接上sql server 2008
java中连接sql server 2008的注意事项:
2000,2005的数据库驱动类的写法是:
com.microsoft.jdbc.sqlserver.SQLServerDriver
URL的写法是:假设数据库是news
jdbc:microsoft:sqlserver://localhost:1433;databaseName=news
但是20 ......
常用SQL查询:
1、查看表空间的名称及大小
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
2、查看表空间物理文件的名称及大小
select tablespace_name, file_id, ......
Case具有两种格式。简单Case函数和Case搜索函数。
--简单Case函数
CASE sex
WHEN '1' THEN '男'
WHEN '2' THEN '女'
ELSE '其他' END
--Case搜索函数
CASE WHEN sex = '1' THEN '男'
&nbs ......