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

sqlServerÖг£¼ûµÄÈÕÆÚ¸ñʽ

½øÀ´ÒòΪ¿ª·¢Ô­Òò£¬¾­³£ÐèҪʹÓÃÈÕÆÚ·½ÃæµÄ±È½ÏºÍ²Ù×÷£¬ÕûÀíÁËÒ»ÏÂÕâ·½ÃæµÄ×ÊÁÏ£¬¹©´ó¼Ò¹²Ïí£º
SQL ServerÖÐÎÄ°æµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
ÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄܾ­³£»áÓõ½µÄÈÕÆÚ¸ñʽת»»·½·¨:
¾ÙÀýÈçÏÂ:
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),@#-@#,@#@#),@# @#,@#@#),@#:@#,@#@#)
20040912110608
select CONVERT(varchar(12) , getdate(), 111 )
2004/09/12
select CONVERT(varchar(12) , getdate(), 112 )
20040912
select CONVERT(varchar(12) , getdate(), 102 )
2004.09.12
select CONVERT(varchar(12) , getdate(), 101 )
09/12/2004
select CONVERT(varchar(12) , getdate(), 103 )
12/09/2004
select CONVERT(varchar(12) , getdate(), 104 )
12.09.2004
select CONVERT(varchar(12) , getdate(), 105 )
12-09-2004
select CONVERT(varchar(12) , getdate(), 106 )
12 09 2004
select CONVERT(varchar(12) , getdate(), 107 )
09 12, 2004
select CONVERT(varchar(12) , getdate(), 108 )
11:06:08
select CONVERT(varchar(12) , getdate(), 109 )
09 12 2004 1
select CONVERT(varchar(12) , getdate(), 110 )
09-12-2004
select CONVERT(varchar(12) , getdate(), 113 )
12 09 2004 1
select CONVERT(varchar(12) , getdate(), 114 )
11:06:08.177 
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/zhoufoxcn/archive/2007/10/09/1817279.aspx


Ïà¹ØÎĵµ£º

SqlServer £ºInvalid call Statement method: {0}


½ñÌì±àдÁËÒ»¸ö·ÖÒ³£¬ÔÚµ÷ÊÔÖгöÏÖÁËÈçϵĴíÎó:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid call Statement method: {0}
 at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
 at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown ......

SQL LIKE ͨÅä·ûËæ±Ê £¨SqlServer£©

ͨÅä·û ˵Ã÷
_    ÓëÈÎÒâµ¥×Ö·ûÆ¥Åä
 
%    Óë°üº¬Ò»¸ö»ò¶à¸ö×Ö·ûµÄ×Ö·û´®Æ¥Åä
 
[ ]  ÓëÌض¨·¶Î§£¨ÀýÈ磬[a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[abcdef]£©ÖеÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
 
[^]  ÓëÌض¨·¶Î§£¨ÀýÈ磬[^a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[^abcdef]£©Ö®ÍâµÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
......

XpϵͳÏÂsqlServer 2000ÖÐ1433¶Ë¿Ú´ò²»¿ªµÄÎÊÌâ

 ÎÒ×°µÄÊÇXpϵͳ£¬µ±ÎÒ×°Sql Server2000Êý¾Ý¿âºó£¬ÓÃJava³ÌÐòÀ´½øÐÐÊý¾Ý¿âÁ¬½Óʱ³ö´íÁË£¬·¢ÏÖÊÇ1433¶Ë¿ÚûÓдò¿ª£¬ÔÚÍøÉÏÕÒÁËЩ½â¾ö°ì·¨£¬·½·¨ËµµÄ²»ÊǺÜÇå³þ£¬»¹ÓеãÂÞàÂÁË¡£ÎÒ½â¾öºó·¢ÏÖ°ì·¨ÊÇ£ºÊ×ÏÈÊDz鿴ÄãµÄ°æ±¾£¬¿ÉÒÔÓÃselect @@versionÀ´²é¿´¡£×°ÍêSql Server 2000 1433¶Ë¿ÚÓÐÊÇûÓдò¿ª£¬¿ÉÒÔÓÃnet -an -p tcp ......

ÓÃasp.net»¹Ô­Óë»Ö¸´sqlserverÊý¾Ý¿â

  
ÉÏ´Î×öÁ˸öÏîÄ¿£¬Éæ¼°µ½Êý¾Ý¿âµÄ»¹Ô­ºÍ»Ö¸´£¬µ½ÍøÉÏÕÒÁËһϣ¬ÊÇÀûÓÃSQLDMOʵÏֵģ¬Ö»ÒªÌí¼ÓSQLDMOÒýÓþͺÃÁË£¬È»ºóÀûÓÃϱߵÄÀàµÄ·½·¨¾Í¿ÉÒÔʵÏÖÁË¡£
ÎÒ°ÑÔ­×÷ÕßµÄÀàÀ©³äÁËһϣ¬¿ÉÒÔ×Ô¶¯Ê¶±ðweb.configÀï µÄÊý¾Ý¿âÁ¬½Ó×Ö·û´®£¬¿ÉÒÔͨ¹ý±äÁ¿ÉèÖû¹Ô­»Ö¸´µÄÐÅÏ¢¡£
ÐèҪעÒâµÄʱ»¹Ô­£¬»¹Ô­µÄʱºòÎÊÌ ......

SQLSERVERÒÉÎÊ

ÒÉÎÊ£º
1£¬ sqlserverÀïÃæÖ´ÐÐ xp_cmdshell
exec @error=xp_cmdshell 'cmdstr......'
·µ»ØÖµÊÇʲôֵ£¿dosÃüÁîµÄ´íÎó£¿Ê²Ã´ÑùµÄ´íÎó¿ÉÒÔÆË×½µ½£¿
±ÈÈç:
DECLARE @error int
EXEC @error=master.dbo.xp_cmdshell 'bcp CM_DWHSend.dbo.WK_CM_DWHSend_Master in  "D:\Sales\DWH_Onl\2010042_SENDMEMM.csv" -n -t, - ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ