Click here to Skip to main content
15,899,563 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
When I am trying to create a table using SQL Server 2008 DataCenter Server R2 I cannot use the SQL 'Date' datatype for a Data Column but the query was executed with an error that giving the date format is not a available data type. It also not appeared at the table design. But when I refer some books I found that there is a new data type in SQL Server 2008.

I don't know how to solve this matter! Please be kind to solve this!
Posted

1 solution

I have no idea what you mean, but instead of Date use DateTime[^] data column, for example:
SQL
CREATE TABLE Table1 ([Date] DATETIME)
INSERT INTO Table1 ([Date]) VALUES('2012-05-23')
SELECT [Date] FROM Table1


Some useful links:
T-SQL data types[^]
CREATE TABLE[^]
ALTER TABLE[^]
 
Share this answer
 
Comments
VJ Reddy 23-May-12 20:55pm    
Good answer. 5!
Maciej Los 24-May-12 4:10am    
Thank you, VJ ;)
Chiranthaka Sampath 4-Jul-12 6:06am    
No ma friend I mean can I create a table like in the following statement in sql server 2008

CREATE TABLE EMP(EMPNO VARCHAR(6),ENAME VARCHAR(50),EADDRESS VARCHAR(50),DATE_OF_JOINED DATE, PRIMARY KEY(EMPNO))

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900