Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

TO get firstday of the Month!!

$
0
0

Hi,
Am trying to give dynamic date to SP that would be first of every month. 5/01/2013 for this month can any one help me with the sql expression? i was trying with this but it is not applicable for other months.

declare
@date date
select
@date=CAST(MONTH(GETDATE()) AS VARCHAR(2))+'/'+CAST('01' AS varchar(3))
+
'/'+CAST(YEAR(GETDATE()) AS VARCHAR(4))
print @date

Thanks,


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>