Home
Manage Your Code
Snippet: convert ((int)year,(int)month,(int)day) to Datetime (SQL)
Title: convert ((int)year,(int)month,(int)day) to Datetime Language: SQL
Description: convert ((int)year,(int)month,(int)day) to Datetime Views: 469
Author: Pragnesh Patel Date Added: 12/1/2011
Copy Code  
SELECT
   CAST(
      CAST(year AS VARCHAR(4)) +
      RIGHT('0' + CAST(month AS VARCHAR(2)), 2) +
      RIGHT('0' + CAST(day AS VARCHAR(2)), 2) 
   AS DATETIME)
Usage
convert ((int)year,(int)month,(int)day) to Datetime
Notes
convert ((int)year,(int)month,(int)day) to Datetime