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 save, delete, get, and list objects for a table

By llt,

exec usp_DBA_createSPs 'MyTable', 'tmp', 'col1, col2'
creates
proc_tmp_MyTable_save - does update if row exists (based on key) and insert if none. returns ID of row updated/inserted
proc_tmp_MyTable_delete delete (based on key) with insert to deleted table
fTbl_tmp_MyTable_get - no paging, with "where" templates for each parameter type
fTbl_tmp_MyTable_list - provide paging

 

I have written this script while back. I have used one of the scripts I have found online.Sorry I do not remember where I've got script originally

It was changed by adding more logic to SP, adding functions, as well as fixing size limitation and other bugs.

Total article views: 162 | Views in the last 30 days: 1
 
Related Articles
FORUM

Insert / Deletes

Insert / Deletes

FORUM

insert scripts

insert scripts

FORUM

Optimizing inserts and deletes on a single large table

Optimizing inserts and deletes

FORUM

Script to delete orphaned users

Script to delete orphaned users

FORUM

Delete tables script

How to delete tables using scripts

Tags
t-sql    
 
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