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

SQLʱ¼ä¶Î²éѯ


SQLʱ¼ä¶Î²éѯ
ACCESSµÄ»°
select * from table where date1<#2008-1-20# and date2>#2007-8-30#
MYSQLµÄ»°
select * from table where date1<'2008-1-20' and date2>'2007-3-30'
Ò²¿ÉÒÔ
select * from table where date1 between '2008-1-20' and '2007-3-30'
ÆäÖÐdate1,date2¶¼ÊÇÈÕÆÚÀàÐ͵Ä×Ö¶Î
sQLʱ¼äÐͲéѯÓï¾ä
2007Äê12ÔÂ04ÈÕ ÐÇÆÚ¶þ 13:54
select * from jy_jjgl a ,jy_jygl b where convert(varchar(10),a.shtime,120)='2007-11-27'
1.ÏÔʾ±¾ÔµÚÒ»Ìì
SELECT DATEADD(mm,DATEDIFF(mm,0,getdate()),0)
select convert(datetime,convert(varchar(8),getdate(),
120)+'01',120)
2.ÏÔʾ±¾ÔÂ×îºóÒ»Ìì
select dateadd(day,-1,convert(datetime,convert
(varchar(8),dateadd(month,1,getdate()),120)+'01',120))
SELECT dateadd(ms,-3,DATEADD(mm,DATEDIFF(m,0,getdate())+1,0))
3.ÉϸöÔµÄ×îºóÒ»Ìì
SELECT dateadd(ms,-3,DATEADD(mm,DATEDIFF(mm,0,getdate()),0))
4.±¾ÔµĵÚÒ»¸öÐÇÆÚÒ»i
select DATEADD(wk,DATEDIFF(wk,0, dateadd(dd,6-datepart(
day,getdate()),getdate())),0)
5.±¾ÄêµÄµÚÒ»Ìì
SELECT DATEADD(yy,DATEDIFF(yy,0,getdate()),0)
6.±¾ÄêµÄ×îºóÒ»Ìì
SELECT dateadd(ms,-3,DATEADD(yy,DATEDIFF(yy,0,getdate())+1,0))
7.È¥ÄêµÄ×îºóÒ»Ìì
SELECT dateadd(ms,-3,DATEADD(yy,DATEDIFF(yy,0,getdate()),0))
8.±¾¼¾¶ÈµÄµÚÒ»Ìì
SELECT DATEADD(qq,DATEDIFF(qq,0,getdate()),0)
9.±¾ÖܵÄÐÇÆÚÒ»
SELECT DATEADD(wk,DATEDIFF(wk,0,getdate()),0)
10.²éѯ±¾ÔµļǼ
select * from tableName where DATEPART(mm, theDate)
=DATEPART(mm, GETDATE()) and DATEPART(yy, theDate)
= DATEPART(yy, GETDATE())
11.²éѯ±¾ÖܵļǼ
select * from tableName where DATEPART(wk, theDate) = DATEPART
(wk, GETDATE()) and DATEPART(yy, theDate) = DATEPART(yy, GETDATE())
12²éѯ±¾¼¾µÄ¼Ç¼ ×¢£ºÆäÖÐ:GETDATE()ÊÇ»ñµÃϵͳʱ¼äµÄº¯Êý¡£
select * from tableName where DATEPART(qq, theDate) = DATEPART
(qq, GETDATE()) and DATEPART(yy, theDate) = DATEPART(yy, GETDATE())
13.»ñÈ¡µ±ÔÂ×ÜÌìÊý:
select DATEDIFF(dd,getdate(),DATEADD
(mm, 1, getdate()))
select datediff(day,
dateadd(mm, datediff(mm,'',getdate()), ''),
dateadd(mm, datediff(mm,'',getdate()), '1900-0


Ïà¹ØÎĵµ£º

Asp.netÓëSQLÒ»Æð´ò°ü²¿Êð°²×°


Õû¸öSQLºÍAsp.net(vb.net)Ò»Æð´ò°üµÄÈ«¹ý³ÌдһÏ¡£
Ò».×¼±¸±ØÒªµÄÎļþ
1. SQL½Å±¾Îļþ£¬Éú³ÉÒÔºó°²×°¹ý³ÌÖÐÐèÒªµÄ±íºÍ´æ´¢¹ý³ÌµÈµÈ£»
Éú³ÉÖ®ºó£¬¾ÍÔÝʱ°ÑËüÃüÃûΪdb.sql(×¢Òâ´óСд)
2.LisenceFile.rtfµÄ°²×°Îļþ£¬ÒòΪÎÒµÄϵͳÊǸöÈ˵ģ¬¶øÇÒfreeµÄ£¬ËùÒÔ¾ÍûÓÐ×ö¡£Õâ¸öÒÔºóÒ²ÊÇÒªÓõ½µÄ¡£
¶þ.ÔÚ×Ô¼ºÏÖÓеÄÏîÄ¿Àïà ......

SQL ServerÈÕÆÚ

---Ò»¸öÔµĵÚÒ»Ìì
SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0) 
--- ±¾ÖܵÄÐÇÆÚÒ»
SELECT DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
---Ò»ÄêµÄµÚÒ»Ìì
SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
----¼¾¶ÈµÄµÚÒ»Ìì
SELECT DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)
----ÉϸöÔµÄ×îºóÒ»Ìì
......

SQL Server 2008 ×èÖ¹±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä


MS SQL Server 2008 ÔÚ½¨Íê±íºó£¬Èç¹ûÒª²åÈëÈÎÒâÁУ¬ÔòÌáʾ£º
µ±Óû§ÔÚÔÚSQL Server 2008ÆóÒµ¹ÜÀíÆ÷Öиü¸Ä±í½á¹¹Ê±£¬±ØÐëÒªÏÈɾ³ýÔ­À´µÄ±í£¬È»ºóÖØд´½¨ÐÂ±í£¬²ÅÄÜÍê³É±íµÄ¸ü¸Ä£¬Èç¹ûÇ¿Ðиü¸Ä»á³öÏÖÒÔÏÂÌáʾ£º²»ÔÊÐí±£´æ¸ü¸Ä¡£ÄúËù×öµÄ¸ü¸ÄÒªÇóɾ³ý²¢ÖØд´½¨ÒÔÏÂ±í¡£Äú¶ÔÎÞ·¨ÖØд´½¨µÄ±ê½øÐÐÁ˸ü¸Ä»òÕßÆôÓÃÁË“× ......

OracleÖÐSQL PLUSµÄ³£ÓÃÖ¸Áî

½øÈësql*plusÐèÒªÊäÈëÓû§Ãû¡¢¿ÚÁîºÍÖ÷»ú±êÖ¾·û
system/manager
sys/change_on_intall
scott/tiger
internal/oracle
ÒÔÉÏΪ³õʼÃÜÂë
Ö÷»ú×Ö·û´®¿Õ»òÕßÊÇ@+ÄãµÄ·þÎñÃû,ÔÚ±¾µØµÇ½²»ÐèÒª±¾µØ·þÎñÃû¡£
ÏÂÃæ¾Í½éÉÜÒ»ÏÂһЩ³£ÓõÄsql*plusÃüÁ
Ê×ÏȲ鿴µ±Ç°Ê¹ÓõÄÊý¾Ý¿âʵÀý:
select name from V$database;
Çл»Á½¸ö ......

SQLÁÙʱ±í

ÁÙʱ±í¾ÍÊÇÄÇЩÃû³ÆÒÔ¾®ºÅ (#) ¿ªÍ·µÄ±í¡£Èç¹ûµ±Óû§¶Ï¿ªÁ¬½ÓʱûÓгýÈ¥ÁÙʱ±í£¬SQL Server ½«×Ô¶¯³ýÈ¥ÁÙʱ±í¡£ÁÙʱ±í²»´æ´¢ÔÚµ±Ç°Êý¾Ý¿âÄÚ£¬¶øÊÇ´æ´¢ÔÚϵͳÊý¾Ý¿â tempdb ÄÚ¡£
ÁÙʱ±íÓÐÁ½ÖÖÀàÐÍ£º
±¾µØÁÙʱ±í
ÒÔÒ»¸ö¾®ºÅ (#) ¿ªÍ·µÄÄÇЩ±íÃû¡£Ö»ÓÐÔÚ´´½¨±¾µØÁÙʱ±íµÄÁ¬½ÓÉϲÅÄÜ¿´µ½ÕâЩ±í£¬Á´½Ó¶Ï¿ªÊ±ÁÙʱ±í¼´±»É¾³ý ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ