August 1, 2005 at 5:26 pm
Hi all,
Would you please show me the correct syntax to run a query from open query if I only know the ip address. I entered something like this:
select * from openquery(172.24.2.5,'select * from mytable where date >="4/1/05" and date <"4/2/05
it gave me error."Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '172.24'."
Thanks.
Minh Vu
August 1, 2005 at 9:22 pm
OPENQUERY requires that you create a linked server. You cannot specify an IP address.
If you wish to use an IP address, try something like
select * from OPENROWSET ( 'SQLOLEdB'
, '172.24.2.5' ; 'username' ; 'password'
,'select * from mytable where date >="4/1/05" and date <"4/2/05"'
)
August 2, 2005 at 12:09 am
Yes, you can. I just figured out. I needed to put my ip in bracket:
[172.2.24.5]. It worked for me.
Thanks,
Minh
August 2, 2005 at 5:18 am
No, I am not getting it, the following error is raised
'could not find server '10.1.121.77' in sysservers. Execute sp_addlinkedserver to add the server to syservers'
August 2, 2005 at 6:53 pm
Yes, you need to link the server before you can use open query.
Minh
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply