Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I need to create a stored procedure usp_run_written_premium where I only use year portion of the POL_EFF_DATE as a parameter..I know that I can write CREATE usp_run_written_premium @date datetime as.....but with this declaration I will need to enter month,day, and year when I run the script I would like to run the the procedure like suchusp_run_written_premium '2009'
James K
Master Smack Fu Yak Hacker
3873 Posts
Posted - 2013-05-28 : 10:22:10
Change the signature of your stored proc to:
CREATE usp_run_written_premium @year int AS....
Then change the code in the stored proc appropriately, for example:
WHERE POL_EFF_DATE >= DATEADD(yy,@year-1900,0) AND POL_EFF_DATE < DATEADD(yy,@year-1899,0)