Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

The object name ... contains more than the maximum number of prefixes. The maximum is 2. Expand / Collapse
Author
Message
Posted Friday, April 1, 2005 3:12 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, March 16, 2007 11:16 AM
Points: 11, Visits: 1

I am attempting to call a stored procedure from a separate sql server box and I receive the following message...

The object name 'prod1.tolim.dbo.' contains more than the maximum number of prefixes. The maximum is 2.

Here is the statement in my stored proc....

exec PROD1.ToLIM.dbo.ToLIM_ExtractIndex @vDB, @vDBTable, @vLIMSymbol = 'CIN.CINERGY_LOAD',   @vLIMColumn = 'CIN.ESAL_LESS_ORPHAN', @vTimeUnits = 'HOURLY_COLUMNS', @dDateStart = '1999-01-01', @dDateEnd = '2005-03-03'

I am executing from my dev server to my prod server and the prod server is a linked server.

Any help would be appreciated.

Jeff




Post #171651
Posted Friday, April 1, 2005 11:21 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, July 12, 2011 1:32 PM
Points: 30, Visits: 11
One of the possible reasons for getting this error is when trying to create a table and the statement is using the 4-part table name instead of just the 3-part name.  If it does, remove the server name as part of the create table statement and just use <DatabaseName>.<Owner>.<TableName>.



http://www.sql-server-helper.com
Post #171680
Posted Wednesday, November 15, 2006 3:51 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 29, 2008 3:47 AM
Points: 1, Visits: 3

The error I got was very similar. I was trying to do the following update and "push" the data across to a linked server:

update ServerName.AAD.dbo.t_employee
set ServerName.AAD.dbo.t_employee.work_shift = wa.work_shift
from t_employee wa
where ServerName.AAD.dbo.t_employee.id = wa.id
and wa.id = '105'

I was getting the following:
Server: Msg 117, Level 15, State 2, Line 4
The number name 'ServerName.AAD.dbo.t_employee' contains more than the maximum number of prefixes. The maximum is 3.

I couldn't find any other threads with my answer. Maybe I'm alone on this but it took me hours to find this solution, so I thought I'd post it here in hopes it helps out the next person searching on this.

It's a simple, but not obvious, answer. Put the table you are updating in the FROM clause with an alias and update the alias, as follows:

update la
set la.work_shift = wa.work_shift
from ServerName.AAD.dbo.t_employee la, t_employee wa
where la.id = wa.id
and wa.id = '105'

Beautiful, ins't it? That is when you have the answer.

Post #323292
Posted Wednesday, December 13, 2006 2:05 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, May 30, 2007 11:25 AM
Points: 1, Visits: 1
This seriously saved my ass. This is the only way to use an UPDATE with linked servers when you want to update only one column.

Thank you, thank you, thank you.
Post #330289
Posted Wednesday, March 14, 2007 9:44 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, May 19, 2009 4:26 AM
Points: 3, Visits: 16
Cheers Erik, that's got me up and running again.

Like you said, it's beautiful when you know the answer!
Post #351498
Posted Friday, May 25, 2007 8:40 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 15, 2014 4:46 PM
Points: 1,045, Visits: 2,725
I ran into the same error, but I was trying to do a SELECT...INTO in a linked server.  I had to script the table on the target DB, then run an INSERT...SELECT.  A pain, but it got the job done.



Tim Mitchell, SQL Server MVP
Independent Business Intelligence Consultant
www.TimMitchell.net
@Tim_Mitchell

Post #369045
Posted Friday, May 25, 2007 2:54 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, November 6, 2007 11:19 AM
Points: 62, Visits: 5

That query should work fine, the only guess I have is the way you are calling it.  Try the following:

exec PROD1.ToLIM.dbo.ToLIM_ExtractIndex @vDB, @vDBTable, 'CIN.CINERGY_LOAD',   'CIN.ESAL_LESS_ORPHAN', 'HOURLY_COLUMNS', '1999-01-01', '2005-03-03'

SQL Server is pretty picky about calls made to stored procedures when parameters are named so I'm guessing that's the issue.

Post #369195
Posted Tuesday, March 25, 2008 7:16 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 14, 2012 12:46 AM
Points: 120, Visits: 233
Thanks Tim.

Insert into rather than a Select into works a treat accross a linked server
Post #474460
Posted Monday, March 31, 2008 5:23 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, July 1, 2013 1:00 AM
Points: 2, Visits: 21
How did you get the select into query to work
Post #476886
Posted Monday, March 31, 2008 5:43 AM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 2:54 AM
Points: 4,427, Visits: 4,172
Could this be a permission problem ?
For INSERT INTO you only need datawriter permissions, while for a SELECT INTO you need at least CREATE TABLE permissions.


Markus Bohse
Post #476898
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse