Home Forums SQL Server 7,2000 General The object name ... contains more than the maximum number of prefixes. The maximum is 2. RE: The object name ... contains more than the maximum number of prefixes. The maximum is 2.

  • Assuming the servers have been set up as linked servers, you can run a query in the context of ServerB while still using a connection to ServerA (assuming having privileges on both databases and servers)

    exec ServerB.DatabaseB.dbo.sp_executesql N'INSERT INTO ServerA.DatabaseA.dbo.TableA SELECT * FROM DatabaseB.dbo.TableB(or ViewB or FunctionB)'

    To use with a function, you can do something similar to

    exec ServerB.DatabaseB.dbo.sp_executesql N'INSERT INTO ServerA.DatabaseA.dbo.TableA SELECT * FROM DatabaseB.dbo.

    FuncB(@input)',N'@input varchar(MAX)', @input='whatever'

    This allows you to bypass issues when you need the 4 part name, but of course I would recommend testing your query directly on ServerB first, and then applying the above