alias or synonym for Sybase

alias or synonym for Sybase

Post by Minh Gian » Thu, 05 Dec 1996 04:00:00



Hi,
        Is there a way to avoid explicitly specify a table on another database in
store procedures?  My thinking was to use alias or synonym for that
particular table.  I looked it up in Sybase manuals and I didn't find any
info. on it.  I want to use alias just in case the table is moved to
another database or to the same database, therefore, only the change alias
or synonym not the store procedures.  Please reply via e-mail or re-post.

Thanks in advance,
Minh Giang

 
 
 

alias or synonym for Sybase

Post by m » Thu, 05 Dec 1996 04:00:00



>Hi,
>    Is there a way to avoid explicitly specify a table on another database in
>store procedures?  My thinking was to use alias or synonym for that
>particular table.  I looked it up in Sybase manuals and I didn't find any
>info. on it.  I want to use alias just in case the table is moved to
>another database or to the same database, therefore, only the change alias
>or synonym not the store procedures.  Please reply via e-mail or re-post.

>Thanks in advance,
>Minh Giang


Sure,  Use a sybase view.  Say you have database DB1 and database DB2.
If you've got table tbl1 in DB1 and you want to reference it in DB2
you can create a view like:

use DB2
go
create view tbl1 as select * from DB1..tbl1
go

And the stored procedures can reference the view same way as a table.
Look up "View" in Sybase manuals.

Mike

 
 
 

alias or synonym for Sybase

Post by Minh Gian » Fri, 06 Dec 1996 04:00:00





> >Hi,
> >       Is there a way to avoid explicitly specify a table on another database
in
> >store procedures?  My thinking was to use alias or synonym for that
> >particular table.  I looked it up in Sybase manuals and I didn't find
any
> >info. on it.  I want to use alias just in case the table is moved to
> >another database or to the same database, therefore, only the change
alias
> >or synonym not the store procedures.  Please reply via e-mail or
re-post.

> >Thanks in advance,
> >Minh Giang

> Sure,  Use a sybase view.  Say you have database DB1 and database DB2.
> If you've got table tbl1 in DB1 and you want to reference it in DB2
> you can create a view like:

> use DB2
> go
> create view tbl1 as select * from DB1..tbl1
> go

> And the stored procedures can reference the view same way as a table.
> Look up "View" in Sybase manuals.

> Mike

Ok, I'll give it a shot, but there's a concern with view.  Does Sybase10
view uses index?  This is a very large table I'm referring to (100+ million
rows).  BTW, because of the size of this table, update statistic was never
done on this huge table.  Most of my querries are simple query that use
forced index to get Sybase to use the correct index.

Regards,
Minh Giang

 
 
 

1. Help on synonyms, aliases and view in Sybase

I'm desperately looking for some documentation on creating & using
views, synonyms or aliases in Sybase.
Are they supported
Is there a good SQL Reference for Sybase (on-line?)
I've taken a look at the SyBooks CD, but it's now overly clear ....

Thanks

Allan

2. INFORMIX OPENINGS AVAIL

3. a question about aliases and synonyms

4. DTS Adding Extra Columns

5. DB2 - SYNONYM and ALIAS - JDBC

6. LSE on VAX/VMS

7. synonym on synonym is it possible.

8. during transactional replication LogReader crashes

9. Creating Sybase 11.5 synonyms in Oracle using Transparent Gateway

10. Sybase and Synonyms

11. Table synonyms possible with Sybase 10 ?

12. Synonym in Sybase

13. Synonyms in Sybase???