Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Date Part

Author  Topic 

Da_Retina
Posting Yak Master

109 Posts

Posted - 2002-02-05 : 09:12:51
Salute..
How can I strip the date part of the smalldatetime data type?..and drop the time part?
Salute..
-----------------------------------------------
If I am to do it...I will, and will do it fast.

Nazim
A custom title

1408 Posts

Posted - 2002-02-05 : 09:58:40
Check for Convert Funcion in BOL.


--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page

Spyder
SQLTeam Author

75 Posts

Posted - 2002-02-10 : 03:33:26
quote:
How can I strip the date part of the smalldatetime data type?..and drop the time part?


I think this might work for you... I've included two examples depending on whether you want your final outcome to be in VARCHAR or SMALLDATETIME.

DECLARE @mydate SMALLDATETIME
SET @mydate = GETDATE()
SELECT CONVERT(VARCHAR(10),@mydate,101)
SELECT CAST(CONVERT(VARCHAR(10),@mydate,101) AS SMALLDATETIME)



Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-02-10 : 03:51:38
Somebody is on prowl

--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page

Spyder
SQLTeam Author

75 Posts

Posted - 2002-02-11 : 19:09:41
quote:
Somebody is on prowl


well you see, graz threatened me with physical violence if I didn't start posting more...



Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-02-11 : 23:45:51
Ah! thts so nice of graz. Man he has a eye for Talent !
quote:

well you see, graz threatened me with physical violence if I didn't start posting more...




--------------------------------------------------------------
"Happiness is not something you experience, it's something you remember."
Go to Top of Page
   

- Advertisement -