ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Query to Convert VARCHAR to DATETime and add months in SQL Server<p>Hi <a class="username" rel="smile"> smile</a>,</p> <p>Refer below sample query.</p> <p><strong><span style="text-decoration: underline;">SQL</span></strong></p> <pre class="brush: sql">DECLARE @Test AS TABLE(UserID VARCHAR(10),Pass VARCHAR(50),SDate VARCHAR(10)) INSERT INTO @Test VALUES(&#39;abc&#39;,&#39;sky@abc&#39;,&#39;19.10.2018&#39;) INSERT INTO @Test VALUES(&#39;sky&#39;,&#39;abc@sky&#39;,&#39;21.10.2018&#39;) SELECT UserID,Pass,SDate,CONVERT(VARCHAR, DATEADD(MONTH,1,CONVERT(DATETIME, SDate, 103)), 104) NextDate FROM @Test</pre> <p><strong><span style="text-decoration: underline;">Output</span></strong></p> <table border="1"> <tbody> <tr> <td>UserID</td> <td>Pass</td> <td>SDate</td> <td>NextDate</td> </tr> <tr> <td>abc</td> <td>sky@abc</td> <td>19.10.2018</td> <td>19.11.2018</td> </tr> <tr> <td>sky</td> <td>abc@sky</td> <td>21.10.2018</td> <td>21.11.2018</td> </tr> </tbody> </table>https://www.aspforums.net:443/Threads/697464/Query-to-Convert-VARCHAR-to-DATETime-and-add-months-in-SQL-Server/https://www.aspforums.net:443/Threads/697464/Query-to-Convert-VARCHAR-to-DATETime-and-add-months-in-SQL-Server/Fri, 19 Oct 2018 01:05:50 GMT