SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Maximum number of prefixes Exceeded.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bholmstrom
Yak Posting Veteran

USA
71 Posts

Posted - 03/01/2013 :  12:30:44  Show Profile  Reply with Quote
Good morning, I am getting the above error from the following query...any ideas

select accountid,c_acct_engagementID,client_code,engagement,ltrim(rtrim(client_code)) + ltrim(rtrim(engagement)) as
EngCode from saleslogix.sysdba.c_acct_Engagement B

where
ltrim(rtrim(B.Client_Code)) + ltrim(rtrim(B.Engagement))
not in (select ltrim(rtrim([rl-sql02].abc_sql.dbo.clients.cltnum)) + ltrim(rtrim([rl-sql02].abc_sql.dbo.clients.clteng))
from [rl-sql02].abc_sql.dbo.clients)

--------------------------------------------------------------

Server: Msg 117, Level 15, State 2, Line 6
The number name 'rl-sql02.abc_sql.dbo.clients' contains more than the maximum number of prefixes. The maximum is 3.


Bryan Holmstrom

Edited by - bholmstrom on 03/01/2013 12:31:32

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 03/01/2013 :  12:34:06  Show Profile  Reply with Quote
try this


select accountid,c_acct_engagementID,client_code,engagement,ltrim(rtrim(client_code)) + ltrim(rtrim(engagement)) as
EngCode from saleslogix.sysdba.c_acct_Engagement B

where
ltrim(rtrim(B.Client_Code)) + ltrim(rtrim(B.Engagement)) 
not in (select ltrim(rtrim(cltnum)) + ltrim(rtrim(clteng)) 
from [rl-sql02].abc_sql.dbo.clients) 


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bholmstrom
Yak Posting Veteran

USA
71 Posts

Posted - 03/01/2013 :  12:42:56  Show Profile  Reply with Quote
Thank you Visakh16

Perfect as always. How can I add the 2 fields cltnum and clteng from the client table to the output.

Thanks

Bryan Holmstrom
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 03/01/2013 :  12:50:54  Show Profile  Reply with Quote
you cant as you're getting the records not existing in clients table in the above statement.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bholmstrom
Yak Posting Veteran

USA
71 Posts

Posted - 03/01/2013 :  13:33:20  Show Profile  Reply with Quote
Your correct....forgot about that. How bout the reverse of this query which will show be c_acct_engagements that ARE in the clients table? How would I show the 2 fields then ?

Thanks


Bryan Holmstrom
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 03/01/2013 :  13:38:37  Show Profile  Reply with Quote

select ltrim(rtrim(cltnum)) , ltrim(rtrim(clteng)) 
from [rl-sql02].abc_sql.dbo.clients
where ltrim(rtrim(cltnum)) + ltrim(rtrim(clteng)) 
not in (select ltrim(rtrim(B.Client_Code)) + ltrim(rtrim(B.Engagement)) from saleslogix.sysdba.c_acct_Engagement)


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000