Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Generate Insert/Update/Delete Sprocs for a table

By well0549,

A week ago I posted this script. It was a much simpeler version without error checking. Now all the sprocs return the same errors.

    0 THERE WERE NO ERRORS
  -99 UNEXPECTED NR OF RECORDS AFFECTED
  0 THE SQL ERROR NUMBER

Also with the insert statement the @ID is set. So you can retrieve the Identity of the last row inserted.

The construct with the returnvalue could be simpeler but then we could not use it with the .net applicationblocks.

This script will generate Insert,Update,Delete,Get stored procedures for a given table.

It will only work if the Primary key is also an Identity field.

If you like it vote for it.......

Total article views: 359 | Views in the last 30 days: 4
 
Related Articles
FORUM

Bulk insert error

Bulk insert error

FORUM

Bulk Insert batch error

Bulk Insert batch error

FORUM

Bulk Insert error logging

Bulk Insert Task error logging

FORUM

Insert fail Data Type Error Fix??

Insert fail type error suggestions

ARTICLE

Error logging with Bulk Insert

Bulk Insert statement has an important feature of error logging which is rarely used.

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones