Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I don't know about parameterized stored procedure

What I have tried:

I tried using function but i don't know how to write using stored procedure.
Posted
Updated 6-Jan-23 21:44pm
Comments
PIEBALDconsult 7-Jan-23 10:23am    
A function is a better choice.

1 solution

They are easy: very similar to a function but they can modify the database but can't be used in SELECT statements.

Start here: SQL Stored Procedures[^]

Do note that you should only ever call GETDATE once in a lump of code and save the result for further use: if you call it multiple times the value you get could be very different between successive calls: at the end of a year for example, one call may return 2022-12-31 and the second 2023-01-01. This can lead to some really nasty intermittent errors that are every hard to track down and repair the damage to your DB!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900