From: Muhammad Bilal on
Hi.

I want to set gatdate() as a default to a column of datatype datetime in sql
server 2000 but in format DD/MM/YYYY.

I have used (RIGHT('0' + RTRIM(DAY(GETDATE())), 2) + '/' + RIGHT('0' +
RTRIM(MONTH(GETDATE())), 2) + '/' + RTRIM(YEAR(GETDATE())))
but this is not working properly.


Regards,
Muhammad Bilal

From: Gert-Jan Strik on
If the column has data type datetime, then there is no need to convert
the date to char.

You can use something like this:

DATEADD(day,DATEDIFF(day,0,CURRENT_TIMESTAMP),0)

--
Gert-Jan


Muhammad Bilal wrote:
>
> Hi.
>
> I want to set gatdate() as a default to a column of datatype datetime in sql
> server 2000 but in format DD/MM/YYYY.
>
> I have used (RIGHT('0' + RTRIM(DAY(GETDATE())), 2) + '/' + RIGHT('0' +
> RTRIM(MONTH(GETDATE())), 2) + '/' + RTRIM(YEAR(GETDATE())))
> but this is not working properly.
>
> Regards,
> Muhammad Bilal
From: jgurgul on
Hi,

I would advise using date or datetime and doing the formating in the front
end as strongly typed data is easy to work with.

SELECT CONVERT(VARCHAR(8),GETDATE(),03)

"Muhammad Bilal" wrote:

> Hi.
>
> I want to set gatdate() as a default to a column of datatype datetime in sql
> server 2000 but in format DD/MM/YYYY.
>
> I have used (RIGHT('0' + RTRIM(DAY(GETDATE())), 2) + '/' + RIGHT('0' +
> RTRIM(MONTH(GETDATE())), 2) + '/' + RTRIM(YEAR(GETDATE())))
> but this is not working properly.
>
>
> Regards,
> Muhammad Bilal
>