→ Celebrate SysAdmin Day 2024 with Lansweeper Enter our Giveaway here

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
GreenCup
Engaged Sweeper II
tblAssetCustom.WarrantyDate returns datetime

ie.
10/11/2012 00:00:00

the time is returned as zeros for all assets. How can I call the column and get just the date without the time returned to the report?
1 ACCEPTED SOLUTION
Hemoco
Lansweeper Alumni
Use an expression like the one below.
Convert(nvarchar,tblAssetCustom.WarrantyDate,101)

View solution in original post

5 REPLIES 5
Hemoco
Lansweeper Alumni
Sample case:
Case when tblAssetCustom.Warrantydate is null then 'Unknown' when tblAssetCustom.Warrantydate < GetDate() then 'Expired' else 'In Warranty' end As [Warranty Status]
GreenCup
Engaged Sweeper II
Thanks!!

Here is another SQL query question...

I want a column, As Warranty Status, in a report that states "In Warranty" or "Expired"

This is the statement I have in mind:
If tblAssetCustom.WarrantyDate is less than Today put "Expired" As [Warranty Status]
Else put "In Warranty" As [Warranty Status]

Is there a way to accomplish this?
GreenCup
Engaged Sweeper II
GreenCup wrote:
Thanks!!

Here is another SQL query question...

I want a column, As Warranty Status, in a report that states "In Warranty" or "Expired"

This is the statement I have in mind:
If tblAssetCustom.WarrantyDate is less than Today put "Expired" As [Warranty Status]
Else put "In Warranty" As [Warranty Status]

Is there a way to accomplish this?


Managed to figure out

Case when tblAssestCustom.Warrantydate < GetDate() then 'Expired' else 'In Warranty' end As [Warranty Status]
GreenCup
Engaged Sweeper II
GreenCup wrote:


Managed to figure out

Case when tblAssestCustom.Warrantydate < GetDate() then 'Expired' else 'In Warranty' end As [Warranty Status]


This brings another issue to the table,
If the warranty date is unknown and blank in the report, it returns In Warranty to the report. Any suggestions on returning a 3rd value when the warranty date is unknown?
Hemoco
Lansweeper Alumni
Use an expression like the one below.
Convert(nvarchar,tblAssetCustom.WarrantyDate,101)