如何从SQL获取Today的数据 [英] How to get the Today's data from SQL
问题描述
嗨团队,
我有一个SQL Server 2008.
我创建了一个表格几列包括日期。
我的表格如下: -
名称28/04/2013 29 / 04/2013 30/04/2013时间...... ......
我需要的是如何选择今天名称和日期的所有信息?
例如
名称28/04/2013 29/04/2013 30/04 / 2013年时间...... ......
xx 123 667 233 11:00 ...... ......
yy 888 666 55 09:00 .. ......
i需要查询哪个值将获得name = = xx和当前日期'的coloumn值的所有值。
我的输出应该是今天30-04-2013
xx 233 11:00
i使用vb.net作为前端
请帮助我。
试试这个:
SELECT * FROM 表1 WHERE CONVERT ( DATE , CONVERT ( DATETIME ,YourColumnName, 103 ))= CONVERT( DATE ,GETDATE()) AND Name = ' YourParameter'
--Amit
Hi team,
I have an SQL Server 2008.
I have created table with few columns including date.
my table looks like:-
Name 28/04/2013 29/04/2013 30/04/2013 Time .. ... ...
What i need is how do i select all information where name and date is today?
for example
Name 28/04/2013 29/04/2013 30/04/2013 Time .. ... ...
xx 123 667 233 11:00 .. ... ...
yy 888 666 55 09:00 .. ... ...
i need to query which will get all values where name is = to xx and current date''s coloumn value.
my output should be like for today 30-04-2013
xx 233 11:00
i use vb.net as front end
Please help me.
Try this:
SELECT * FROM Table1 WHERE CONVERT(DATE,CONVERT(DATETIME, YourColumnName, 103))=CONVERT(DATE, GETDATE()) AND Name='YourParameter'
--Amit
这篇关于如何从SQL获取Today的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!