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.
Author |
Topic |
karthick.amace
Starting Member
23 Posts |
Posted - 2010-08-10 : 05:36:16
|
Hi bros, I need help, How to insert the dates vertically from 1-Jul-2010 to 31-Jul-2010 in separate table by giving the condition in where clause BETWEEN '1-Jul-2010' and '31-Jul-2010'.Thanks Karthick------------------------------------------------------"Desire makes what you wants to do" |
|
Sachin.Nand
2937 Posts |
Posted - 2010-08-10 : 05:43:51
|
[code]declare @tbl as table(fromdt datetime,todt datetime)insert into @tblselect '1-july-2010','31-july-2010';with cteas(select fromdt,todt,fromdt as yourdate from @tblunion allselect t.fromdt,t.todt,dateadd(dd,1,c.yourdate)from @tbl tinner join cte c on t.todt>=dateadd(dd,1,c.yourdate))select yourdate into #temp from cteselect yourdate from #tempdrop table #temp[/code]Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
karthick.amace
Starting Member
23 Posts |
Posted - 2010-08-18 : 07:49:44
|
can anybody explain me about this...as new bie it is hard to understand------------------------------------------------------"Desire makes what you wants to do" |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-08-18 : 09:54:16
|
This won't help, but I gotta:I thought the whole point was to get your date HORIZONTAL. * ba-doom ching *Thanks, I'm here all week, try the veal. |
 |
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-08-18 : 09:59:02
|
quote: Originally posted by robvolk This won't help, but I gotta:I thought the whole point was to get your date HORIZONTAL. * ba-doom ching *Thanks, I'm here all week, try the veal.
ROFL  |
 |
|
|
|
|
|
|