#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Query

Hi,

I was connecing to a dbo tabe using sql query code

the dbo name was Ab_cd_ef.dbo and everything run fine.

Now I have another dbo to which i want to connect. the dbo name is
Ab.cd.ef.dbo and it generates an error.(exceeds maximum prefixes
allowed) I cud connect using Access, but if there a way to do this with
excel itself?

thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default Query

Pls post the actual SQL code whe you have SQL issues. Also name the
Database platform and version and OS as well.

I suspect you use SQL server 2000. and have a name with dots . pls
surround each (part) of an sql identiefier with double quotes or square
brackets when doing an Excel query.

select * from "my.database"."dbo"."my.table"
or select * from [my.databse].[dbo].[my.table]

Access automatically maps illegal characters to legal ones, so
[my.databse].[dbo].[my.table] becomes my_database_dbo_my_table

DM Unseen

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Query

Hi again!

I use
I you use SQL server 2000. and windows XP Pro and Office 2003

my dbo got fout dots in it

when I use

" SELECT * FROM abc_def_ghi.dbo. hkl m"

it works fine

but when i want to use another dbo

" SELECT * FROM abc.def.ghi.dbo. hkl m"
it doesn't work



the problem is extra dots (and it is not underscore)

Thanks for your reply

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default Query

You cannot have more than 3 dots (normally) because any databse data
object it is of form

<datatabse name, usually can be omitted .<table owner name, usually
this is dbo, can be omitted.<table name

The dots have a formal meaning and cannot be used for anything else
that seperating the different naming elemenst

DM Unseen

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Query

that means eventhough i could get the data using MSAccess I cannot do
it with MSExcel?

I want to use this dbo A.T.F.dbo and table T1

The same server got everything (DBOs and Tables Names) repeated in it
according to year.

so there are A.T.F2003.dbo and having several tables under it and
A.T.F2004.dbo and several tables under it having the same name as in
2003 etc.

So if I avoid dbo name and only take table name it will be confusing
(?) which table under which dbo.

Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default Query

Soniya,

In SQL server there are 2 ways to help out with illegal characters,
enclosing table names in strings or square brackets should help you out

examples:

[dbo].[mytable.1]

or

"dbo"."mytable.1"

both work.

BTW how many owners do you have in your database? most databses I know
only have 1 owner i.e. DBO so I normally ommit that.

DM Unseen

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Query

thanks a lot

when I used the square brackets as u suggested it works.



{When I use SQL Server login under options Databse I could see around
10 Names listed there.. That means Ten DBOs. It will increase on every
year. I had no problem until now when the DBO names was like
abc_def_ghi.dbo, Suddenly this year i could find they are is using the
format abc.def.ghi.dbo}

thanks for your kind help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use MS Query to query data within the current work book Steve Kesler Excel Discussion (Misc queries) 0 August 6th 09 05:22 PM
Convert hard coded query criteria to Parameter Query Melanie[_2_] Excel Discussion (Misc queries) 0 July 15th 08 09:59 PM
Excel 2007 / MS Query - editing existing query to another sheet Hotpepperz Excel Discussion (Misc queries) 0 June 13th 08 06:53 PM
Importing Data via Web Query - Can values be passed to query? [email protected] Excel Discussion (Misc queries) 5 May 9th 06 06:21 PM
Save data retreived from query without saving query Anthony Excel Discussion (Misc queries) 0 January 25th 06 07:17 PM


All times are GMT +1. The time now is 08:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"