Hi All, I have been struggling with issue from quite a few days. I dont want to read any data from any form. My SQL Query is dynamic. It does not pull data from any table.
Select distinct DATEADD(wk, DATEDIFF(wk,0,DATEADD(day, z.num, '2007/09/18')), 0) firstDayOfWeek FROM ( SELECT b10.i + b9.i + b8.i + b7.i + b6.i + b5.i + b4.i + b3.i + b2.i + b1.i + b0.i num FROM (SELECT 0 i UNION ALL SELECT 1) b0 CROSS JOIN (SELECT 0 i UNION ALL SELECT 2) b1 CROSS JOIN (SELECT 0 i UNION ALL SELECT 4) b2 CROSS JOIN (SELECT 0 i UNION ALL SELECT 8) b3 CROSS JOIN (SELECT 0 i UNION ALL SELECT 16) b4 CROSS JOIN (SELECT 0 i UNION ALL SELECT 32) b5 CROSS JOIN (SELECT 0 i UNION ALL SELECT 64) b6 CROSS JOIN (SELECT 0 i UNION ALL SELECT 128) b7 CROSS JOIN (SELECT 0 i UNION ALL SELECT 256) b8 CROSS JOIN (SELECT 0 i UNION ALL SELECT 512) b9 CROSS JOIN (SELECT 0 i UNION ALL SELECT 1024) b10 ) z WHERE z.num <= DATEDIFF(day, '2007/09/18', '2007/10/18') Result: 2007-09-17 00:00:00.000 2007-09-24 00:00:00.000 2007-10-01 00:00:00.000 2007-10-08 00:00:00.000 2007-10-15 00:00:00.000 I tried to do this in SQL itself so that it returns me a single row of a comma seperated values, but i was not able to do that. I need this result 2007-09-17 00:00:00.000 2007-09-24 00:00:00.000 2007-10-01 00:00:00.000 2007-10-08 00:00:00.000 2007-10-15 00:00:00.000 in a table field OR 2007-09-17 00:00:00.000, 2007-09-24 00:00:00.000, 2007-10-01 00:00:00.000, 2007-10-08 00:00:00.000, 2007-10-15 00:00:00.000 in a char field. Environment: ITSM 7.0.1 SQL Server 2000 Windows 2003 server. Please help me to resolve this one. Regards, Veeral Oza, Application Developer, Column Technologies, Cell: 224-587-0765 Desk: 847-632-3327 _______________________________________________________________________________ UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the Answers Are"

