September 8, 2006 at 1:35 pm
hi
the clause :
EXEC mySy
works when i create the synonym by :
create synonym mySy for [database].[schema].[storedProc]
but fails when i create it by :
create synonym mySy for [SERVER_NAME].[database].[schema].[storedProc]
when the pointed object is a table, there is no problem ( both ways )
anybody knows WHY ? ???
THANKS
--
atte,
Hernán
September 8, 2006 at 2:39 pm
Four-part names for function base objects are not supported in Creation of Synonymns
-- BOL
September 8, 2006 at 3:31 pm
thanks gopi,
but,
if i right click the synonym
then "Include as" and then "CREATE To"
the script that i get
contains a "four-part names"
September 8, 2006 at 3:42 pm
But I am able to create a synonym for a SP and successfully executed that SP using synonym in SQL 2005
CREATE
SYNONYM [dbo].[SynTest]
FOR
[W-IKCRH5C3\GOPINATH].[GOPI_LAB].[dbo].[sp_User_Indexes]
September 12, 2006 at 8:03 am
the problem is when i [exec synonym_to_sp]
inside another [sp] in another db
THIS SCRIPT REPRODUCES THE BEHAVIOR
-- in db_A
use
db_A
create
procedure dbo.sp_test
@par varchar(10),
@out varchar(10) output
as
print @par
set
@out= @par
go
-- in db_B
use
db_B
create synonym sy_sp_test for usr01.frba.dbo.sp_test
-- create synonym sy_sp_test for usr01.frba.dbo.sp_test
go
create
procedure dbo.sp_test
as
declare
@returned varchar(10)
exec
sy_sp_test 'hello', @out= @returned output
go
-- NOW , TEST IT ON DATABASE db_B
sp_test
September 12, 2006 at 8:15 am
excuse me
the synonym must point to "db_A" ( for this example )
not to "USR01" ( that is my actual environment )
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply