Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: 172 | 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