Fully Qualified table name syntax
Posted on 2006-06-08
I would like to write a query accessing two tables using ADO in VB6. The syntax for fully qualified tables names is [server].[databasename].[owner].[table name].
When the server name is SQL2000, the fully qualified name works( Select * from SQL2000.jir.dbo.CusFil ). However, when the server name is fs-jirsql, I receive an error becasue of the hyphen( Select * from fs-jirsq1.jir.dbo.CusFil ). Alternately, I tried the IP address, 10.0.0.120 but the periods in the IP confuse SQL( Select * from 10.0.0.120.jir.dbo.CusFil ).
How do I correctly format the fully qualified table name in a select statement when either the server name contains a hyphen or when I only have the IP address and not the server name?