sql - Stored Procedure to Insert the result of a parameterized OPENQEURY into a local table -


So this is "funny", and by "funny" I mean psychology. I have managed:

  • Get feed parameters for OPENQUERY and get results like this:

      Declare @ MyStstring varchar (max), Set the @TheDateAfter datetime set @TheDateAfter = DATEADD (D, 1, @TheDate) @ MyString = 'Select from ORACLEDB'. "'+ @TheTable +'" WHERE "EDITTIME" & gt; To_date ('' convert (varchar (30), @dateet, 120) + '' ',' 'YYYY-MM-DD HH24: MI: SS' ') and "editor" To_date ('convert' (varchar (30), @ that off, 120) + '' ',' 'YYYY-MM-DD HH 24: MI: SS' ')' set migrating = n'sell * from openquire (      P> In many ways the results Return, which includes a stored procedure that takes my parameters:  
      sp_get_Deltas @TheDate = '1/2/03', @TheTable = 'Table'  

But I am unable to include these results in a table. I think that if I am in the form of a table I can get Sprak returns, but the solution I found changes the query in the string and putting those results into a table only results in errors.

The second thing I tried was string Was to insert the "insert" part, but it throws errors about "labels already used", or that the Oracle Provider has my SQL Tables I was not allowed to write here.

  Announce @Mystring varchar (maximum), set @TheDateAfter datetime set @TheDateAfter = DATEADD (D, 1, @TheDate) @ MyString = [insert in HO-RS1]]. [Dtas]. [DBO]. ['+ @TheTable +'] Choose "OracleDeb" from "'+ + TheTable +'" WHERE "EDITTIME" & gt; To_date ('' convert (varchar (30), @dateet, 120) + '' ',' 'YYYY-MM-DD HH24: MI: SS' ') and "editor" To_date ('convert' (varchar (30), @ that off, 120) + '' ',' 'YYYY-MM-DD HH 24: MI: SS' ')' set migrating = n'sell * from openquire ( LINKEDSERVER, '' '+ REPLACE (@MyString,' '', '' '+) +' '') Exec (@MyString)  

I tried some other things That I did not think that would work, just to rule them:

  Put in the dinet. Choose TABLE * from sp_get_Deltas @TheDate = '1/2/03', 'TheTable'  

... and such many stubborn stuff.

Can anyone show me how the results of the first query "Daltas .... ...." statement?

I know that I am close, but for some time I am wandering in the circle and I feel that I am stepping on my tail.

Thank you!

You are almost there, it works for common stored procedures, see that it works for SP , Which inserts into arbitrary OPENQUERY

  dalants. DELTAS.TABLE EXEC sp_get_Deltas @TheDate = '1/2/03', 'TheTable'  

Of course the column list with the EXEC must match the target table.

If you get errors please post them.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -