Hi !
I am new with SQL and TSQL
I want to collect rows between two a start time and a end time.
The time is in a textstring, like filename_wast_erth1_20070506_1812_all.txt
I cannot use any other time in the database when i collect data!
The database looks like this (almost anyway)
FILENAME nvarchar(255) TIME
filename_wast_erth1_20070506_1812_all.txt 2007-01-16 10:36:15
filename_wast_erth1_20070506_1812_all.txt 2007-01-16 10:36:20
filename_wast_erth1_20070506_1813_all.txt 2007-01-16 10:36:25
filename_wast_erth1_20070506_1815_all.txt 2007-01-16 10:36:35
filename_wast_erth1_20070506_1815_all.txt 2007-01-16 10:36:45
filename_wast_erth1_20070506_1818_all.txt 2007-01-16 10:37:05
I trying to do like this:
SELECT
,@theState
= CONVERT(char(20),DATE,20),@id
= ID,@temp11filename
= SUBSTRING(FILENAME, 21,4)+ '-'+ SUBSTRING(FILENAME, 25,2)+'-'+SUBSTRING(FILENAME, 27,2)+' '+ SUBSTRING(FILENAME, 30,2)+ ':'+ SUBSTRING(FILENAME, 32,2)+':00',@filename
= FILENAMEFROM
DELIVERYWHERE
@temp11filename BETWEEN @theEndTime AND @theCurTimeORDER
BY ID DESC;END
This result in no data
Anyone with a idea how to do it