SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
¡¾ÎÊÌâÃèÊö£º¡¿
Ò»¸öÓû§±íÖеÄ×¢²áÈÕÆÚÏÔʾ¸ñʽÊÇ£ºyyyy-mm-dd Thh:mm:ss.mmm ¡£¶øÎÒÏëͳ¼Æ³öÿÌìµÄÓû§×¢²áÊý£¬Ö±½Ógroup×¢²áÈÕÆÚ×Ö¶ÎÏÔÈ»ÊDz»Ðеġ£
¡¾ÎÊÌâ´¦Àí£º¡¿
ÀûÓÃSQLserverÖеÄconvertº¯Êý¶ÔÈÕÆÚ½øÐÐת»»×ª»»¡£groupת»»ºóµÄÈÕÆÚ¡£
¡¾½Å ±¾£º¡¿
--²éѯij¸öÔÂÿÌìµÄÓû§×¢²áÊý
use USERDB
select count(*) as total,convert(varchar(12),RegisterDateTime,106) as date from DB.USERNAME
where RegisterDateTime between '2009-11-01' and '2009-11-30'
group by convert(varchar(12),RegisterDateTime,106)
×¢£ºuserdbΪ¿â£¬db.usernameΪ±í
¡¾Ïà¹Ø֪ʶ£º¡¿
SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ2008-01-15 15:51SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
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
select getdate()
½á¹û£º2003-12-28 16:52:00.107
select con
Ïà¹ØÎĵµ£º
Create Procedure up_InsertData2
@ID INT
AS
BEGIN
Declare @Name NVARCHAR(30)
Declare @c1 NVARCHAR(30)
Declare @c2 NVARCHAR(30)
Declare @c3 NVARCHAR(30)
Declare @c4 NVARCHAR(30)
Declare tmpCur Cursor For Select a,b,c,d from table1
Open tmpCur;
Fetch Next from tmpCur Into @c1,@c2,@c3 ......
Ò»¡¢Êý¾Ý¿â½á¹¹µÄÉè¼Æ
Èç¹û²»ÄÜÉè¼ÆÒ»¸öºÏÀíµÄÊý¾Ý¿âÄ£ÐÍ£¬²»½ö»áÔö¼Ó¿Í»§¶ËºÍ·þÎñÆ÷¶Î³ÌÐòµÄ±à³ÌºÍά»¤µÄÄѶȣ¬¶øÇÒ½«»áÓ°Ïìϵͳʵ¼ÊÔËÐеÄÐÔÄÜ¡£ËùÒÔ£¬ÔÚÒ»¸öϵͳ¿ªÊ¼ÊµÊ©Ö®Ç°£¬Í걸µÄÊý¾Ý¿âÄ£Ð͵ÄÉè¼ÆÊDZØÐëµÄ¡£
ÔÚÒ»¸öϵͳ·ÖÎö¡¢Éè¼Æ½×¶Î£¬ÒòΪÊý¾ÝÁ¿½ÏС£¬¸ººÉ½ÏµÍ¡£ÎÒÃÇÍùÍù ......
»ù±¾ÅäÖÃ
Ò»¡¢ÎļþϵͳҪÇó£º
1¡¢ÖÁÉÙÓжþ¸ö·ÖÇø£»
2¡¢ÏµÍ³·ÖÇø²»Ð¡ÓÚ10G£»
3¡¢·ÖÇø¸ñʽ±ØÐëÊÇNTFS¡£
¶þ¡¢²¹¶¡°²×°ÒªÇó£º
1¡¢ÏÈ°²×°Íê±ÏWINDOWS 2000 SP4+³å»÷²¨+Õðµ´²¨²¹¶¡£»
2¡¢½«WINDOWS 2000²¹¶¡Éý¼¶µ½×îкó²Å¿É°²×°cluster ºÍSQL Server£»
3¡¢SQL Server²¹¶¡ÐèÉý¼¶µ½Service Pack 3¡£
Èý¡¢ClusterÐÅÏ¢£º
1£ ......
package cn.ctgu.edu.ac;
import java.sql.*;
public class test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String url="jdbc:sqlserver://localhost:1433;Database=ÍøÉÏÊéµê¹ÜÀíϵͳ;integr ......
ÔÚÓëÊý¾Ý¿â´ò½»µÀµÄ¹¤×÷ÖÐʱ³£»áÅöµ½Ò»Ð©Êý¾Ý¿âµÄ´íÎó£¬Õâ¾ÍÉæ¼°µ½ÁËÐÞ¸´µÄ¹ý³Ì£¬ÒÔÏÂ֪ʶµã¶¼ÊÇ´ÓÍøÉÏÊÕ¼¯¶øÀ´:
1¡¢dbcc checkdb
Õâ¸öÃüÁî¿ÖÅÂÊÇÎÒÃÇ×î³£ÓõÄÁË£¬´ø¼ì²éºÍÐÞ¸´¹¦ÄÜ
Óï·¨¸ñʽ£º
DBCC CHECKDB
[
[ ( database_name | database_id | 0
[ , NOINDEX
| , { REPAIR_ALLOW_DATA_LOS ......