Question: I have many `varchar` YYYY-mm values in my table : 

[![enter image description here](https://i.stack.imgur.com/OhtND.png)](https://i.stack.imgur.com/OhtND.png)

But now I need days in Month from this. 

> 
> I need the result: 2018-04 -> 30 Days
> 
> 
> 

So how I can achieve this?

I thank you in advance!

Answer: 
You can use `eomonth()`:

```
select day(eomonth(convert(date, yyyymm + '-01')))

```

[Here](https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=4be2dbb3aa77fd7d0ef478bb414c6657) is a db<>fiddle for doubters.
The eomonth() function does the job :)