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 |
|
dineshk
Starting Member
5 Posts |
Posted - 2004-12-10 : 07:48:27
|
| Hi, is it possibletp execute a sql statement in extended stored procedure.Dinesh K |
|
|
dineshk
Starting Member
5 Posts |
Posted - 2004-12-10 : 07:56:39
|
| i am using sql server 2000 |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-12-10 : 08:02:51
|
| I believe so, buy why would you do that? It's likely to cause more problems than it solves. |
 |
|
|
dineshk
Starting Member
5 Posts |
Posted - 2004-12-10 : 08:15:21
|
| i need to perform this taskselect col1 from tab1 t1 , tab2 t2 where t1.col2=tab2.col2in the above statement i need to replace tab2 with out replacing the above statement. insted of tab2 i need a function or anything else which takes a 'sql statement' and execute the statement so that it returns a table. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-12-10 : 08:37:24
|
| What about dynamic SQL? Don't need an extended procedure at all:http://www.sqlteam.com/searchresults.asp?SearchTerms=dynamic+sql |
 |
|
|
dineshk
Starting Member
5 Posts |
Posted - 2004-12-10 : 08:55:17
|
| how will it return a table to replace tab2 |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-12-10 : 09:21:19
|
| When you say "replace", do you mean the name of the table, or the results that are in that table? Can you provide an example of what you're trying to do? |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-12-10 : 10:28:01
|
| also, typically this is caused by a bad DB design. your data should not come from different tables, if it is of the same type. The table itself in a join should be a constant, but the rows you return should be what changes from call to call of your procedure.Do you have 1 table per customer or something like that?- Jeff |
 |
|
|
|
|
|