Stored Procedure to create Insert statements in MySql ??
Posted
by karthik
on Stack Overflow
See other posts from Stack Overflow
or by karthik
Published on 2010-05-04T08:06:24Z
Indexed on
2010/05/04
23:08 UTC
Read the original article
Hit count: 288
I need a storedprocedure to get the records of a Table and return the value as Insert Statements for the selected records.
For Instance, The stored procedure should have three Input parameters...
1- Table Name
2- Column Name
3- Column Value
If
1- Table Name = "EMP"
2- Column Name = "EMPID"
3- Column Value = "15"
Then the output should be, select all the values of EMP where EMPID is 15 Once the values are selected for above condition, the stored procedure must return the script for inserting the selected values.
The purpose of this is to take backup of selected values. when the SP returns a value {Insert statements}, c# will just write them to a .sql file.
I have no idea about writing this SP, any samples of code is appreicated. Thanks..
© Stack Overflow or respective owner