What is the default data format in MSSQL Server? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

What is the default data format in MSSQL Server?

Hi, What is the default data format in MSSQL Server?? How to change the default data format ?? Regards,
Sri
What do u mean by default data format? Please elaborate…. Gaurav
Moderator
Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard

Hi,
if i insert a date value like this
INSERT INTO XX VALUES (101,’11-30-2000′) SQL stores 1894-07-11 00:00:00.000 like this Why ?? i want it like this 11-30-2000 dd/mm/yyyy Regards
Sri
U can use convert function to get the desired output. Ex:- select convert(varchar(13),getdate(),103) And also see convert function for more info in Sql server books online. Rushendra
quote:Originally posted by ks9072 SQL stores 1894-07-11 00:00:00.000 like this Why ??
why? because it is an absolute format.
You can always convert it to the format you want. convert(varchar(10), date_field, 105)) will get you the format
you asked for. For other formats check BOL. Bambola.
Can i insert into the table like this ??
insert into xx values (convert(datetime,’30-12-2003′,103) Sri
there is no need to convert the value when you insert. You just convert it when you want to desplay it.
when you insert it, if possible go with ‘2003-12-30’ and you will never get an overflow error. Bambola.
Can i change the data format yyyy/mm/dd to dd/mm/yyyy ? meaning i want to insert date like dd/mm/yyyy Sri
Let me ask you something: why is it so important to you to insert the data in this format (dd/mm/yyyy)? Bambola.
Hi, We are using oracle database all developers are used to see date format is mm/dd/yy in oracle, now we want to migrate to MSSQL server, if they query the database for date they see yyyy/mm/dd I think it looks odd Regards,
Sri

Check SET DATEFORMAT in BOL and let me know if it what you needed. Bambola.
SQL server default date format is the same as
sitting on Computer on which sql was installed I decided for myself that the best keep datetime fields in varchar format like this
yyyymmddhhmmsssmmm
that way you will be safe from all those horible mistakes when month became a day and day became a month

hello. talking of date What convert i have to do to rest to dates and takes it in seconds: date_end – date_init = seconds If anyone know how do that, please say me. Thank you.
You should use the DATEDIFF function select datediff(second, date_init, date_end) Bambola.
]]>