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

[ת]SQL½ØÈ¡×Ö·û´®

SUBSTRING
·µ»Ø×Ö·û¡¢binary¡¢text      »ò      image      ±í´ïʽµÄÒ»²¿·Ö¡£ÓйؿÉÓë¸Ãº¯ÊýÒ»ÆðʹÓõÄÓÐЧ      Microsoft®      SQL      Server™      Êý¾ÝÀàÐ͵ĸü¶àÐÅÏ¢£¬Çë²Î¼ûÊý¾ÝÀàÐÍ¡£   
Óï·¨
SUBSTRING      (      expression      ,      start      ,      length      )   
²ÎÊý
expression
ÊÇ×Ö·û´®¡¢¶þ½øÖÆ×Ö·û´®¡¢text¡¢image¡¢Áлò°üº¬Áеıí´ïʽ¡£²»ÒªÊ¹Óðüº¬¾ÛºÏº¯ÊýµÄ±í´ïʽ¡£
start
ÊÇÒ»¸öÕûÊý£¬Ö¸¶¨×Ó´®µÄ¿ªÊ¼Î»Öá£
length
ÊÇÒ»¸öÕûÊý£¬Ö¸¶¨×Ó´®µÄ³¤¶È£¨Òª·µ»ØµÄ×Ö·ûÊý»ò×Ö½ÚÊý£©¡£ substring()
——ÈÎÒâλÖÃÈ¡×Ó´®
left()
right()
——×óÓÒÁ½¶ËÈ¡×Ó´®
ltrim()
rtrim()
——½Ø¶Ï¿Õ¸ñ£¬Ã»ÓÐtrim()¡£
charindex()
patindex()
——²é×Ó´®ÔÚĸ´®ÖеÄλÖã¬Ã»Óзµ»Ø0¡£Çø±ð£ºpatindexÖ§³ÖͨÅä·û£¬charindex²»Ö§³Ö¡£ º¯Êý¹¦Ð§£º
×Ö·û´®½ØÈ¡º¯Êý£¬Ö»ÏÞµ¥×Ö½Ú×Ö·ûʹÓ㨶ÔÓÚÖÐÎĵĽØȡʱÓöÉÏÆæÊý³¤¶ÈÊÇ»á³öÏÖÂÒÂ룬ÐèÁíÐд¦Àí£©£¬±¾º¯Êý¿É½ØÈ¡×Ö·û´®Ö¸¶¨·¶Î§ÄÚµÄ×Ö·û¡£
Ó¦Ó÷¶Î§£º
±êÌâ¡¢ÄÚÈݽØÈ¡
º¯Êý¸ñʽ£º
string substr ( string string, int start [, int length])
²ÎÊý1£º´¦Àí×Ö·û´®
²ÎÊý2£º½ØÈ¡µÄÆðʼλÖ㨵ÚÒ»¸ö×Ö·ûÊÇ´Ó0¿ªÊ¼£©
²ÎÊý3£º½ØÈ¡µÄ×Ö·ûÊýÁ¿
substr()¸ü¶à½éÉÜ¿ÉÔÚPHP¹Ù·½ÊÖ²áÖвéѯ£¨×Ö·û´®´¦Àíº¯Êý¿â£©
¾ÙÀý£º
substr("ABCDEFG", 0);     //·µ»Ø£ºABCDEFG£¬½ØÈ¡ËùÓÐ×Ö·û
substr("ABCDEFG", 2);     //·µ»Ø£ºCDEFG£¬½ØÈ¡´ÓC¿ªÊ¼Ö®ºóËùÓÐ×Ö·û
substr("ABCDEFG", 0, 3); //·µ»Ø£ºABC£¬½ØÈ¡´ÓA¿ªÊ¼3¸ö×Ö·û
substr("ABCDEFG", 0, 100); //·µ»Ø£ºABCDEFG£¬100ËäÈ»³¬³öÔ¤´¦ÀíµÄ×Ö·û´®×¶È£¬µ«²»»áÓ°Ïì·µ»Ø½á¹û£¬Ï


Ïà¹ØÎĵµ£º

SQL SERVER²Ù×÷ACCESSµÄ´æ´¢¹ý³Ì

/*
--×÷ÓãºSQL SERVER²Ù×÷ACCESSµÄ´æ´¢¹ý³Ì
----------------------Ó÷¨-------------------------------
--´´½¨±ítc
exec sp_operate_access 'create table tc(id int)','c:\db1.mdb'
go
--ÔÚtc±í²åÈëÊý¾Ý
exec sp_operate_access 'insert into tc(id) values(1)','c:\db1.mdb'
go
--ɾ³ýtc±íµÄÊý¾Ý
exec sp_op ......

SQLº¯ÊýÖ®ËÄÉáÎåÈë

SQLº¯ÊýÖ®ËÄÉáÎåÈ루ת×Ôhttp://ln1058.javaeye.com/blog/191502£©
ÎÊÌâ1£º
SELECT CAST('123.456' as decimal) ½«»áµÃµ½ 123£¨Ð¡ÊýµãºóÃæµÄ½«»á±»Ê¡ÂÔµô£©¡£
Èç¹ûÏ£ÍûµÃµ½Ð¡ÊýµãºóÃæµÄÁ½Î»¡£
ÔòÐèÒª°ÑÉÏÃæµÄ¸ÄΪ
SELECT CAST('123.456' as decimal(38, 2)) ===>123.46
×Ô¶¯ËÄÉáÎåÈëÁË£ ......

SQLÓï¾äµ¼Èëµ¼³ö´óÈ«


SQLÓï¾äµ¼Èëµ¼³ö´óÈ«
/*******  µ¼³öµ½excel
EXEC master..xp_cmdshell ¡¯bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -S"GNETDATA/GNETDATA" -U"sa" -P""¡¯
/***********  µ¼ÈëExcel
SELECT *
from OpenDataSource( ¡¯Microsoft.Jet.OLEDB.4.0¡¯,
  ¡¯Data Source="c:\test.xls ......

hibernateɾ³ý²Ù×÷µÄsqlÓï¾äд·¨

 
µÚÒ»ÖÖ£º
public void deleteUser(String byemail) {
  Session session = getSession();
  Transaction transaction = null;
  String hql = "delete from Register where email=?
";
  try {
   transaction = session.beginTransactio ......

SQL Server2005 SynonymµÄʹÓÃ

--> Title  : SQL Server2005 SynonymµÄʹÓÃ
--> Author : wufeng4552
--> Date   : 2009-10-30
1.SynonymµÄ¸ÅÄî
¡¡  Synonym£¨Í¬Òå´Ê£©ÊÇSQL Server 2005µÄÐÂÌØÐÔ¡£¿ÉÒÔ¼òµ¥µÄÀí½âSynonymΪÆäËû對ÏóµÄ±ðÃû¡£
語·¨
CREATE SYNONYM [ schema_name_1. ] synonym_name FOR & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ