Star79
asked on
How to use IP address when calling a SQL Store Procedure
Hi,
I am writing a stored procedure which inturn calls many store proc from different servers.
I can use something like DatabaseServerName.Databas ename.dbo. Databaseta ble and it works.
Now i want to use IP instead of databaseservername, something like
100.10.2.3.Databasename.db o.Database table it fails with an exception...
Line 7: Incorrect syntax near '100.10'.
I know i am not prefixing the IP in a proper way...can anybody suggest a proper way to use?
Thanks,
Rithesh
I am writing a stored procedure which inturn calls many store proc from different servers.
I can use something like DatabaseServerName.Databas
Now i want to use IP instead of databaseservername, something like
100.10.2.3.Databasename.db
Line 7: Incorrect syntax near '100.10'.
I know i am not prefixing the IP in a proper way...can anybody suggest a proper way to use?
Thanks,
Rithesh
ASKER
any other alternatives.
create a mapping on the db
as ip, linkname and use this table to construct your sql, @sqlStatement, and use:
exec sp_executesql @sqlStatement
as ip, linkname and use this table to construct your sql, @sqlStatement, and use:
exec sp_executesql @sqlStatement
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>cant you use ip for linked name and use siomething like this
But he nee dto create the linked server first
But he nee dto create the linked server first
See if OPENROWSET(), OPENDATASOURCE() and/or OPENQUERY() work for you?
does that work without creating the linked server
[LinkedServerName].[Databa