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  
Ïà¹ØÎĵµ£º
ÔÚÇÚÕÜEXCEL·þÎñÆ÷ÖÐÓÐ×óÓÒÄÚÁ¬½ÓµÄ²Ù×÷£¬ÎÒÃÇÔÚÕâÀïÓÃSQLÓï¾äÀ´Êµ¼Ê˵Ã÷Ò»ÏÂÖ®¼äµÄÇø±ðÓë×÷Óá£
= ÄÚÁ¬½Ó SQLÖÐΪinner join
*= ×óÁ¬½Ó °üº¬ËùÓеÄ×ó±ß±íÖеļǼÉõÖÁÊÇÓұ߱íÖÐûÓкÍËüÆ¥ÅäµÄ¼Ç¼¡£ SQLÖÐΪleft j ......
£¨1£©ÕûºÏ¼òµ¥,ÎÞ¹ØÁªµÄÊý¾Ý¿â·ÃÎÊ£º
¡¡¡¡Èç¹ûÄãÓм¸¸ö¼òµ¥µÄÊý¾Ý¿â²éѯÓï¾ä,Äã¿ÉÒÔ°ÑËüÃÇÕûºÏµ½Ò»¸ö²éѯÖÐ(¼´Ê¹ËüÃÇÖ®¼äûÓйØÏµ)
£¨2£©É¾³ýÖØ¸´¼Ç¼£º
¡¡¡¡×î¸ßЧµÄɾ³ýÖØ¸´¼Ç¼·½·¨ ( ÒòΪʹÓÃÁËROWID)Àý×Ó£º
¡¡¡¡DELETE from EMP E WHERE E.ROWID > (SELECT MIN(X.ROWID)
¡¡¡¡from EMP X WHERE X.EMP_NO = E.EM ......
֮ǰûÔõôÑо¿¹ýMySQLµÄÈÝÁ¿£¬ÓÉÓÚÏîÄ¿ÐèÒª£¬ÐèÒªÒ»¸öÃâ·ÑµÄ¿ÉÒÔÖ§³ÖǧÍòÌõÊý¾Ý¼¶ÒÔÉϵÄÊý¾Ý¿â£¬²é¿´ÏÂmysqlµÄÎĵµ£¬·¢ÏÂmysql»¹ÊǺÜÇ¿´óµÄ£¬¼Ç¼Ï£¬ºÇºÇ¡£ÔÎÄÈçÏ£º
MySQL 3.22ÏÞÖÆµÄ±í´óСΪ4GB¡£ÓÉÓÚÔÚMySQL 3.23ÖÐʹÓÃÁËMyISAM´æ´¢ÒýÇæ£¬×î´ó±í³ß´çÔö¼Óµ½ÁË65536TB£¨2567 –1×Ö½Ú£©¡£ÓÉÓÚÔÊÐíµÄ±í³ß´ç¸ü´ ......
н¨±í£º
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 [±í ......
1)
¼Ù¶¨ÓÐÒ»¸öÓû§±í£¬±íÖаüº¬×ֶΣº
userid
(int)
¡¢
username
(varchar)
¡¢
password(varchar)
¡¢µÈ£¬
¸Ã±íÐèÒªÉèÖÃÖ÷¼ü£¬ÒÔÏÂ˵·¨ÕýÈ·µÄÊÇ£¨£©¡££¨Ñ¡ÔñÁ½Ï
a)
Èç¹û²»ÄÜÓÐÍ¬Ê±ÖØ¸´µÄ
username
ºÍ
password
£¬ÄÇô
username
ºÍ
password
¿ÉÒÔ×éºÏÔÚÒ»Æð×÷ΪÖ÷¼ü¡£
  ......