Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I want to create a table which contain on col datewhich contail all weekday date from 8/7/2006 to 12/14/2007the table should look like:date8/7/20068/8/20068/9/20068/10/20068/11/20068/14/2006----12/14/2006Thanks
Lamprey
Master Smack Fu Yak Hacker
4614 Posts
Posted - 2008-01-08 : 16:45:09
here is a select statement to get the dates you want. I'll leave the actual table creation and insert statement up to you (or sometone else).
SELECT DISTINCT DATEADD(DAY, number, '8/7/2006') AS DateFROM Master.dbo.spt_valuesWHERE number between 0 and 494ORDER BY DATEADD(DAY, number, '8/7/2006')
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)