Registered member login:
Register Now
Altirigos » Altiris Administrators » Reports » Need some SQL expertise

» Current Poll
Do you leave the Aclient enabled?
YES - 83.05%
196 Votes
NO - 16.95%
40 Votes
Total Votes: 236
You may not vote on this poll.
» Stats
Members: 9,948
Threads: 12,158
Posts: 56,984
Top Poster: Nick (4,991)
Welcome our newest member, rmerrill
» Online Users: 37
0 members and 37 guests
No Members online
Most users online at once 294, 06-30-2007 at 12:24 PM.
» July 2010
S M T W T F S
27282930 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Reply
Old 08-25-2008, 04:29 PM   #1 (permalink)
 
Status: Junior Altiris Admin
Join Date: 08-31-2006
Location: Dallas
Age: 42
Posts: 25


Need some SQL expertise

I'm trying to create a Warranty Report where I input the date range I want to serach on and I get back all the machines with warranties ending in that date range.

I'm getting this error message I just can't get around:

Code:
  Sql error in query. Error: System.Data.SqlClient.SqlError: Conversion failed when converting datetime from character string.Sql CommandText: -- MAX ROWCOUNT SET ROWCOUNT 50000 -- SELECT T0.[Name] AS 'Computer Name', T2.[Computer Model] AS 'Computer Model', T1.[Warranty end date] AS 'Warranty end date' FROM [Inv_AeX_AC_Identification] T0 INNER JOIN [Inv_AeX_HW_Serial_Number] T2 ON T0.[_ResourceGuid] = T2.[_ResourceGuid] INNER JOIN [Inv_Warranty_End_Date] T1 ON T0.[_ResourceGuid] = T1.[_ResourceGuid] WHERE T1.[Warranty end date] >= 'BeginDate' AND T1.[Warranty end date] <= 'EndDate' ORDER BY T2.[Computer Model] ASC, T1.[Warranty end date] ASC

Here is the query:

Code:
SELECT T0.[Name] AS 'Computer Name', T2.[Computer Model] AS 'Computer Model', T1.[Warranty end date] AS 'Warranty end date' FROM [Inv_AeX_AC_Identification] T0 INNER JOIN [Inv_AeX_HW_Serial_Number] T2 ON T0.[_ResourceGuid] = T2.[_ResourceGuid] INNER JOIN [Inv_Warranty_End_Date] T1 ON T0.[_ResourceGuid] = T1.[_ResourceGuid] WHERE T1.[Warranty end date] >= 'BeginDate' AND T1.[Warranty end date] <= 'EndDate' ORDER BY T2.[Computer Model] ASC, T1.[Warranty end date] ASC
I have defined Global Parameters BeginDate and EndDate as date/time. I have tried the various formats as well, from Short to Long to Custom.

When I remove the WHERE part of the query, the query does return results, but of course that negates the parameters.

When the results do come back for the Warranty End Date, it comes out as mm/dd/yyyy hh:mm:ss AM

I'm guessing this has something to do with it, but since I'm a bit of a dummy on SQL, I'm not sure.

Any assistance would be greatly appreciated.

Last edited by john_quinn75013; 08-25-2008 at 04:30 PM.. Reason: spell check
john_quinn75013 is offline   Reply With Quote
Old 08-25-2008, 04:53 PM   #2 (permalink)
 
KOldfield1983's Avatar
 
Status: Junior Altiris Admin
Join Date: 08-18-2006
Location: Dallas, TX
Posts: 21


You need to add % to the following:

T1.[Warranty end date] >= '%BeginDate%'
AND
T1.[Warranty end date] <= '%EndDate%'
KOldfield1983 is offline   Reply With Quote
Old 08-25-2008, 05:07 PM   #3 (permalink)
 
Status: Junior Altiris Admin
Join Date: 08-31-2006
Location: Dallas
Age: 42
Posts: 25


You da man..

That was the problem.

Thanks for the quick response.

now all I gotta do is get the warranty data loaded in....
john_quinn75013 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -4. The time now is 05:57 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
vB.Sponsors
Altirigos