Thread: CREATE TABLE
Hello
From my asp page i create a table
TableName = "CON01"
strSQL = "CREATE TABLE " & TableName & " ( ID text, N_GEN serial not null);"
But the problem i have is that when i go and open my database in pgadmin the table name and coloumn name is written in lowercase :(
How do i ask it to write them in uppercase (like in my strSQL) ?
Thanks
Shavonne Wijesinghe
http://www.studioform.it
http://www.studioform.it
Le informazioni contenute nella presente comunicazione e i relativi allegati possono essere riservate e sono, comunque destinate esclusivamente alle persone o alla Società sopra indicati.
La diffusione, distribuzione e/o copiature del documento trasmesso da parte di qualsiasi soggetto diverso dal destinatario è proibita, sia ai sensi dellart. 616 c.p., che ai sensi del D. Lgs. n. 196/2003.
Se avete ricevuto questo messaggio per errore, Vi preghiamo di distruggerlo e di informarci immediatamente per telefono allo 0039362595044 o inviando un messaggio allindirizzo e-mail
amministrazione@studioform.it
The informations in this communication is confidential and may also be legally privileged. It is intended for the addressee only.
Access to this e-mail by anyone else is unauthorized. It is not to be relied upon by any person other than the addressee, except with our prior written approval. If you received this message please send an e-mail to the se
On 3/9/07, Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it> wrote: > Hello > > From my asp page i create a table > > TableName = "CON01" > strSQL = "CREATE TABLE " & TableName & " ( ID text, N_GEN serial not > null);" > > But the problem i have is that when i go and open my database in pgadmin the > table name and coloumn name is written in lowercase :( > > How do i ask it to write them in uppercase (like in my strSQL) ? > > Thanks > > Shavonne Wijesinghe > http://www.studioform.it Quote them. See: http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS > The informations in this communication is confidential and may also be > legally privileged. It is intended for the addressee only. > Access to this e-mail by anyone else is unauthorized. It is not to be relied > upon by any person other than the addressee, except with our prior written > approval. If you received this message please send an e-mail to the se Please, lose the legaleze filler. If not possible for you, a workaround is to use a public email service to send emails to the list.
Shavonne Marietta Wijesinghe wrote: > Hello > > From my asp page i create a table > > TableName = "CON01" > strSQL = "CREATE TABLE " & TableName & " ( ID text, N_GEN serial not null);" > > But the problem i have is that when i go and open my database in pgadmin the table name and coloumn name is written inlowercase :( > > How do i ask it to write them in uppercase (like in my strSQL) ? > You should quote the name. Please read more about it here - http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS Excerpt: "Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case." -- Milen A. Radev
On Fri, Mar 09, 2007 at 02:56:06PM +0100, Shavonne Marietta Wijesinghe wrote: > > But the problem i have is that when i go and open my database in > pgadmin the table name and coloumn name is written in lowercase :( Unquoted identifiers in PostgreSQL are folded to lower case. This is contrary to the SQL spec, but it normally doesn't matter because the rule is applied consistently. Therefore, you have two possibilities: 1. _Never_ quote identifiers. If you do it this way, everything will always be folded to lower case, so your queries will always work correctly. 2. _Always_ quote identifiers. This way, you always get upper case, or mixed case, or lower case, or whatever. Indeed, you can actually have two tables named "mytable" and "MyTable" this way, if you were so inclined/completely mad. The important thing to remember is that you have to pick one style, and be absolutely certain to use it consistently. If you mix the styles, you'll get surprises. A -- Andrew Sullivan | ajs@crankycanuck.ca The whole tendency of modern prose is away from concreteness. --George Orwell
Because being consistent is easily overlooked I would advise not to quote the table names
Instead of calling your table thisTableIsBig call it this_table_is_big
>>> Andrew Sullivan <ajs@crankycanuck.ca> 2007-03-09 15:21 >>>
On Fri, Mar 09, 2007 at 02:56:06PM +0100, Shavonne Marietta Wijesinghe wrote:
>
> But the problem i have is that when i go and open my database in
> pgadmin the table name and coloumn name is written in lowercase :(
Unquoted identifiers in PostgreSQL are folded to lower case. This is
contrary to the SQL spec, but it normally doesn't matter because the
rule is applied consistently.
Therefore, you have two possibilities:
1._Never_ quote identifiers. If you do it this way, everything
will always be folded to lower case, so your queries will always work
correctly.
2._Always_ quote identifiers. This way, you always get upper
case, or mixed case, or lower case, or whatever. Indeed, you can
actually have two tables named "mytable" and "MyTable" this way, if
you were so inclined/completely mad.
The important thing to remember is that you have to pick one style,
and be absolutely certain to use it consistently. If you mix the
styles, you'll get surprises.
A
--
Andrew Sullivan | ajs@crankycanuck.ca
The whole tendency of modern prose is away from concreteness.
--George Orwell
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly