View previous topic :: View next topic
|
Author |
Message |
JashBr Currently Banned New User
Joined: 15 Feb 2007 Posts: 2 Location: Chennai
|
|
|
|
What does it mean that alias doesnt use location qualifier of a table ?
An alias is created even if the table doesnt exist. But how the table structure gets updated ?
In a distributed environment how an alias identifies a table ?
Thanks,
Jash |
|
Back to top |
|
|
JashBr Currently Banned New User
Joined: 15 Feb 2007 Posts: 2 Location: Chennai
|
|
|
|
Hi all,
I'm very much disappointed that none of the viewers replied my post. Atleast send some links from which i could get the answers for above questions.
Thanks,
Jash |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
JashBr wrote: |
Hi all,
I'm very much disappointed that none of the viewers replied my post. Atleast send some links from which i could get the answers for above questions.
Thanks,
Jash |
What are we, your personal advice center ??? |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
Quote: |
An alias is created even if the table doesnt exist. |
Please go thru the syntax atleast..!
How could anyone define an ALIAS on the object which is not existing.
DB2 does not allow you to do this..!
Alias can be defined on a TABLE/VIEW. If you are talking about the remote site. It should be accessed via a three part name.
Remote alias should be accessed as LOACTION.fully qualified name
Synonyms cannot be accessed remotely because it cannot be qualified.
If you create the synonym, Its only you and only you who can access it. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello Jash,
One reason for the lack of response is that your questions were not clear. Another was your statement "An alias is created even if the table doesnt exist." which caused even more confusion.
To get any responses (and especially meaningful ones), care must be given when presenting your question/statment. As i've mentioned several times, while a topic starter's thought/question is completely clear to them, it may not be to those who read it and would want to help.
Good luck |
|
Back to top |
|
|
wanderer
Active User
Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
|
|
|
|
vini_srcna wrote: |
Please go thru the syntax atleast..!
How could anyone define an ALIAS on the object which is not existing.
DB2 does not allow you to do this..!
|
Hmm, as far as I remember, Aliases can be created on tables that don't exist yet. |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
wanderer, You made me think.
I know the fact, that an alias would still be there when the table/view on which it is defined is dropped. I was not aware of this concept. Thank you.
I just tried to make sure. Here is the warning message..!
[img]CREATE ALIAS MYALIEAS FOR PILLAR;
---------+---------+---------+---------+---------+---------+---------+---------+
DSNT404I SQLCODE = 403, WARNING: THE LOCAL OBJECT REFERENCED BY THE CREATE
ALIAS STATEMENT DOES NOT EXIST
DSNT418I SQLSTATE = 01522 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNXICAL SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 25 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'00000019' X'00000000' X'00000000' X'FFFFFFFF'
X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION
---------+---------+---------+---------+---------+---------+---------+---------[/img]
Sorry for wrong information and thank you for correcting me. I always love to correct my mistakes |
|
Back to top |
|
|
wanderer
Active User
Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
|
|
|
|
I am glad I helped. Cheers |
|
Back to top |
|
|
Jash_br
New User
Joined: 30 Mar 2007 Posts: 5 Location: Chennai
|
|
|
|
Wanderer,
So alias can be created even if the table doesn't exist. But how does the alias is updated as soon as we create the table. |
|
Back to top |
|
|
wanderer
Active User
Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
|
|
|
|
Jash,
I don't think there is any updation happens and there is no need for such a thing as far as I understand. Why do you think alias needs to be updated when table is created? |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
Quote: |
But how does the alias is updated as soon as we create the table...?. |
When you access the alias it directs you to the base table on which it is defined. If the base table exists it's well and fine or else it will through you some negative code. |
|
Back to top |
|
|
Jash_br
New User
Joined: 30 Mar 2007 Posts: 5 Location: Chennai
|
|
|
|
Hi,
I created an alias for a table which does not exist. I checked that the structure of the alias is empty. Then I created the table. Now again checked the structure of the alias. It got updated with the mentioned table's structure. So how does it happened.
Thanks for your replies |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Let's use an anology.
Let's say there is a new housing project under construction (one of the streets is Maple St). Each lot also has a "tract id". All of the new addresses are known before construction begins. There is a reference to 1234 Maple St, but no house or people are there yet. This is like your alias for the table not yet created.
Now the house is built, but not occupied. This is like having a table definition only. Lastly, someone moves into the new house. This is like having data in the new table. You can see who they are, their ages, etc.
Without knowing all of the details and without knowing the tract id, the 123 Maple St address alias is used beacuse it is easier to work with (for many). Much like we would use an alias. |
|
Back to top |
|
|
wanderer
Active User
Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
|
|
|
|
Jash_br wrote: |
Hi,
I created an alias for a table which does not exist. I checked that the structure of the alias is empty. Then I created the table. Now again checked the structure of the alias. It got updated with the mentioned table's structure. So how does it happened.
|
Can you tell how you check Alias structure?
And by structure do you mean the DDL of the underlying table? |
|
Back to top |
|
|
Jash_br
New User
Joined: 30 Mar 2007 Posts: 5 Location: Chennai
|
|
|
|
Yes Wanderer I just meant DESC of the alias |
|
Back to top |
|
|
wanderer
Active User
Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
|
|
|
|
Is this DESC somekind of command you use in some third party tool?
Anyway, it doesn't matter. The whole Alias thing doesn't get updated anywhere if you create the associated table afterwards. Everytime you mention the Alias name, DB2 replaces it with the underlying table name if present based on your Alias definition, before processing your statements further. Hope that explains. |
|
Back to top |
|
|
Jash_br
New User
Joined: 30 Mar 2007 Posts: 5 Location: Chennai
|
|
|
|
Got it Hope thats why Alias is called "Forward pointer" !
Thanks a lot !!!
Jash |
|
Back to top |
|
|
|