Re: Linked server strangeness in SQL 2005 Mgmt Studio
- From: "Russell Fields" <russellfields@xxxxxxxxxx>
- Date: Fri, 10 Aug 2007 10:07:29 -0400
David and Charles,
OK, I think I see what is going on here. Here is how to correlate what the
two of you are seeing. Suppose that I create a linked server with this
command.
EXEC master.dbo.sp_addlinkedserver @server = N'TalkToOtherDB', @srvproduct =
N'',
@provider=N'SQLNCLI', @datasrc=N'SQL001', @catalog=N'OtherDB'
When from Object Explorer you Script Linked Server As ... Create To you get
the following script which does not specify @srvproduct and will return the
error "'(null)' is an invalid product name." Therefore, there is an
inconsistent behaviour between the data that you can script into SQL Server
and the inaccurate script generated by SQL Server Management Studio.
EXEC master.dbo.sp_addlinkedserver @server = N'TalkToOtherDB',
@provider=N'SQLNCLI', @datasrc=N'SQL001', @catalog=N'OtherDB'
If I do the following select, you can see that sysservers.srvproduct is not
NULL.
SELECT name AS srvname, COALESCE(product, '*******') AS srvproduct
FROM sys.servers WHERE name = 'TalkToOtherDB'
srvname srvproduct
------------- ----------
TalkToOtherDB
So, even though the srvproduct was correctly set to a Zero-Length String,
the scripting is treating that string like a NULL and is not including the
@srvproduct in the script. (You have probably also found that you cannot
type a blank or a long string of blanks into the New Linked Server window,
since it will complain about NULL.)
Charles's example is where he actually typed, not a blank, nor a zero-length
string, but two single-quote characters. That explains why his example
script includes: @srvproduct=N''''''
Are we now on the same wavelength? (David, if you go back to setting
@srvproduct = 'SQL' (but not 'SQL Server') or even @srvproduct = 'David', it
should script properly.)
RLF
"Charles Wang[MSFT]" <changliw@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:6SYlxly2HHA.5204@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi David,
I collaborated with my colleague to perform a more careful test and we
reproduced one of your described issues.
As you mentioned that if we input "SQL Server" as the "Product Name", once
we opened the linked server properties window, "Server type" was changed
to
"SQL Server". This issue was reproduced at my side. I believe that this
issue should be caused by "Product Name". SSMS must recognize server type
by "Product Name". You can confirm this by creating a linked server with
"SQL Server" as "Server type" and then generating the linked server script
by "CREATE TO"->"New Query Editor Window". You will find that they both
have "@srvproduct=N'SQL Server'".
I will confirm this issue with our product team and if there is any
response, I will let you know. However sometimes the process may need a
long time, I recommend that you just mail me
(changliw_at_microsoft_dot_com) a response so that I can timely update
you.
Unfortunately we have not been able to reproduce the other issues as you
mentioned. Per my test, even the "Server type" was changed to "SQL
Server",
the linked server query still worked fine. I would like to check with you
what your linked server Security settings were. In my test environment,
the
two SQL Servers machines were in the same domain and I selected "Be made
using the login's current security context" as the Security option. After
that, I added the current login account to the logins of the linked server
and assigned it sysadmin permission for test.
Then the following query succeeded:
"SELECT * FROM [Charles-SQL2K].Northwind.dbo.Employees"
For the sp_addlinkedserver script omitting Product Name, I also did not
reproduce it. BLANK and SPACE are forbidden to the Product Name field when
I created the linked server. Per your suggestion, I just input '' as the
Product Name. After I created the linked server, the above query could
work. If I selected "Script Linked Server as" -> "CREATE TO" -> "New Query
Editor Window". The following statements were generated:
----------------------------------------------------------------------------
-------------------------------------
/****** Object: LinkedServer [CHARLES-SQL2K] Script Date: 08/10/2007
16:26:15 ******/
EXEC master.dbo.sp_addlinkedserver @server = N'CHARLES-SQL2K',
@srvproduct=N'''''', @provider=N'SQLNCLI', @datasrc=N'CHARLES-SQL2K'
/* For security reasons the linked server remote logins password is
changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin
@rmtsrvname=N'CHARLES-SQL2K',@useself=N'True',@locallogin=NULL,@rmtuser=NULL
,@rmtpassword=NULL
----------------------------------------------------------------------------
------------------------------------
As you can see, @srvproduct=N'''''', the Product Name was not omitted.
I am not sure if my test steps were completely same as yours. If there was
anything different, please feel free to point out. Also, for letting us
better understand your issue and further research, could you please mail
me
some screenshots of the issues? Your cooperation will be greatly
appreciated.
If you have any other questions or concerns, please feel free to let us
know.
Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
======================================================
.
- Follow-Ups:
- Re: Linked server strangeness in SQL 2005 Mgmt Studio
- From: Charles Wang[MSFT]
- Re: Linked server strangeness in SQL 2005 Mgmt Studio
- References:
- Linked server strangeness in SQL 2005 Mgmt Studio
- From: DWalker
- RE: Linked server strangeness in SQL 2005 Mgmt Studio
- From: Charles Wang[MSFT]
- RE: Linked server strangeness in SQL 2005 Mgmt Studio
- From: DWalker
- RE: Linked server strangeness in SQL 2005 Mgmt Studio
- From: Charles Wang[MSFT]
- Linked server strangeness in SQL 2005 Mgmt Studio
- Prev by Date: Excellent oppurnities in 'Bootstrap Technologies"
- Next by Date: Re: Unable to connect to SQL 2000 engine on other machine from SSM
- Previous by thread: RE: Linked server strangeness in SQL 2005 Mgmt Studio
- Next by thread: Re: Linked server strangeness in SQL 2005 Mgmt Studio
- Index(es):
Relevant Pages
|
Loading