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 |
|
Torch
Starting Member
20 Posts |
Posted - 2005-07-14 : 04:17:55
|
| I have the following OPEN XML statement in my stored procedureEXEC sp_xml_preparedocument @idoc OUTPUT, @xmlINSERT INTO [dbo].GroupChild( GroupID, ChildGroupID)SELECT *FROM OPENXML (@idoc, '/GroupChilds/GroupChild', 1)WITH (GroupID int, ChildGroupID int)EXEC sp_xml_removedocument @idocHowever the "GroupChild" table is in another database. The database name is passed in as a paramter to the stored procedure. How can I use this parameter in this stored procedure - I keep getting syntax errors.Torch |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-07-14 : 11:36:15
|
| You might have to insert into a temporary table (from the XML), but then you can doSET @strSQL = 'INSERT INTO ' + @MyDatabaseName + '.dbo.GroupChild SELECT * FROM MyTempTable'EXEC (@strSQL)You might even be able to do that, directly, in the INSERT phrase of your OPENXML statement [using dynamic SQL of course] (Never tried it!)Kristen |
 |
|
|
|
|
|