sql replace Ìæ»»×Ö¶ÎÖв¿·ÝÖ¸¶¨ÄÚÈÝ
sql replace Ìæ»»×Ö¶ÎÖв¿·ÝÖ¸¶¨ÄÚÈÝ
´´½¨Êý¾Ý¿â½Ì³Ì
create database cnnet;
´´½¨Êý¾Ý±í
CREATE TABLE `cnnet`.`test` (
`id` INT( 4 ) NOT NULL AUTO_INCREMENT ,
`url` VARCHAR( 50 ) NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM
²å¼¸ÌõÊý¾Ý:
INSERT INTO `test` (`id`, `url`) VALUES
(1, 'www.1aa.cm'),
(2, 'www.1aa.cm'),
(3, 'www.1aa.cm'),
(4, 'www.1aa.cm'),
(5, 'www.111cn.net'),
(6, 'www.111cn.net');
ÏÂÃæÎÒÃÇÀ´¿´¿´sql replace Ìæ»»×Ö¶ÎÖв¿·ÝÖ¸¶¨ÄÚÈÝÈëÃŽ̳̰ɡ£
´´½¨Êý¾Ý¿âÁ¬½Ó
*/
$cn = mysql½Ì³Ì_connect('127.0.0.1','root','root') or die('Êý¾Ý¿âÁ¬½Óʧ°Ü');
$sql = "select * from test where url like '%1aa.cm%' ";
$result = mysql_db_query( 'cnnet',$sql,$cn );
while( $rs = mysql_fetch_array( $result ) )
{
echo $rs['url'],'<br />';
}
/*
Êä³ö½á¹û
www.1aa.cm
www.1aa.cm
www.1aa.cm
www.1aa.cm
ºÃ½á¹û³öÀ´ÁË£¬ÎÒÃÇÕýʽ½øÐÐÕýÌ⣬replaceÌæ»»ÄÚÈÝ£¬ÎÒÃÇÒªÇó°Ñ1aa.cmÈ«²¿Ìæ»»³É111cn.net
*/
$sqlReplace ="update test set url = replace('1aa.cm','111cn.net',url) WHERE url like '%1aa.cm%'";
mysql_db_query('cnnet',$sqlReplace,$cn);
if( 1 )
{
$sql = "select * from test ";
$query = mysql_db_query('cnnet',$sql,$cn );
while( $row = mysql_fetch_array( $query ) )
{
echo $rs['url'],'<br />';
}
}
else
{
echo '¼ì²éÄãµÄsqlÓï¾ä£¬Ð»Ð»';
}
/*
Êä³ö½á¹û£º
www.111cn.net
www.111cn.net
111cn.net
111cn.net
111cn.net
111cn.net
×¢Ã÷±¾Õ¾Ô´´ÎÄÕÂתÔØ×¢Ã÷À´Ô´www.111cn.net
Ïà¹ØÎĵµ£º
Ê×ÏÈ˵Ã÷Ò»µã£ºVC³ÌÐòÖÐÓÃADOÁ¬½ÓSQL Server 2005 ºÍÁ¬½Ó SQL Server 2000µÄÓï¾äºÍÁ¬½Ó×Ö·û´®ÊÇÍêÈ«Ò»ÑùµÄ£¬ÏÂÃæµÄ´úÂëÊÊÓÃÓÚÁ½¸öÊý¾Ý¿âµÄÁ¬½Ó¡£
ÁíÒ»µã˵Ã÷£ºÈç¹ûÄãÒÔÇ°°²×°¹ýSQL Server 2000£¬ºóÔÚûÓÐжÔصÄÇé¿öÏÂÓÖ°²×°ÁË2005£¬ÄÇôÄã֮ǰÔÚ2000ÖÐÉèÖõÄÓû§ÃûºÍÃÜÂëÔÚ2005Öлᱣ³Ö£¬¼´Ê¹Äã°²×°2005ʱδÉèÖÃÈκÎÓû§Ãû ......
[MySQLÓÅ»¯] -- ÈçºÎʹÓÃSQL Profiler ÐÔÄÜ·ÖÎöÆ÷
ʱ¼ä:2010-2-28À´Ô´:HaCMS¿ªÔ´ÉçÇø ×÷Õß:diesou
mysql µÄ sql ÐÔÄÜ·ÖÎöÆ÷Ö÷ÒªÓÃ;ÊÇÏÔʾ sql Ö´ÐеÄÕû¸ö¹ý³ÌÖи÷Ïî×ÊÔ´µÄʹÓÃÇé¿ö¡£·ÖÎöÆ÷¿ÉÒÔ¸üºÃµÄչʾ³ö²»Á¼ SQL µÄÐÔÄÜÎÊÌâËùÔÚ¡£ ÏÂÃæÎÒÃǾÙÀý½éÉÜһϠMySQL SQL Profiler µÄʹÓ÷½·¨£º Ê×ÏÈ£¬¿ªÆô MySQL SQL ......
תÖÁhttp://mbtk.blog.sohu.com/150003773.html £¬²¢²¹³äһЩÏà¹Ø֪ʶ¡£
DBCC ErrorLog £ºÈç¹ûºÜÉÙÖØÆðmssqlserver·þÎñ£¬ÄÇô·þÎñÆ÷µÄÈÕÖ¾»áÔö³¤µÃºÜ¿ì£¬¶øÇÒ´ò¿ªºÍ²é¿´ÈÕÖ¾µÄËÙ¶ÈÒ²»áºÜÂý¡£Ê¹ÓÃÕâ¸öÃüÁ¿ÉÒԽضϵ±Ç°µÄ·þÎñÆ÷ÈÕÖ¾£¬Ö÷ÒªÊÇÉú³ÉÒ»¸öеÄÈÕÖ¾¡£¿ÉÒÔ¿¼ÂÇÉèÖÃÒ»¸öµ÷¶ÈÈÎÎñ£¬Ã¿ÖÜÖ´ÐÐÕâ¸öÃüÁî×Ô¶¯½Ø¶Ï·þÎ ......
н¨±í£º
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default 'ĬÈÏÖµ' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] Decimal (12,4) default 0,
[×Ö¶Î7] image null ,
)
ɾ³ý±í£º
Drop table [±í ......
¶¨Ò壺 ºÎΪ´¥·¢Æ÷£¿ÔÚSQL ServerÀïÃæÒ²¾ÍÊǶÔijһ¸ö±íµÄÒ»¶¨µÄ²Ù×÷£¬´¥·¢Ä³ÖÖÌõ¼þ£¬´Ó¶øÖ´ÐеÄÒ»¶Î³ÌÐò¡£´¥·¢Æ÷ÊÇÒ»¸öÌØÊâµÄ´æ´¢¹ý³Ì¡£
³£¼ûµÄ´¥·¢Æ÷ÓÐÈýÖÖ£º·Ö±ðÓ¦ÓÃÓÚInsert , Update , Delete ʼþ¡£(SQL Server 2000¶¨ÒåÁËеĴ¥·¢Æ÷£¬Õ ......