Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQLÄ£ºý²éѯ

ÔÚ½øÐÐÊý¾Ý¿â²éѯʱ£¬ÓÐÍêÕû²éѯºÍÄ£ºý²éѯ֮·Ö¡£
Ò»°ãÄ£ºýÓï¾äÈçÏ£º
SELECT ×ֶΠfrom ±í WHERE ij×ֶΠLike Ìõ¼þ
ÆäÖйØÓÚÌõ¼þ£¬SQLÌṩÁËËÄÖÖÆ¥Åäģʽ£º
1£¬%
£º±íʾÈÎÒâ0¸ö»ò¶à¸ö×Ö·û¡£¿ÉÆ¥Åä
ÈÎÒâÀàÐͺͳ¤¶ÈµÄ×Ö·û£¬ÓÐЩÇé¿öÏÂÈôÊÇÖÐÎÄ£¬ÇëʹÓÃÁ½¸ö°Ù·ÖºÅ£¨%%£©±íʾ
¡£
±È
Èç SELECT * from [user] WHERE u_name LIKE '%Èý%'
½«»á°Ñu_nameΪ“ÕÅÈý”£¬“ÕÅè
Èý”¡¢“Èý½Å蔣¬“ÌÆÈý²Ø”µÈµÈÓГÈý”µÄ¼Ç¼ȫÕÒ³öÀ´¡£
ÁíÍ⣬Èç¹ûÐèÒªÕÒ³öu_nameÖмÈÓГÈý”ÓÖÓГ蔵ļǼ£¬ÇëʹÓÃand
Ìõ¼þ
SELECT * from [user] WHERE u_name LIKE '%Èý%' AND u_name LIKE '%è%'
Èô
ʹÓà SELECT * from [user] WHERE u_name
LIKE '%Èý%è%'

ËäÈ»ÄÜËÑË÷³ö“Èý½Å蔣¬µ«²»ÄÜËÑË÷³ö·ûºÏÌõ¼þµÄ“ÕÅèÈý”¡£
2£¬_
£º
±íʾÈÎÒâµ¥¸ö×Ö·û¡£Æ¥Åäµ¥¸öÈÎÒâ×Ö·û£¬Ëü³£ÓÃÀ´ÏÞÖƱí´ïʽµÄ×Ö·û³¤¶ÈÓï¾ä£º
±ÈÈç SELECT * from [user]
WHERE u_name LIKE '_Èý_'
Ö»ÕÒ³ö“ÌÆÈý²Ø”ÕâÑùu_nameΪÈý¸ö×ÖÇÒÖмäÒ»¸ö×ÖÊÇ“Èý”µÄ£»
ÔÙ±ÈÈç
SELECT * from [user] WHERE u_name LIKE 'Èý__';
Ö»ÕÒ³ö“Èý½Åè”ÕâÑùnameΪÈý¸ö×ÖÇÒµÚÒ»¸ö×Ö
ÊÇ“Èý”µÄ£»
3£¬[ ]
£º±íʾÀ¨ºÅÄÚËùÁÐ×Ö·ûÖеÄÒ»¸ö£¨ÀàËÆÕýÔò±í´ïʽ£©¡£Ö¸¶¨Ò»¸ö×Ö·û¡¢×Ö
·û´®»ò·¶Î§£¬ÒªÇóËùÆ¥Åä¶ÔÏóΪËüÃÇÖеÄÈÎÒ»¸ö¡£
±ÈÈç SELECT * from [user] WHERE u_name LIKE
'[ÕÅÀîÍõ]Èý'
½«ÕÒ³ö“ÕÅÈý”¡¢“ÀîÈý”¡¢“ÍõÈý”£¨¶ø²»ÊÇ“ÕÅÀîÍõÈý”£©£»
Èç [ ]
ÄÚÓÐһϵÁÐ×Ö·û£¨01234¡¢abcdeÖ®ÀàµÄ£©Ôò¿ÉÂÔдΪ“0-4”¡¢“a-e”
SELECT * from [user] WHERE
u_name LIKE 'ÀÏ[1-9]'
½«ÕÒ³ö“ÀÏ1”¡¢“ÀÏ2”¡¢……¡¢“ÀÏ9”£»
4£¬[^ ]
£º
±íʾ²»ÔÚÀ¨ºÅËùÁÐÖ®Äڵĵ¥¸ö×Ö·û¡£ÆäÈ¡ÖµºÍ [] Ïàͬ£¬µ«ËüÒªÇóËùÆ¥Åä¶ÔÏóΪָ¶¨×Ö·ûÒÔÍâµÄÈÎÒ»¸ö×Ö·û¡£
±ÈÈç SELECT *
from [user] WHERE u_name LIKE '[^ÕÅÀîÍõ]Èý'
½«ÕÒ³ö²»ÐÕ“ÕÅ”¡¢“À¢“Íõ”µÄ“ÕÔÈý”¡¢“ËïÈý”µÈ£»
SELECT
* from [user] WHERE u_name LIKE 'ÀÏ[^1-4]';
½«Åųý“ÀÏ1”µ½“ÀÏ4”


Ïà¹ØÎĵµ£º

¡¾×ªÔØ¡¿Java/Hibernate/±ê×¼SQL Êý¾ÝÀàÐͶÔÓ¦±í


JavaÊý¾ÝÀàÐÍ
HibernateÊý¾ÝÀàÐÍ
±ê×¼SQLÊý¾ÝÀàÐÍ
(PS:¶ÔÓÚ²»Í¬µÄDB¿ÉÄÜÓÐËù²îÒì)
byte¡¢java.lang.Byte
byte
TINYINT
short¡¢java.lang.Short
short
SMALLINT
int¡¢java.lang.Integer
integer
INGEGER
long¡¢java.lang.Long
long
BIGINT
float¡¢java.lang.Float
float
FLOAT
double¡¢java.lang.Doubl ......

C#ÖÐÓÃÓÚÁ¬½ÓSQLÊý¾Ý¿âµÄSQLHelperÀà

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;   //ÒýÓÃÃüÃû¿Õ¼ä
namespace DAL
{
    /*******************************************************************************
  &n ......

SQL SERVER 2008 ¸ü¸Ä¸ú×Ù

SQL SERVER 2008 ¸ü¸Ä¸ú×Ù
/*
¿´Ê飬¿´Áª»úÆڼ䡣¡£¡£Ë³´ø°Ñ¿´µ½µÄдÏÂ
 
ÓëSQL SERVER 2008 CDC Òì²½²¶»ñÊý¾Ý±ä¸üµÄ²»Í¬,¸ü¸Ä¸ú×ÙÊÇͬ²½½ø³Ì,
ÊÇDML(INSERT/UPDATE/DELETE)ÊÂÎñµÄÒ»²¿·Ö,Ëü¿ÉÒÔʹÓÃ×îСµÄCÅÌ´æ´¢
¿ªÏúÀ´Õì²âÊý¾ÝÐеľ»±ä¸ü.ÄÇôËüÒ²¾Í²»ÄÜÏñCDCÄÇÑù¿ÉÒÔÌṩÓû§±íµÄ
ÀúÊ·¸ü¸ÄÐÅÏ¢. ¸ü¸ÄÊÇʹÓÃÒ ......

SQL ServerȨÏÞ¹ÜÀí²ßÂÔ ·þÎñÆ÷

SQL ServerȨÏÞ¹ÜÀí²ßÂÔ
Êý¾Ý¿â½¨Á¢Ö®ºó£¬Êý¾ÝµÄ°²È«¾ÍÏÔµÃÓÈΪÖØÒª£¬¶ÔÓÚÒ»¸öÊý¾Ý¿â¹ÜÀíÔ±À´Ëµ£¬°²È«ÐÔ¾ÍÒâζ×ÅËû±ØÐë±£Ö¤ÄÇЩ¾ßÓÐÌØÊâÊý¾Ý·ÃÎÊȨÏÞµÄÓû§Äܹ»µÇ¼µ½SQL Server£¬²¢ÇÒÄܹ»·ÃÎÊÊý¾ÝÒÔ¼°¶ÔÊý¾Ý¿â¶ÔÏóʵʩ¸÷ÖÖȨÏÞ·¶Î§ÄڵIJÙ×÷£»Í¬Ê±£¬Ëû»¹Òª·ÀÖ¹ËùÓеķÇÊÚȨÓû§µÄ·Ç·¨²Ù×÷¡£Õý»ùÓÚ´Ë£¬SQL Server 2000ÌṩÁ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ