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 |
|
madmaiden
Starting Member
1 Post |
Posted - 2008-01-08 : 08:22:14
|
| HelloI am new in this forum, so is there are references for my topic just send me the link.What I am trying to do, is a Stored Procedure under SqlServer2005 where the paramerts should be used as part of the table name.the select shloud look something like:SELECT @p1.@p1FROM @p1,...etcWHERE @p1.id_@p1=@p2p1 and p2 are validalid....so let's say i got 1 table named "NAMES"and it has the columns "NAMES" and "ID_NAMES"SELECT NAMENS.NAMESFROM NAMESWHERE NAMES.ID_NAMES=3 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-01-08 : 08:28:38
|
quote: Originally posted by madmaiden HelloI am new in this forum, so is there are references for my topic just send me the link.What I am trying to do, is a Stored Procedure under SqlServer2005 where the paramerts should be used as part of the table name.the select shloud look something like:SELECT @p1.@p1FROM @p1,...etcWHERE @p1.id_@p1=@p2p1 and p2 are validalid....so let's say i got 1 table named "NAMES"and it has the columns "NAMES" and "ID_NAMES"SELECT NAMENS.NAMESFROM NAMESWHERE NAMES.ID_NAMES=3
You should avoid passing object names as parameterMake sure you read this fullywww.sommarskog.se/dynamic_sql.htmlMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|