HI
I have a date in sql dB as 1998-12-14
I want to convert it to below and I am using below code but getting error, can you help?
Where EFFDT >= CONVERT(varchar, Convert(datetime,'14-12-1998 00:00:00'),101)
HI
I have a date in sql dB as 1998-12-14
I want to convert it to below and I am using below code but getting error, can you help?
Where EFFDT >= CONVERT(varchar, Convert(datetime,'14-12-1998 00:00:00'),101)
What datatype is EFFDT? (please post create statement)
EFFDT is a date:
SELECT TOP (10) EFFDT
FROM dbo.[EMPL_HIST
Where EFFDT >= CONVERT(varchar, Convert(datetime,'14-12-1998 00:00:00'),101)
Hope this helps.
Thanks,
Then you can use:
select top(10)
effdt
from dbo.ps_dm_empl_hist_vw
where effdt>=cast('1998-12-14' as date)
Thanks but this is what I get still the same: its not Converted? I want it like this--> 14-12-1998 dd-mm-yyyy
1998-12-14
1998-12-19
2003-03-17
select top(10)
convert(varchar,effdt,105)
from dbo.ps_dm_empl_hist_vw
where effdt>=cast('1998-12-14' as date)
Thanks It works I had to do set it up in select .
Thanks so much!
Watch out for the default size when when using VARCHAR. Better to specify the size you want, rather than to get in the habit of using the default and then getting caught out.
Press option (next to the smiley) and choose hide details or do this:
[ details="Query"]
Blah blah blah
[/details]
Thanks for tips!