Hello all,
I'm trying to run a query to make a report. My database is a incident
reporting database. I'm tryng to make a monthy report for incidents.
The field I need to query in the date field which is a nvarchar in the
form of 01/01/04 and 01/01/2004. I ran a query that looks like this:
SELECT incident, doccur, ID
FROM dbo.Incident
WHERE (doccur between '01/01/2004' and '01/31/2004')
I get some results that look like this:
Unsecured doors 01/19/04 92
INTOXICATION 01/17/04 77
Bill Door entry door 01/28/03 130
Hit & Run 01/21/04 105
Customer complaint 01/02/03 70
Customer complaint 01/02/04 91
PRINTER MALFUNCTION 01/22/04 111
Customer complaint 01/30/04 2322
Trash Smoldering 01/15/04 51
LOST 01/02/03 80
BROKEN GLASS PANEL 01/13/04 42
B.I.A. Assist 01/04/03 189
GAS LEAK 01/06/04 8
UNCHANGED CASH BOX 01/11/04 40
Intoxication 01/17/04 69
Intoxication 01/02/04 71
Intoxication 01/17/04 72
Employee accident 01/17/04 73
GREASE FIRE 01/18/04 74
Verbal Dispute 01/17/04 75
PANHANDLING 01/17/04 76
Near Miss/Water backup 01/18/04 78
Unsecured Arcade Door 01/19/04 93
Intoxication 01/18/04 79
Intoxication 01/02/04 81
SUSPECT/WANTED 01/18/04 82
Intoxication 01/18/04 83
Property Damage 01/20/03 84
Unsecured Bingo Snack Bar 01/18/04 85
PANHANDLING 01/18/04 86
Employee accident 01/19/04 87
Unauthorize of proper exit 01/19/04 88
Safety Hazard 01/19/04 89
Key control violation 01/02/03 90
Cracked keno ball 01/23/04 116
Employee accident 01/19/04 94
delay in drop 01/27/2003 128
test 01/01/2005 3763
As you can see, the querey will give me the month and day I ask for,but
not the right year. Some to the data has 2 digit years and some have 4
digits. How do I design the query to give me the year I ask for.
Any assistance will be greatly appreciated