There is no format within T-SQL. It is just a date time value. The formatting is applied at clients. If you are using correct data types, formatting is never an issue within your database code. Your clients that are querying your database, such as a reporting tool, or web application, and so on, should handle all formatting.

Remember that CONVERT does not "apply formatting". It converts. So, what was once a sortable, comparable, calculatable datetime value now becomes a meaningless string. that is why we don't try to make things "look pretty" within the database, we focus on storing clean, raw, accurate date of the proper type, which any client tools can easily format any what that it wants.

There is no format within T-SQL. It is just a date time value. The formatting is applied at clients. If you are using correct data types, formatting is never an issue within your database code. Your clients that are querying your database, such as a reporting tool, or web application, and so on, should handle all formatting.

Remember that CONVERT does not "apply formatting". It converts. So, what was once a sortable, comparable, calculatable datetime value now becomes a meaningless string. that is why we don't try to make things "look pretty" within the database, we focus on storing clean, raw, accurate date of the proper type, which any client tools can easily format any what that it wants.

There is no format within T-SQL. It is just a date time value. The formatting is applied at clients. If you are using correct data types, formatting is never an issue within your database code. Your clients that are querying your database, such as a reporting tool, or web application, and so on, should handle all formatting.

Remember that CONVERT does not "apply formatting". It converts. So, what was once a sortable, comparable, calculatable datetime value now becomes a meaningless string. that is why we don't try to make things "look pretty" within the database, we focus on storing clean, raw, accurate date of the proper type, which any client tools can easily format any what that it wants.

quote:Select should not change format, how can i return datetime in same format as table?

Again, I cannot make this clear enough: IF YOU ARE USING DATETIME TO STORE YOUR DATA, THERE IS NO "FORMAT" USED TO STORE YOUR DATA.

I apologize for "yelling", but, again, this is a crucial, fundamental concept to understand.

So -- where you outputting this data? THAT is where the formatting is applied, by the client that is selecting data from the database. And that client is where you need to alter this, if it allows you to, if you don't like the way things "look".

Again, the tool he is using (SSMS) is dsplaying the data according to the regional settings at the computer where he is running the query (depending in the settings in SSMS).

There is no such "value" as 2008-03-25 18:57:56.000 in the database either!The date is stored as a decimal (example 43186.43252222222). THIS IS THE VALUE ANY OTHER RDBMS sees and accepts.Then that RDMS displays the data in a "human readable form".

And that's why you often get misplaced data when transferring from/to access because date "zero" in sql server is January 1, 1900 and in MS Access the zero date is "Dec 30, 1899".