how to create a table using date data type
i am getting error during creating table
create table mrf(fr date);


error: cannot find data type date

Dani AI

Generated

— the error reported in the thread commonly points to a server-version mismatch. As asked, identifying the database engine was the right first step; since SQL Server was confirmed, the most likely reason the DATE type was not found is that the instance predates the DATE datatype (DATE was added in SQL Server 2008). ’s suggestion to use a datetime-family column is the standard workaround on older servers.

The server version string indicates whether DATE is available; it can be obtained with:

SELECT @@VERSION;

If the returned string shows SQL Server 2008 or later, the standalone DATE type can be used — see Microsoft’s reference on date/time types: . On pre-2008 servers the pragmatic options are to keep using datetime/smalldatetime or to upgrade/apply current updates so DATE is supported. Note that switching between datetime and DATE can drop the time component and affect comparisons, stored values, and indexes, so any schema change should be validated against application logic and queries. If the environment is actually PostgreSQL (the thread tag implies that possibility), PostgreSQL supports DATE natively: Date/Time Types.

Recommended Answers

All 5 Replies

Could you please post your code and tell, which DB you're using.

i am using sql server
i just tried 2 create table with field of datatype date
create table mrf(fr date);

Use

create table sample 
(
    testdate datetime
)

You have opened too many threads.

Mark the thread as Solved if you get solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.