Forum Moderators: coopster
In my SQL statement this snippet of code is giving me error:
[/CODE]
... DATEPART(m, Changedate) ...
more statements...
[/CODE]
I looked at online docs -Microsoft, the syntax is correct as far as I could tell, but this is where the SQL errors out...
The variable Changedate is a date and time column as:
2003-11-30 00:00:00
Any ideas?
What is confusing is if I have code like this:
mssql_select_db ("Change");
$result = mssql_query ("SELECT Changedate as tim, COUNT(Changedate) as total
from ChangeItems
where Changedate = '2004-06-08 00:00:00' ");
mssql_close($link);while ($row=mssql_fetch_assoc($result)) {
$tim['tim'] = ($row['tim']);
$val['total'] = ($row['total']); }
print_r($tim);
print_r($val);
Nothing comes back
If I do :
mssql_select_db ("Change");
$result = mssql_query ("SELECT Changedate as tim, '100' as total
from ChangeItems
where Changedate = '2004-06-08 00:00:00' ");
mssql_close($link);while ($row=mssql_fetch_assoc($result)) {
$tim['tim'] = ($row['tim']);
$val['total'] = ($row['total']); }
print_r($tim);
print_r($val);
I get a dump of variables.
What gives?
By the way no error comes back just empty browser, even though I have E_ALL enabled.