Showing posts with label storedprocedure. Show all posts
Showing posts with label storedprocedure. Show all posts

Thursday, March 22, 2012

Access another SQL Server inside of a stored procedure

Is it possible to access another SQL server when inside a stored
procedure? I would like to select some data in one database and then
insert that data into another database on a different SQL server. Is
that possible? Examples?
Thanks!
-JohnYes, it is possible. See "sp_addlinkedserver" in BOL.
AMB
"John Baima" wrote:

> Is it possible to access another SQL server when inside a stored
> procedure? I would like to select some data in one database and then
> insert that data into another database on a different SQL server. Is
> that possible? Examples?
> Thanks!
> -John
>

Tuesday, March 6, 2012

About the presence of alter procedure?

Is it a good practice to leave the alter procedure statement in a stored
procedure? Does it affect the execution in any way? Is it common to comment
the statements out until needed again?
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/I'm a bit . Where would you remove it from? Once the procedure is
altered, the "ALTER" is not really there anymore.
To illustrate this, try the following on your end:
CREATE PROCEDURE proc_x
AS
RETURN
GO
ALTER PROCEDURE proc_x
AS
RETURN 1
GO
SELECT ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME = 'proc_x'
GO
DROP PROCEDURE proc_x
GO
--
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"clintonG" < csgallagher@.REMOVETHISTEXTmetromilwaukee
.com> wrote in message
news:utDcT6WnGHA.1592@.TK2MSFTNGP04.phx.gbl...
> Is it a good practice to leave the alter procedure statement in a stored
> procedure? Does it affect the execution in any way? Is it common to
> comment the statements out until needed again?
> --
> <%= Clinton Gallagher
> NET csgallagher AT metromilwaukee.com
> URL http://www.metromilwaukee.com/clintongallagher/
>