April 15, 2008 at 3:34 am
Im try to select some record between two date but i dont understand why my sintax is not correct.
The comand is:
"Select count(*) from FILENAME where SUBSTRING(FIELD1,19,4) > 2005 AND TIPCON = '1' and DATA between '2008-03-01' and '2008-03-31'"
why is not working ???????
thank you in advance
Alberto.
April 15, 2008 at 6:51 am
Check your structure. I created a structure like this:
CREATE TABLE dbo.FileName
(
tipcon INT
,data DATETIME
,field1 VARCHAR(25)
)
And your query ran just fine. No syntax errors. Are you sure you ahve a column called Field1?
SELECT COUNT(*)
FROM FILENAME
WHERE SUBSTRING(FIELD1, 19, 4) > 2005
AND TIPCON = '1'
AND DATA BETWEEN '2008-03-01' AND '2008-03-31'
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
April 15, 2008 at 6:51 am
The BETWEEN is fine.
What error message are you getting?
April 15, 2008 at 6:53 am
now is ok.....
i forget to put ' on the sql string !!!!
thank you very much !!!!!!!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply