易截截图软件、单文件、免安装、纯绿色、仅160KB

在SQL SERVER中实现RSA加密算法(第二版)

/***************************************************  
        作者:herowang(让你望见影子的墙)
    日期:2010.1.5
          注:    转载请保留此信息
    更多内容,请访问我的博客:blog.csdn.net/herowang
****************************************************/
/*
   本次修改增加了unicode的支持,但是加密后依然显示为16进制数据,因为进行RSA加密后所得到的unicode编码是无法显示的,所以密文依然采用16进制数据显示。
    需要特别注意:如果要对中文进行加密,那么所选取的两个素数要比较大,两个素数的成绩最好要大于65536,即大于unicode的最大编码值
    另外修改了第一个版本的部分函数名称
*/
 
在SQL SERVER中实现RSA加密算法
--判断是否为素数
if object_id('f_primeNumTest') is not null
  drop function f_primeNumTest
go
create function [dbo].[f_primeNumTest]
(@p int)
returns bit
begin
  declare @flg bit,@i int
  select @flg=1, @i=2
  while @i<sqrt(@p)
  begin
     if(@p%@i=0  )
     begin
        set @flg=0
       break
     end 
     set @i=@i+1
  end
  return @flg
end
go
--判断两个数是否互素
 
if object_id('f_isNumsPrime') is not null
  drop function f_isNumsPrime
go
create function f_isNumsPrime
(@num1 int,@num2 int)
returns bit
begin
  declare @tmp int,@flg bit
  set @flg=1
  while (@num2%@num1<>0)
  begin
    select @tmp=@num1,@num1=@num2%@num1,@num2=@tmp
  end
  if @num1=1
     set @flg=0
  return @flg
end
go
--产生密钥对
if object_id('p_createKey') is not null
  drop proc p_createKey
go
create proc p_createKey
@p int,@q int
as
begin
    decla


相关文档:

sql之left join、right join、inner join的区别

left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录
right join(右联接) 返回包括右表中的所有记录和左表中联结字段相等的记录
inner join(等值连接) 只返回两个表中联结字段相等的行
举例如下:
--------------------------------------------
表A记录如下:
aID     aNum
1     a ......

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)--這里可轉換 ......

AIR执行SQL语句

 我们的SQL语句的执行都是由一个类来完成的!这个类就是SQLStatement,这个类就是我们用来执行SQL语句的类,该类的使用也是非常简单的,我们只需要记住两个属性两个方法。我们来看一下!
text属性:所要执行的SQL语句,该属性是一个字符串格式,所以我们的SQL语句都是字符串!
sqlConnection属性:该属性是设置SQLSt ......

sql中的分段列表

表:用户号码,登录时间
显示 :每日登录各时间段的登录人数,和每天登录人数
if isnull(object_id('#tb'),'')=''
drop table #tb
CREATE TABLE #tb(列名1 varchar(12),时间 datetime)
INSERT INTO #tb
SELECT '03174190188','2009-11-01 07:17:39.217' UNION ALL
SELECT '015224486575','2009-11-01 08:01:17.153' ......

SQL 每个分类各取2条数据

create table tb (ptoid int,proclassid int,proname varchar(10))
insert tb
select 1,1,'衣服1'
union all
select 2,2,'衣服2'
union all
select 3,3,'衣服3'
union all
select 4,3,'衣服4'
union all
select 5,2,'衣服5'
union all
select 6,2,'衣服6'
union all
select 7,2,'衣服7'
union all
select 8 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号