I have a query similar to this:
REPLACE(CONVERT(VARCHAR(10), GETDATE(), 112) + CONVERT(VARCHAR(10), GETDATE(), 108),':','') as datenum
WHERE datenum BETWEEN 20071001094734 AND 20080901094734
Problem is I get the error 'Invalid column name 'datenum'.
If I take the where line out, it works fine.
Can anyone get this wo work with the where clause included?
Could anyone change it so that he value of datenum is numeric? I get errors when i put it into another convert statement.
The format of the date and time is important so cant be changed.