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

sqlserverÊý¾Ý¿âDateTime¸ñʽ²Ù×÷

Êý¾ÝÀï(sqlserver) µÄ²Ù×÷ £º
eg £º2008-3-31 10:34 --> 2008-3-31
Ò».½ØÈ¡×Ö·û´®·½Ê½
select substring('2008-3-31 10:34',0,charindex(' ','2008-3-31 10:34'))
¶þ.
Select
CONVERT(varchar, getdate(), 1),--mm/dd/yy
CONVERT(varchar, getdate(), 2),--yy.mm.dd
CONVERT(varchar, getdate(), 3),--dd/mm/yy
CONVERT(varchar, getdate(), 4),--dd.mm.yy
CONVERT(varchar, getdate(), 5),--dd-mm-yy
CONVERT(varchar, getdate(), 10),--mm-dd-yy
CONVERT(varchar, getdate(), 11),--yy/mm/dd
CONVERT(varchar, getdate(), 12)--yymmdd
----´øÊÀ¼ÍºÅ
select convert(varchar(10),getdate(),100) --06 15 2007 »ò0
select convert(varchar(10),getdate(),102) --2007.06.15
select convert(varchar(10),getdate(),103) --15/06/2007
select convert(varchar(10),getdate(),104) --15.06.2007s
select convert(varchar(10),getdate(),105) --15-06-2007
select convert(varchar(10),getdate(),106) --15 06 2007
select convert(varchar(10),getdate(),107) --06-15,200
select convert(varchar(10),getdate(),108) --10:06:46 µ±Ç°Ê±¼ä
select convert(varchar(10),getdate(),109) --06 15 2007 »òÕß9
select convert(varchar(10),getdate(),110) --06-15-2007
select convert(varchar(10),getdate(),111) --2007/06/15
select convert(varchar(10),getdate(),112) --20070615
select convert(varchar(10),getdate(),113) --15 06 2007 »òÕß13
select convert(varchar(10),getdate(),114) --10:10:37:0
select convert(varchar(10),getdate(),120) --2007-06-15 »ò20---------------<OK>
select convert(varchar(30),getdate(),121) --2007-06-15 10:11:45.040 »ò21
select convert(varchar(30),getdate(),126) --2007-06-15T10:12:44:603
select convert(varchar(50),getdate(),127) --2007-06-15T10:14:35:433 ˵´øʱÇø
select convert(varchar(40),getdate(),130) --ȯ˜dd mon yyyy hh:mi:ss:mmmAM
select convert(varchar(30),getdate(),131) --30/05/1428 10:17:19:470AM
GO

Èý.·Ç sqlserver Êý¾Ý¿â
//¿ÉÓÃʹÓÃ
data£¨db_field£©
Ïà¹ØÁ´½Ó£ºhttp://hi.baidu.com/bbsl166/blog/item/d9ebd4fafb005417a9d31110.html


Ïà¹ØÎĵµ£º

SQLServerË÷Òýµ÷ÓÅʵ¼ù

Ë÷ÒýµÄÖØÒªÐÔ
¡¡¡¡Êý¾Ý¿âÐÔÄÜÓÅ»¯ÖÐË÷Òý¾ø¶ÔÊÇÒ»¸öÖØÁ¿¼¶µÄÒòËØ£¬¿ÉÒÔ˵£¬Ë÷ÒýʹÓò»µ±£¬ÆäËüÓÅ»¯´ëÊ©½«ºÁÎÞÒâÒå¡£
¡¡¡¡¾Û´ØË÷Òý(Clustered Index)ºÍ·Ç¾Û´ØË÷Òý (Non- Clustered Index)¡¡
¡¡¡¡×îͨË׵ĽâÊÍÊÇ:¾Û´ØË÷ÒýµÄ˳Ðò¾ÍÊÇÊý¾ÝµÄÎïÀí´æ´¢Ë³Ðò£¬¶ø¶Ô·Ç¾Û´ØË÷ÒýµÄË÷Òý˳ÐòÓëÊý¾ÝÎïÀíÅÅÁÐ˳ÐòÎ޹ء£¾ÙÀýÀ´Ëµ£¬Äã·­µ½Ð ......

תÔصÄһƪsqlserverÎÄÕÂ

¹«Ë¾×éÖ¯SQLˮƽ¿¼ÊÔ£¬¿´ÁËд½Ì²Ä£¬Ð´Á˵ã×ܽᷢÉÏÀ´¸ú´ó¼Ò·ÖÏí¡£
ÎÒ¹«Ë¾Ê¹ÓõÄÊÇSybase ASE12.5£¬ËùÒÔÏÂÃæµÄһЩÌØÐÔÊÇÕë¶ÔSybase ASEµÄ¡£
Ò»£ºSQL Bisic
1£ºSQL(Structured Quary Language)ÌØÐÔ£º
a£º±ê×¼»¯
b£º·Ç¹ý³Ì»¯µÄ
c£º¿ÉÓÅ»¯µÄ
d£ºÃæÏò¼¯ºÏ²Ù×÷µÄ
2£ºASEÖеÄÊý¾ÝÀàÐÍ
a£ºNumberic
b£ºCharacter
c£ºDa ......

SQLServer ±í²éѯÖÐµÄ ºÏ²¢²éѯ ºÏ¼¯ ²î¼¯ ½»¼¯

use tempdb
go
if (object_id ('t1' ) is not null ) drop table t1
if (object_id ('t2' ) is not null ) drop table t2
go
create table t1 (a int )
insert into t1 select 1 union select 2 union select 3
create table t2 (a int )
insert into t2 select 3 union select 4 union select 5
go
sele ......

Mysql£¬SqlServer£¬OracleÖ÷¼ü×Ô¶¯Ôö³¤µÄÉèÖÃ


Mysql£¬SqlServer£¬OracleÖ÷¼ü×Ô¶¯Ôö³¤µÄÉèÖÃ
1¡¢°ÑÖ÷¼ü¶¨ÒåΪ×Ô¶¯Ôö³¤±êʶ·ûÀàÐÍ
ÔÚmysqlÖУ¬Èç¹û°Ñ±íµÄÖ÷¼üÉèΪauto_incrementÀàÐÍ£¬Êý¾Ý¿â¾Í»á×Ô¶¯ÎªÖ÷¼ü¸³Öµ¡£ÀýÈ磺
create table customers(id int auto_increment primary key not null, name varchar(15));
insert into customers(name) values("name1"),("nam ......

SQLServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î(ת)

SQL ServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î
1. ԭʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹Øϵ
¡¡¡¡¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à¶Ô¶àµÄ¹Øϵ¡£ÔÚÒ»°ãÇé¿öÏ£¬ËüÃÇÊÇÒ»¶ÔÒ»µÄ¹Øϵ£º¼´Ò»ÕÅԭʼµ¥¾Ý¶ÔÓ¦ÇÒÖ»¶ÔÓ¦Ò»¸öʵÌå¡£ÔÚÌØÊâÇé¿öÏ£¬ËüÃÇ¿ÉÄÜÊÇÒ»¶Ô¶à»ò¶à¶ÔÒ»µÄ¹Øϵ£¬¼´Ò»ÕÅԭʼµ¥Ö¤¶ÔÓ¦¶à¸öʵÌ壬»ò¶àÕÅԭʼµ¥Ö¤¶ÔÓ¦Ò»¸öʵÌå¡£ÕâÀïµÄʵÌå¿ÉÒÔÀí½âΪ»ù±¾±í¡£Ã ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ