SQL IP to BigInt
ǰһƪ²©¿Í IP to Integer ÌṩµÄ SQL º¯ÊýÊÇ IP ת»»³É Integer µÄ·½·¨¡£ Integer µÄ×î´óֵΪ£º 2147483647£¨2^31 - 1£©¡£°´ÕÕ IP ת»»³ÉÕûÊýµÄËã·¨£¬»áËã³öÀ´´óÓÚÕâ¸öÖµµÄ£¬ËùÒÔ֮ǰÌṩµÄ IP ת»»³É Integer µÄ·½·¨»áËã³ö¸ºÖµ¡£ ÏÂÃæÊÇ IP to BigInt µÄת»»Ëã·¨£¬ ÕâʱºòÔËËã¾Í²»»áСÓÚÁã¡£
CREATE FUNCTION dbo.ipStringToBigInt
(
@ip CHAR(15)
)
RETURNS bigint
AS
BEGIN
DECLARE @rv bigint,
@o1 bigint,
@o2 INT,
@o3 INT,
@o4 INT
SELECT
@o1 = CONVERT(INT, PARSENAME(@ip, 4)),
@o2 = CONVERT(INT, PARSENAME(@ip, 3)),
@o3 = CONVERT(INT, PARSENAME(@ip, 2)),
@o4 = CONVERT(INT, PARSENAME(@ip, 1))
IF (@o1 BETWEEN 0 AND 255)
AND (@o2 BETWEEN 0 AND 255)
AND (@o3 BETWEEN 0 AND 255)
AND (@o4 BETWEEN 0 AND 255)
BEGIN
SET @rv = (@o1 * 16777216) +
(@o2 * 65536) +
(@o3 * 256) +
(@o4)
END
ELSE
SET @rv = -1
RETURN @rv
END
go
CREATE FUNCTION dbo.ipBigIntToString
(
@ip bigint
)
RETURNS CHAR(15)
AS
BEGIN
DECLARE @o1 INT,
@o2 INT,
@o3 INT,
@o4 INT
IF @ip > 4294967295 RETURN '255.255.255.255'
IF @ip
Ïà¹ØÎĵµ£º
DDL£ºÊý¾Ý¿â¶¨ÒåÓïÑÔ£¨create ,alter,modify£©¿É×Ô¶¯Ìá½»¡£
DML£ºÊý¾Ý¿â²Ù×÷ÓïÑÔ£¨insert, update,alter£©Ó¦ÉèSET AUTOCOMMIT ON
DCL£ºÊý¾Ý¿â¿ØÖÆÓïÑÔ£¨grant,deny,revoke£©
create table table_name (column_name type [not null] [constraint constraint_definition default XXXXXX] )
[primary key (column_name,col ......
Ò»¡¢Ê¹ÓÃÖ¤ÊéʵÏÖÖ÷±¸SQL ServerʵÀýµÄ»¥Í¨
1.ÔÚÖ÷»úºÍ±¸»úÉϷֱ𴴽¨Ö¤Êé
ÔÚÖ÷»úÉÏÖ´ÐÐÈçÏÂÓï¾ä:
USE master;
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'abcdefg';
CREATE CERTIFICATE CERT_HOST_A WITH SUBJECT = 'HOST_A certificate' ,
START_DATE = '01/01/2010';
GO
ÔÚ±¸»úÉÏÖ´ÐÐÈçÏÂÓï¾ä:
USE master; ......
¡ö ¿ª·¢Ç°ÒªÇóÅäÖÃ
¡ö Select XML¸ñʽÊý¾Ý
¡ö Insert XML¸ñʽÊý¾Ý
¡ö Updata XML¸ñʽÊý¾Ý
¡ö Delete XML¸ñʽÊý¾Ý
¿ª·¢Ç°ÒªÇóÅäÖÃ
±ØÐë°²×°Oracle¿Í»§¶Ë
°ÑClasspathÖ¸Ïò
classes111.zip ......
×Ö·û´®º¯Êý¶Ô¶þ½øÖÆÊý¾Ý¡¢×Ö·û´®ºÍ±í´ïʽִÐв»Í¬µÄÔËËã¡£´ËÀຯÊý×÷ÓÃÓÚCHAR¡¢
VARCHAR¡¢ BINARY¡¢ ºÍVARBINARY Êý¾ÝÀàÐÍÒÔ¼°¿ÉÒÔÒþʽת»»ÎªCHAR »òVARCHARµÄ
Êý¾ÝÀàÐÍ¡£¿ÉÒÔÔÚSELECT Óï¾äµÄSELECT ºÍWHERE ×Ó¾äÒÔ¼°±í´ïʽÖÐʹÓÃ×Ö·û´®º¯Êý¡£³£ÓõÄ
×Ö·û´®º¯ÊýÓУº
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶ ......