Back to list
Views:   4.4K
Replies:  1

Executing CTE from VB.Net From Dynamic Parameter

I am having below mentioned CTE in SQL Server 2012. and want to execute the same in  ON BUTTON Click event 
Where Start date and End Date Will Come From Datetimepickers ...Please Help on the same

WITH cte as(
 SELECT  [Status], [Date], [Time], CAST([Date] as datetime) + CAST([Time] As datetime) As [datetime] 
  FROM MyTable 
  WHERE [Date] >= @StartDateAND [Date] <= @EndDate) 
    SELECT  [Status], [Date], [Time], 
            CASE WHEN [Date] = LAG([Date]) OVER (ORDER BY [datetime]) THEN 
                 CAST(DATEADD(MINUTE, DATEDIFF(MINUTE, LAG([datetime]) 
                 OVER (ORDER BY [datetime]), [datetime]), '00:00:00') as time)         
            END AS TimeDifferenceFROM cte

Lalit Acharekar, Mar 19, 2016
Reply 1
Are you using the SPARK ORM or ADO.NET, Entity Framework, NHibernate, or something else?

We can get you some sample code in SPARK. Any other technology you'll find ample examples on the internet. 
Just let us know. 

Jack Poorte, Apr 04, 2016
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.