How to write stored procedure to update the data in 10
tables

Answer Posted / vaishali

create procedure proc_name
{
@para1 varchar(20),
@para2 varchar(20),
}
AS
Declare @sql varchar(8000)
Set @sql="update table1 set col1='value' where
col2='"+@para1+"'\n"
Set @sql=@sql+ "update table2 set col1='value' where
col2='"+@para2+"'\n"

Exec(@sql)

Is This Answer Correct ?    10 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What functions can a view be used to performed?

610


What is resource governor?

536


Explain the etl (extraction, transformation, and loading)?

552


What is the difference between upgrade and migration in sql server?

583


Explain what is the use of custom fields in report?

491






What are the properties of the transaction?

535


How to reaname table name without using sp_Rename in sql server..?

525


What are a database and a data warehouse?

561


Why it is recommended to avoid referencing a floating point column in the where clause?

532


What are the different ways you can create databases in sql server?

562


Describe different Processing Modes offered by SSRS?

164


Explain try...catch with sql server?

592


We need to perform what steps in the following order to work with a cursor?

704


How to delete duplicate rows from table except one?

540


Once setting replication, is it potential to own a publisher as sixty four bit sql server and distributor or subscribers as a thirty two bit sql server?

542