Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
subhaoviya
Posting Yak Master
135 Posts |
Posted - 2011-02-08 : 23:25:55
|
| Hi friends, Currently i am using 4 tables for logging purposes. for insertion in to that table am using 4 diff procedures by straight away quering the table name and insert query inside the procedure. is it possible to make it in generic way? by passing the table name as an parameter to procedure?.thankssubha. |
|
|
Sachin.Nand
2937 Posts |
Posted - 2011-02-09 : 00:21:31
|
| Yes by using dynamic SQL.PBUH |
 |
|
|
Coolganny
Starting Member
3 Posts |
Posted - 2011-02-09 : 22:17:00
|
| You can either usea) dynamic sql orb) if statementsto achieve the same in 1 Stored procedureGanesh Ravi |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-10 : 03:42:29
|
quote: Originally posted by subhaoviya Hi friends, Currently i am using 4 tables for logging purposes. for insertion in to that table am using 4 diff procedures by straight away quering the table name and insert query inside the procedure. is it possible to make it in generic way? by passing the table name as an parameter to procedure?.thankssubha.
Passing table name is not a good method. Use four insert statements in a single procedureMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|