SQL³£Óú¯ÊýÖ®Èý REPLICATE () £¿
°´Ö¸¶¨´ÎÊýÖØ¸´×Ö·û±í´ïʽ¡£
Óï·¨
REPLICATE ( character_expression, integer_expression)
²ÎÊý
character_expression
×Ö·ûÊý¾ÝÐ͵Ä×ÖĸÊý×Ö±í´ïʽ£¬»òÕß¿ÉÒÔÒþʽת»»Îª nvarchar »ò ntext µÄÆäËûÊý¾ÝÀàÐ͵Ä×ÖĸÊý×Ö±í´ïʽ¡£
integer_expression
¿ÉÒÔÒþʽת»»Îª int µÄ±í´ïʽ¡£Èç¹û integer_expression Ϊ¸º£¬½«·µ»Ø¿Õ×Ö·û´®¡£
·µ»ØÖµ
nvarchar »ò ntext
1 £ºSelect Replicate('abc',2) ----------------abcabc
2 £ºSelect Replicate£¨'abc',-2) ----------------null
3 £ºSelect Replicate('abc',0)--------------- ÎÞ
Ïà¹ØÎĵµ£º
1.DATEADDº¯Êý
ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ¡£
Óï·¨
DATEADD ( datepart , number, date )
²ÎÊý
datepart
ÈÕÆÚ²¿·Ö
Ëõд
Year
yy, yyyy
quarter
qq, q
Month
mm, m
dayofyear
dy, y
Day
dd, d
Week
wk, ww
Hour
hh
minute
mi, n
second
ss, s
millisecond
m ......
1.²éѯµÄÄ£ºýÆ¥Åä
¾¡Á¿±ÜÃâÔÚÒ»¸ö¸´ÔÓ²éѯÀïÃæÊ¹Óà LIKE '%parm1%'—— ºìÉ«±êʶλÖõİٷֺŻᵼÖÂÏà¹ØÁеÄË÷ÒýÎÞ·¨Ê¹Óã¬×îºÃ²»ÒªÓÃ.
½â¾ö°ì·¨:
ÆäʵֻÐèÒª¶Ô¸Ã½Å±¾ÂÔ×ö¸Ä½ø£¬²éѯËٶȱã»áÌá¸ß½ü°Ù±¶¡£¸Ä½ø·½·¨ÈçÏ£º
a¡¢ÐÞ¸Äǰ̨³ÌÐò——°Ñ²éѯÌõ¼þµÄ¹©Ó¦ÉÌÃû³ÆÒ»À¸ÓÉÔÀ´µÄÎı¾ÊäÈë¸ÄΪÏÂÀÁб ......
1¡¢¼ì²éÊÇ·ñÓзǷ¨×Ö·û
public static boolean sql_inj(String str)
{
String inj_str = "'|and|exec|insert|select|delete|update|
count|*|%|chr|mid|master|truncate|char|declare|;|or|-|+|,";
//ÕâÀïµÄ¶«Î÷»¹¿ÉÒÔ×Ô¼ºÌí¼Ó
String[] inj_stra=inj_str.split("\\|");
for ......
×î½ü£¬ÒòΪÏîÄ¿µÄÔÒò£¬ÐèÒªÉè¼ÆÒ»¸öÊý¾Ý¿â£¬¸ÃÊý¾Ý¿âµÄ¹¦ÄÜÖ÷ÒªÊÇÃèÊöÎļþϵͳµÄ½á¹¹ºÍÎļþÐÅÏ¢£¬ÔÚÍøÉÏÕÒÁ˺ܶàµÄ×ÊÁÏ£¬µ«ÊÇÐí¶àÉè¼ÆÒªÃ´Õë¶Ô²éѯÁ¿±È½Ï¶àµÄÀ´×ö£¬ÒªÃ´Õë¶ÔÐ޸ġ¢²åÈëÁ¿±È½Ï¶àµÄÀ´×ö£¬¶ø¶ÔÓÚÎļþϵͳ¶øÑÔ£¬ËüµÄ²éѯ¡¢²åÈë¡¢Ð޸ͼÊÇÏ൱Ƶ·±µÄ£¬Òò´Ë£¬Êý¾Ý¿âµÄÉè¼Æ¼«ÆäÖØÒª,ÏÖ½«×Ô¼ºµÄÒ»µãÏ뷨˵˵£¬Ï£Íû´ ......
----²é¿´ËùÓнDZ¾
Create table #y (txt text)
select name, iid = identity(int,1,1) into #x from SysObjects where xtype = 'TR'
declare @i int, @max int
declare @name varchar(40)
set @i = 1
select @max = max(iid) from #x
while @i <= @max
begin
select @name = name from #x w ......