Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Neglect the Schema

Author  Topic 

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2009-06-24 : 11:02:16

Hallo,

I have 2 tables in my SQL database as dbo.o_prac and and dbo.o_pat.
Is there anyway I can change the names to o_prac and o_pat only. i.e, the schema to be empty. Or is there any other way the tables can be read as o_prac and o_pat.

The tables need to be set to o_prac and o_pat as an entire application depends on the table name as so, before making an ODBC connection

Any help please!! Thanks

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-06-24 : 12:09:32
If you're using SQL 2005, check out SYNONYMS.

Jim
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2009-06-24 : 12:19:28
You should not need to include the schema name when referencing them if that is the default schema for your login.

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-24 : 12:40:44
quote:
Originally posted by dr223


Hallo,

I have 2 tables in my SQL database as dbo.o_prac and and dbo.o_pat.
Is there anyway I can change the names to o_prac and o_pat only. i.e, the schema to be empty. Or is there any other way the tables can be read as o_prac and o_pat.

The tables need to be set to o_prac and o_pat as an entire application depends on the table name as so, before making an ODBC connection

Any help please!! Thanks


you can neglect the schema name provided the objects are only present in that schema
Go to Top of Page

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2009-06-25 : 06:27:31
Please can you tell me the process I can neglect the schema? Both tables are in the same schema dbo.

I just want them to be o_prac and o_pat and not dbo_o_prac and dbo_o_pat...

Thanks
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-25 : 06:40:18
If "dbo" is the default schema, yes then you don't need to reference the schema.
But the query will be a little slower since the algebrizer in the query engine has to do an extra lookup.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2009-06-25 : 06:54:30
Anyway I can afford that as am working with millions of records at one go

Thanks
Go to Top of Page

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2009-06-25 : 06:57:25
sorry for one record it has taken so far 5 minutes and no data has been pulled yet!!

any other method please
Go to Top of Page

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2009-06-25 : 06:59:49
Peso

Is there anyway my table can read o_prac rather than dbo.o_prac?
Please advise
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2009-06-25 : 10:38:12
No. Every object, including tables, has to belong to a schema.

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-25 : 13:08:01
quote:
Originally posted by dr223

Peso

Is there anyway my table can read o_prac rather than dbo.o_prac?
Please advise


does o_prac exist in more than 1 schema?
Go to Top of Page
   

- Advertisement -