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

SQL¡¡Êý¾Ý¿âÉú³É×Ô¶¯±àºÅ´úÂë

--exec  [P_AutoGenerateNumber]  'reception_apply','generate_code','',7
/*
 ¹ý³Ì˵Ã÷:Éú³É×Ô¶¯±àºÅ 
 ´´½¨Ê±¼ä:2010Äê1ÔÂ12ÈÕ
 ×÷Õß:feng
 debug:ÉÐδ¿¼ÂDZàºÅÒç³öÇé¿ö
*/ 
ALTER proc [P_AutoGenerateNumber]
  (
  @tableName varchar(100)='meeting_apply', --±íÃû
  @byteName varchar(100)='generate_code',  --×Ö¶ÎÃû
  @Remark   varchar(10)='M',   --±êʾ
  @subLen   int=4            --½ØÈ¡³¤¶È
  )
  WITH  ENCRYPTION   
  as
   
  declare   @SQLString   NVARCHAR(4000)   
  declare   @OutputValue   int 
  declare   @subLenVar   NVARCHAR(20) 
  declare   @TempValue varchar(20)
  set @subLenVar =convert(varchar(20),@subLen)
  set @TempValue ='00000000000000000000'  
 
  declare @OutputValueToVar varchar(20)
  
  set @SQLString = N'select @OutputValueEx=count(*) from    '+@tableName+' where generate_code is not null or generate_code!=''''' 
  EXECUTE   sp_executesql   @SQLString,   N'@OutputValueEx int output',@OutputValueEx= @OutputValue  output
  
  if @OutputValue !=0  
  begin
   SET   @SQLString   =  N'SELECT  @OutputValueEx=max(cast(right('+@byteName+','+@subLenVar+') as int))+1   


Ïà¹ØÎĵµ£º

д³ö¸ßÐÔÄÜSQLÓï¾äµÄ35Ìõ·½·¨

£¨1£©ÕûºÏ¼òµ¥,ÎÞ¹ØÁªµÄÊý¾Ý¿â·ÃÎÊ£º
¡¡¡¡Èç¹ûÄãÓм¸¸ö¼òµ¥µÄÊý¾Ý¿â²éѯÓï¾ä,Äã¿ÉÒÔ°ÑËüÃÇÕûºÏµ½Ò»¸ö²éѯÖÐ(¼´Ê¹ËüÃÇÖ®¼äûÓйØϵ)
£¨2£©É¾³ýÖظ´¼Ç¼£º
¡¡¡¡×î¸ßЧµÄɾ³ýÖظ´¼Ç¼·½·¨ ( ÒòΪʹÓÃÁËROWID)Àý×Ó£º
¡¡¡¡DELETE from EMP E WHERE E.ROWID > (SELECT MIN(X.ROWID)
¡¡¡¡from EMP X WHERE X.EMP_NO = E.EM ......

MY SQL »¹ÊǺÜÇ¿´óµÄ¡£¡£¡£

֮ǰûÔõôÑо¿¹ýMySQLµÄÈÝÁ¿£¬ÓÉÓÚÏîÄ¿ÐèÒª£¬ÐèÒªÒ»¸öÃâ·ÑµÄ¿ÉÒÔÖ§³ÖǧÍòÌõÊý¾Ý¼¶ÒÔÉϵÄÊý¾Ý¿â£¬²é¿´ÏÂmysqlµÄÎĵµ£¬·¢ÏÂmysql»¹ÊǺÜÇ¿´óµÄ£¬¼Ç¼Ï£¬ºÇºÇ¡£Ô­ÎÄÈçÏ£º
MySQL 3.22ÏÞÖƵıí´óСΪ4GB¡£ÓÉÓÚÔÚMySQL 3.23ÖÐʹÓÃÁËMyISAM´æ´¢ÒýÇ棬×î´ó±í³ß´çÔö¼Óµ½ÁË65536TB£¨2567 –1×Ö½Ú£©¡£ÓÉÓÚÔÊÐíµÄ±í³ß´ç¸ü´ ......

SQLÓï·¨ÓëÃüÁî


SQLÓï·¨ÓëÃüÁî
SELECT Óï¾ä
SELECT[predicate]{*|table.*|[table.]field [,[table.]field2[,...]]} [AS alias1
[,alias2[,...]]]
from tableexpression [,...][IN externaldatabase]
[WHERE...]
[GROUP BY...]
[HAVING...]
[ORDER BY...]
[WITH OWNERACCESS OPTION]
SELECT Óï¾ä°üÀ¨ÏÂÃ漸¸ö²¿·Ö
predicate ......

SQL Server ±ÊÊÔÌâ

Ò» µ¥´Ê½âÊÍ(2·Ö/¸ö) 34·Ö
¡¡¡¡Data Êý¾Ý Database Êý¾Ý¿â RDBMS ¹ØϵÊý¾Ý¿â¹ÜÀíϵͳ GRANT ÊÚȨ
¡¡¡¡REVOKE È¡ÏûȨÏÞ DENY ¾Ü¾øȨÏÞ DECLARE ¶¨Òå±äÁ¿ PROCEDURE´æ´¢¹ý³Ì
¡¡¡¡ÊÂÎñ Transaction ´¥·¢Æ÷ TRIGGER ¼ÌÐø  continue Ψһ unqiue
¡¡¡¡Ö÷¼ü primary key  ±êʶÁÐ identity Íâ¼ü foreign key  ¼ì ......

SQL²éѯÖеÄתÒå×Ö·û ÀÁèÐÇ¿Õ

Èç¹ûÏë²éÕÒ“_cs”½áβµÄµÄÕË»§
select * from [user] where loginname like '%_cs'ÊDz»Ðеģ¬_ ±»ÈÏΪÊÇÈÎÒâµÄ×Ö·û£¬
ËùÒÔÐèҪתÒå×Ö·û£¬ÓÐÁ½ÖÖд·¨£º
select * from [user] where loginname like '%[_]cs'
select * from [user] where loginname like '%/_cs' escape'/'
ͨÅä·ûº¬Òå
%
°üº¬Áã¸ö»ò¸ü¶à×Ö· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ