How to Get Sql sever 2000 WeekFirstDay and WeekLastDay...
2006-09-22 23:09
661 查看
Public Function GetWeekFirstDay() As String
'Last week day set by Sunday
'Sunday is week first day -1
'Monday is week first day 0
'......1,2,3,4
Dim sql As String
sql = "SELECT convert(varchar(10),DATEADD(wk, DATEDIFF(wk,0,getdate()), -1),121) as WeekFirstDay "
Dim ds As DataSet = iobj_sql.GetRowsByQuery(sql)
Return ds.Tables(0).Rows(0).Item("WeekFirstDay")
End Function
Public Function GetWeekLastDay()
'Last week day set by Saturday
Dim sql As String
sql = "SELECT convert(varchar(10),DATEADD(wk, DATEDIFF(wk,0,getdate()), -1)+6,121) as WeekFirstDay "
Dim ds As DataSet = iobj_sql.GetRowsByQuery(sql)
Return ds.Tables(0).Rows(0).Item("WeekFirstDay")
End Function
'Last week day set by Sunday
'Sunday is week first day -1
'Monday is week first day 0
'......1,2,3,4
Dim sql As String
sql = "SELECT convert(varchar(10),DATEADD(wk, DATEDIFF(wk,0,getdate()), -1),121) as WeekFirstDay "
Dim ds As DataSet = iobj_sql.GetRowsByQuery(sql)
Return ds.Tables(0).Rows(0).Item("WeekFirstDay")
End Function
Public Function GetWeekLastDay()
'Last week day set by Saturday
Dim sql As String
sql = "SELECT convert(varchar(10),DATEADD(wk, DATEDIFF(wk,0,getdate()), -1)+6,121) as WeekFirstDay "
Dim ds As DataSet = iobj_sql.GetRowsByQuery(sql)
Return ds.Tables(0).Rows(0).Item("WeekFirstDay")
End Function
相关文章推荐
- How to Get Sql sever 2000 WeekFirstDay and WeekLastDay...
- How to Get First and Last Day of a Week in SQL Server
- 【SQL】How to get First and Last day of a Year – TSQL
- 【SQL】How to get First and Last day of a month – TSQL
- How to Get First and Last Day of a Month in SQL Server
- SQL - How to get the current day, month and year
- CodeSnip: How to Get Id of the Record Using ASP.NET and SQL Server 2000
- How to install Windbg and get your first memory dump
- How to monitor blocking in SQL Server 2005 and in SQL Server 2000 [ZT-MS]
- python get this week days and last week day maybe help for you
- How to write a first class paper and get it published in a scientific journal?
- How to configure Win2003 Cluster, SQL 2000 CLuster, IIS Cluster and Exchange 2003 CLuster
- How to read and save Images in a Sql Server Database using ADO.NET and C#
- How to get download games hack cheat tools to get coins ,Diamonds and money in games
- How to get the value of a form element : check box and radio button
- VBS Get Sql Server Table Data and Export to CSV File...
- How to get up and running with Apparat
- Working on your thesis: how to get started and how to keep it going?
- How to get your very own RStudio Server and Shiny Server with DigitalOcean
- How to get URL and QueryString value in an ASP.NET page