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 ......
#include "iostream.h"
#include "stdio.h"
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
int main(int argc, char* argv[])
{
::CoInitialize(NULL);
_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance("ADODB.Connection");
tr ......
ÐÂ×°»òÕßÒÔÇ°×°¹ýsql server£¬ºóÀ´É¾µô¡£ÏÖÔÚÖØ×°£¬»á³öÏÖ“ÒÔÇ°µÄij¸ö³ÌÐò°²×°ÒÑÔÚ°²×°¼ÆËã»úÉÏ´´½¨¹ÒÆðµÄÎļþ²Ù×÷£¬ÔËÐа²×°³ÌÐò֮ǰ±ØÐëÖØÐÂÆô¶¯¼ÆËã»ú”´íÎó¡£ÎÞ·¨½øÐÐÏÂÈ¥¡£
ÒÔÏÂΪ½â¾ö²½Ö裺
1£©Ìí¼Ó/ɾ³ý³ÌÐòÖг¹µ×ɾ³ýsql server¡£
2£©½«Ã»ÓÐɾ³ýµÄsql serverĿ¼Ҳɾ³ýµô¡£
3£©´ò¿ª×¢²á±í±à¼Æ÷£ ......
Sql ServerÖеÄÈÕÆÚÓëʱ¼äº¯Êý
1. µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
select getdate()
2. dateadd ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì
select dateadd(day,2,'2004-10-15') --·µ»Ø£º2004-10-17 00:00:00.000
3. datediff ·µ»Ø¿çÁ½¸öÖ ......
left join(×óÁª½Ó) ·µ»Ø°üÀ¨×ó±íÖеÄËùÓмǼºÍÓÒ±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
right join(ÓÒÁª½Ó) ·µ»Ø°üÀ¨ÓÒ±íÖеÄËùÓмǼºÍ×ó±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
inner join(µÈÖµÁ¬½Ó) Ö»·µ»ØÁ½¸ö±íÖÐÁª½á×Ö¶ÎÏàµÈµÄÐÐ
¾ÙÀýÈçÏ£º
--------------------------------------------
±íA¼Ç¼ÈçÏ£º
aID¡¡¡¡¡¡¡¡¡¡aNum
1¡¡¡¡¡¡¡¡¡¡a ......