ÔÚSQL SERVERÖÐʵÏÖRSA¼ÓÃÜËã·¨(µÚ¶þ°æ)
/***************************************************
×÷Õߣºherowang(ÈÃÄãÍû¼ûÓ°×ÓµÄǽ£©
ÈÕÆÚ£º2010.1.5
×¢£º ×ªÔØÇë±£Áô´ËÐÅÏ¢
¸ü¶àÄÚÈÝ£¬Çë·ÃÎÊÎҵIJ©¿Í£º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
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
ÎÒʹÓÃdelphiÒ²²»ÊǺܳ¤Ê±¼ä£¬ÓÉÓÚ¾³£ÒªÓõ½SQLÓï¾ä£¬×ܽáÁËһЩDelphiÖÐʹÓÃSQLÓï¾äҪעÒâµÄÊÂÏ¹éÄÉÆðÀ´Ö÷ÒªÓÐһϼ¸Ìõ£º
Ò»¡¢¿Õ¸ñ²»ÒªÂ©£º
ÎÒÃǾ³£ÒªÆ´×°SQLÓï¾ä£¬ÌرðÊÇwhereÌõ¼þ¾ä£¬ÔÚ¸÷¸öÓï¾äÖбðÍüÁËͷβ¼ÓÉϿոñ¡£ÒòΪÔÚÒ»¸öÓï¾äÖÐÎÒÃÇ»á×¢ÒâÓÿոñ·Ö¿ª¹Ø¼ü×Öµ«ÊÇÍùÍùÍüÁËͷβµÄ¿Õ¸ñ¡£ÀýÈ磺
sSQL=' select ......
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)--這Àï¿É轉換 ......
SQL°´ÕÕÈÕ¡¢ÖÜ¡¢Ô¡¢Äêͳ¼ÆÊý¾Ý ÊÕ²Ø
ÎÄÕ²ο¼£ºhttp://www.cnblogs.com/wenbhappy/archive/2008/07/02/1233660.html
Èç:
±í:consume_record
×Ö¶Î:consume (moneyÀàÐÍ)
date (datetimeÀàÐÍ)
ÇëÎÊÔõôдËÄÌõsqlÓï¾ä·Ö±ð°´ÈÕ,°´ÖÜ,°´ÔÂ,°´¼¾Í³¼ÆÏû·Ñ×ÜÁ¿.
Èç:1ÔÂ 1200Ô ......
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 ......