SQL Views - Variables


CREATE VIEW VW_X
AS

WITH MyVars (AnoInit, AnoEnd)
  AS (
SELECT
  2010 AS 'AnoInit',
  (SELECT TOP 1 AnoLetivo FROM TB_Anos) AS 'AnoEnd'
  )

SELECT
              AnoX,
              (SELECT AnoInit  FROM MyVars) as AnoInit,
             (SELECT AnoEnd  FROM MyVars) as AnoEnd
 FROM TABLE


GO

Comments

Popular posts from this blog

Download file from input type file javascript

POST an array of objects with $.ajax to C# WebMethod