sql server - Data from last 13 months -


I have a table in the SQL Server 2008 database in which the column is 'month', nvarchar dataTip, where data is stored Formats 'January 2013', 'February 2013', 'March 2013' and so on 'March 2014'.

Now I want the data from March 2013 to March 2014 in my result, but I am not able to get it.

It is trying where segment: WHERE (month> DATEAD (month, DATEDIFF (year, 0, gaterate ()) - 13, 0)) Error giving failed to convert conversion date and / or time with string of characters.

I have also tried to rename the data as 'March 2014' and well for other entries, but this is not helping either.

Dear SQL experts, please help!

you can do something like

  from SELECT * Table where not in LEFT (month, 3) ('jane', 'feb') and right (month, 4) = '2013' (or '(' John ',' fab ')), 4) =' 2014 ')  

If you want to include March 2014, then March 2013 will not be, but in March 2014, the last part of the posterior part will have to change (LEFT ( Month, 3) ('Jan', 'Fab', 'Mar') and Right (Month, 4) = '2 014') But I recommend that you date your date Store as


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -