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 |
|
Nate
Starting Member
17 Posts |
Posted - 2002-03-14 : 12:22:10
|
| I am creating an archive program for a SQL 2000 database. In it I am creating cursors in a stored procedure for both the old and the new database. I am trying to dynamically pass in the archive database's name because this will be used at numerous clients who are using this database. When I try to dynamically create a cursor with the variable that I have passed into the stored procedure it gives me an error.I have tried this:Select @SQL = 'CURSOR SCROLL DYNAMIC FOR Select * From 'Select @SQL = @SQL + @DestinationDatabaseSelect @SQL = @SQL + '.t_InvoiceType'Set @ArchiveCursor = @SQLand Select @SQL = 'Select * from 'Select @SQL = @SQL + @DestinationDatabaseSelect @SQL = @SQL + '.t_InvoiceType'Set @ArchiveCursor = CURSOR SCROLL DYNAMIC FOR @SQLThe error message is: 'Error 206: Operand Type Clash: Varchar is incompatible with cursor'There doesn't seem to be any built-in functions to set which database the cursor is being created from in a dynamic way.Can anyone help me?Thanks. |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2002-03-14 : 16:15:34
|
| http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=13889===============================================Creating tomorrow's legacy systems today.One crisis at a time. |
 |
|
|
|
|
|