January 23, 2007 at 5:34 pm
alter PROCEDURE DBO.SQL_DBA_CREATE_LINKED_SERVERS
AS
DECLARE @HOSTNAME VARCHAR(20)
DECLARE @MYPROVSTR VARCHAR(500)
DECLARE Server_Cursor CURSOR FOR
SELECT hostname from sql_dba.dbo.sqldba_servers
OPEN Server_Cursor
FETCH NEXT FROM Server_Cursor INTO @HOSTNAME
WHILE @@FETCH_STATUS = 0
BEGIN
@myprovstr= 'DRIVER={SQL Server};SERVER=''' + @HOSTNAME + ''';UID=sql_dba_link;PWD=xxxxx;Initial Catalog=SQL_DBA'
is throwing Server: Msg 170, Level 15, State 1, Procedure SQL_DBA_CREATE_LINKED_SERVERS, Line 16
Line 16: Incorrect syntax near '@myprovstr'.
Isn't a double quote a quote in a string? What am I doing wrong here?
Thanks!
January 23, 2007 at 5:52 pm
It says "Incorect syntax".
So, it is.
SET @myprovstr= 'DRIVER ...
And next time don't expose you passwords to everybody.
_____________
Code for TallyGenerator
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply