Using openrowset to connect directly to another database without a linked server and execute a stored procedure

1
2
SELECT *
FROM OPENROWSET('SQLOLEDB',database_location;username;password, 'set fmtonly off exec database.dbo.stored_Procedure') AS Whatever

The above piece of code is self-explanatory. I’ve only used this in SQL 2005 though, so if it doesn’t work on SQL 2000 don’t come crying to me.

Replace database_location with the IP/Destination of the server you’d like to connect to
Replace username/password with… well… do I really have to explain this?
Replace database with the catalog/database you’d like to query
Replace stored_Procedure with the stored procedure you’d like to execute
The “As Whatever” is necessary. You could name this anything you’d like.

I’ve used the above to query a database directly for data extraction/manipulation. You could go as far as to inner join this in your normal queries if you’re not doing an update/add cursor loop on this.

Enjoy. Took me a while to figure it out :)

How to read a remote queue with System.Messaging

February 14, 2009 by AcidRaZor · Leave a Comment
Filed under: .NET, MSMQ, Programming 101 

Seeing as this “feature” is undocumented (or seem to be) on MSDN and most tutorials you’ll find out there reads and writes to private local queues, I thought I’d share how you’d write or read to a remote queue using System.Messaging :

1
msmqqueue.Path = "FormatName:Direct=TCP:127.0.0.1\Private$\queuename"

I hope this information proves valueble for someone that might need it and can’t find any documentation anywhere else.

SEO Powered by Platinum SEO from Techblissonline