Quick SQL Server Tip – Creating your Insert Stored Procedure

When I start to create the insert stored procedure for an existing database table I used to always start by copying an existing stored procedure (for the template only purpose) and then empty the contents of the stored procedure, then I would right-click on the table and then select, script table as ‘Insert’ from the menu options as shown below:-

Insert into a table

This template always kind of annoyed me as I felt it never laid it out very well, only last week did someone point out that the best thing to do is to actually just type inside your stored procedure:-

INSERT INTO and then press Enter

This will generate the insert and also tell you the column types and sizes for variables such as varchar(s) as shown below, including putting in default dates.

Insert syntax

That’s it for now.