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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-07-05 : 10:55:25
|
| Phill writes "hi, i have tried to return rows using this bit of code i got from 4GuysFromRolla.com:----------------------------------------------------Eric, Yep, you can use the EXEC command to do this. In addition to prefixing stored procedure calls, this command can be used to execute a SQL statement in a string or a string variable. I've included a sample stored proc below... CREATE PROC Foo @stringpassedASBEGIN DECLARE @SQL varchar(100) SET @SQL = 'SELECT * FROM table WHERE idno IN ' + @stringpassed EXEC(@SQL)END You can find more information in SQL Server books online. Sean ---------------------------------------------------------I have 2 questions - 1. how do you return this to an ADODB recordset?i have tried to simply do this:Set rs= Cm.Executebut the recordset remains closedi noticed when running the stored procedureno rows are returned.i am using SQL 7.0 sp4, VB 6.0, Win20002. where can i find more info in the SQL server books online? i cant seem to find any info on using EXEC within a stored procedure" |
|
|
M.E.
Aged Yak Warrior
539 Posts |
Posted - 2002-07-05 : 11:03:11
|
| Thats dynamic SQL your using their actually.. try looking it up.For an ADODB record set... open it alsmot the same as you would with a select statement but instead of select * from .... where column in '"&whatevaYaWant&"'"you will useexec FOO @stringpassed = '"&whatevaYaWant&"'"-----------------------Take my advice, I dare ya |
 |
|
|
|
|
|