all groups > sql server dts > october 2007 >
You're in the

sql server dts

group:

Date format


Date format FAHIM
10/1/2007 12:46:00 PM
sql server dts:
HI friends,



Using SmallDateTime in SQL Table, how can I enforce M/DD/YY format on
column of type smalldatetime in SQL ServerDB.

What happening is that SQL convert this to YYYY-MM-DD, when my DTS
package brings data to table?

Note : output of DTS package is MM/DD/YY format.


Thanks,
Re: Date format Russell Fields
10/2/2007 12:00:00 AM
Fahim,

From the Books Online: smalldatetime values as two 2-byte integers. The
first 2 bytes store the number of days after January 1, 1900. The other 2
bytes store the number of minutes since midnight.

So, smalldatetime actually has no format. However, when you SELECT it is
converted to a string for display purposes. This format is controlled by
your language and locale, but you can make it into a more useful format by:

select convert(nvarchar(30), getdate(),1) -- returns MM/DD/YY

Or you can use the DATEPART and DATENAME functions to build your own format.

RLF


[quoted text, click to view]

AddThis Social Bookmark Button