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

¶àÌõ¼þ²éѯ´æ´¢¹ý³Ì SQL Server


¶àÌõ¼þ²éѯ´æ´¢¹ý³Ì
 ¶àÌõ¼þ²éѯ´æ´¢¹ý³Ì ÀýÒ»
create proc pr_select_Natural
(
 @CDATE  datetime,
 @FAC_NAME varchar(50),
 @BATTERY_TYPE varchar(20),
 @MAKE_MODE varchar(20),
 @PRODUCE_MODE varchar(20),
 @YEAR  char(4),
 @MONTH  char(2),
 @TDATE  datetime,
 @PAGENUM varchar(12)
)
as
declare @strWhere varchar(500)
if ( @CDATE = null )
 set @strWhere = @strWhere+' and CDATE ='+ @CDATE
if ( @FAC_NAME = null )
 set @strWhere = @strWhere+' and FAC_NAME like ''%''+@FAC_NAME+''%'' '
if ( @BATTERY_TYPE = null )
 set @strWhere = @strWhere+' and BATTERY_TYPE like ''%''+@BATTERY_TYPE+''%'''
if ( @MAKE_MODE = null )
 set @strWhere = @strWhere+' and MAKE_MODE like ''%''+@MAKE_MODE+''%'''
if ( @PRODUCE_MODE = null )
 set @strWhere = @strWhere+' and PRODUCE_MODE like ''%''+@PRODUCE_MODE+''%'''
if ( @YEAR = null )
 set @strWhere =@strWhere+ ' and YEAR like ''%''+@YEAR+''%'''
if ( @MONTH = null )
 set @strWhere = @strWhere+' and MONTH like ''%''+@MONTH+''%'''
if ( @TDATE = null )
 set @strWhere = @strWhere+' and TDATE = @TDATE'
if ( @PAGENUM = null )
 set @strWhere = @strWhere+' and PAGENUM like ''%''+@PAGENUM+''%'''
 
set @strMAIN = 'select
  CDATE  as ³ö³§Ê±¼ä,
  FAC_NAME  as ·¢»õ³§¼Ò,
  BATTERY_TYPE as µç³ØÐͺÅ,
  SEND_TYPE as ·¢»õÀàÐÍ,
  SEND_NUM as ¼ì²âÊýÁ¿,
  MAKE_MODE as ÖÆ×÷·½Ê½,
  PRODUCE_MODE as Éú²ú·½Ê½,
  BATTERY_NUM as µç³Ø×éÊýÁ¿,
  [YEAR]  as Äê,
  [MONTH] as ÔÂ,
  TDATE  as ÈÕÆÚ,
  SEND_RULE as ·¢»õ¹æÔò,
  SEND_CODE as ·¢»õ×é±àºÅ,
  BATTERY_SORT as µç³ØÀà±ð,
  PAGENUM as ÌõÂëºÅ,
  FITTING_CODE as ×°ÅäºÅ,
  LINE_CODE as Éú²ú»úºÅ,
  FLAG  as ÊÇ·ñ·ÅÐÐ,
  REMARK  as ±¸×¢,
  OTHER  as ÆäËû,
  BLANK_COL as ¿Õ°×ÁÐ
    from T_INFOCODE_NATUR


Ïà¹ØÎĵµ£º

Êý¾Ý¿â·þÎñÆ÷¸ÄÃûºó±£Ö¤SQL ×÷Òµ¼°¸´ÖÆ¿ÉÓÃ

Óöµ½ÏÈ×°SQL Server£¬ºó¸Ä¼ÆËã»úÃû£¬×ö×÷ÒµµÄ×Ô¶¯Ö´ÐС¢·þÎñÆ÷¸´ÖÆʱÓöµ½´íÎóÒ»Ñù¡£°´ÒÔϲ½Öè²Ù×÷¿ÉÒÔÐÞ¸´£º
·½·¨Ò»¡¢
1¡¢ÏȲ鿴¼ÆËã»úÃû£º
SELECT @@SERVERNAME As [@@SERVERNAME],
CAST(SERVERPROPERTY('MACHINENAME') AS VARCHAR(128)) + COALESCE('\' + CAST(SERVERPROPERTY('INSTANCENAME') AS VARCHAR(128)), ' ......

SQL Server ExpressµÄʹÓÃ

      ½ñÌìÖÕÓÚÖªµÀSQL 2005 ÔõôÓÃÁË£¬¸Ð¾õÒÔÇ°Ì«ÀÁÁË£¬Ã÷Ã÷ÏëÖªµÀµÄ¶«Î÷¿ÉÊÇÒòΪÒѾ­ÓÐsql2000¾ÍÀÁµÃ²é¡£ÖªÊ¶ÕⶫÎ÷ÊÇÈÕ»ýÔÂÀ۵ģ¬ÕæÕýµ½ÓõÄʱºò²ÅÈ¥²¹¾ÍÒѾ­ÍíÁË¡£
      ÒÔÇ°°²×°VS2005µÄʱºò¾Í¿´µ½°²×°ÍêÁËÒÔºó»áÓÐÒ»¸öSQL2005£¬¿ÉÊÇ×Ô¼º²»»áÓã¬ÄǸöʱºòÖ» ......

PHPµÄ±àдSQLÓï¾äʱ¶ÔÐèҪתÒå×Ö·ûµÄ´¦Àí

1. ¶ÔÓÚPHP magic_quotes_gpc=onµÄÇé¿ö£¬ ÎÒÃÇ¿ÉÒÔ²»¶ÔÊäÈëºÍÊä³öÊý¾Ý¿âµÄ×Ö·û´®Êý¾Ý×÷
addslashes()ºÍstripslashes()µÄ²Ù×÷,Êý¾ÝÒ²»áÕý³£ÏÔʾ¡£ Èç¹û´ËʱÄã¶ÔÊäÈëµÄÊý¾Ý×÷ÁËaddslashes()´¦Àí£¬
ÄÇôÔÚÊä³öµÄʱºò¾Í±ØÐëʹÓÃstripslashes()È¥µô¶àÓàµÄ·´Ð±¸Ü¡£ 2. ¶ÔÓÚPHP magic_quotes_gpc=off µÄÇé¿ö ±ØÐëÊ¹Ó ......

¹ØÓÚSql PromptÆƽâµÄ·½·¨

Ç°²»¾Ã¿´µ½Í¬ÊÂÔÚÓÃSql Prompt3.9£¬¾õµÃÂù·½±ãµÄ¡£¸øÎÒÃÇд³ÌÐòÄÜʡϲ»ÉÙÁ¦Æø¡£·½±ã£¬sql´úÂë¿´ÆðÀ´ÓÖ¼ò½é¡£ÖµµÃÍƼö¡£http://www.red-gate.com/ÕâÊÇËüµÄ¹ÙÍø£¬ÊÇÒ»¿îÊշѵÄÈí¼þ¡£Õýʽ°æ±¾ÏÂÔØÏÂÀ´Ö»ÄÜʹÓÃ14Ìì¡£·Ï»°²»ËµÁË£¬ÏÈ¿´ÏÂЧ¹ûͼ£º
»¹²»´í°¡¡£
½ÓÏÂÀ´½éÉÜÏÂÆƽâµÄ·½·¨£¬Ïȵ½¹ÙÍø°Ñ×îаæ(ÏÖÔÚÒѾ­ÊÇ3.9ÁË)ÏÂÏÂÀ ......

SQLÓï¾äÓÅ»¯

£¨1£©Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò£¨Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ£©
oracleµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒÖÁ×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±í£©½«×îÏȱ»´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, ÄǾÍÐèҪѡÔñ½»²æ±í(intersection table)×÷Ϊ»ù´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ