title: ODBC function for calendar week?
body: <p>Question on ODBC functions:</p>
  
  <p>I need to get the ISO 8601 calendar week from a SQL datetime.
  In SQL-Server, the syntax for that is this:</p>
  
  <pre><code>SELECT DATEPART(ISO_WEEK, GETDATE()) 
  </code></pre>
  
  <p>in SQL server 2005, ISO_WEEK doesn't exist, so I have to use a function like this:
  <a href="http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/iso-week-in-sql-server" rel="nofollow">http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/iso-week-in-sql-server</a> </p>
  
  <p>Now my question: 
  In order to keep it database-independant, 
  is it possible to get the <strong>ISO-calendar week</strong> via a <strong>ODBC</strong> function ?</p>
  
  <p>ODBC-Functions like this (except getdate of course):</p>
  
  <pre><code>SELECT 
   GETDATE() AS vT_SQL_DateTime_NonDeterministic_Function 
  
  ,{ fn NOW() } AS vODBC_DateTime_Canonical_Function 
  ,{ fn CURDATE() } AS vODBC_DateOnly_Canonical_Function 
  ,CAST(FLOOR(CAST(GETDATE() AS float)) AS datetime) AS vFloor_Mine 
  ,CONVERT(char(8),  { fn NOW() }, 112) AS v112_ISO 
  ,CONVERT(char(10), { fn NOW() }, 104) AS v104_Thomas 
  ,{ fn CONVERT({fn CURDATE()}, SQL_DATE)} AS vODBC_Proper 
  
  -- Testing ODBC functions &amp; syntax
  ,{ fn CONCAT('abc', 'def')} AS ODBC_Concat
  ,{ fn CONCAT(NULL, 'def')}  AS ODBC_Concat_NullLeft
  ,{ fn CONCAT('abc', NULL)}  AS ODBC_Concat_NullRight
  ,{ fn CONCAT(NULL, NULL)}   AS ODBC_Concat_NullBoth
  ,{ fn LENGTH('abc')}    AS ODBC_Length
  ,{ fn UCASE('abc')} AS ODBC_UCASE
  ,{ fn LCASE('ABC')} AS ODBC_LCASE
  ,{ fn SUBSTRING('Test me', 1, 4)} AS ODBC_SUBSTRING 
  ,{ fn LOCATE('in', 'needle in the haystack')}  AS ODBC_Locate 
  ,{ fn SUBSTRING('Test me', 1, { fn LOCATE(' me', 'Test me') } - 1)} AS ODBC_SUBSTRING_Locate
  </code></pre>