Обсуждение: weird SQL statement question

Поиск
Список
Период
Сортировка

weird SQL statement question

От
"Tadej Kanizar"
Дата:
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span lang="SL" style="font-size:10.0pt;
font-family:Arial">Ok, so I installed the latest version of Postresql (8.02) on a WinXP SP2 machine.. </span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span lang="SL" style="font-size:10.0pt; 
font-family:Arial">My question is why won't the statement SELECT * FROM table work, whereas the statement SELECT * FROM
»table«works!</span></font><p class="MsoNormal"><font face="Arial" size="2"><span lang="SL" style="font-size:10.0pt; 
font-family:Arial">And, to explain a bit more, here's another example:</span></font><p class="MsoNormal"><font
face="Arial"size="2"><span lang="SL" style="font-size:10.0pt; 
font-family:Arial">INSERT INTO TestTable (Name, Surname) VALUES ('name', 'surname');  .. this DOESN'T
work</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span lang="SL" style="font-size:10.0pt; 
font-family:Arial">INSERT INTO »TestTable« (»Name«, »Surname«) VALUES ('name', 'surname'); .. this DOES
work</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span lang="SL" style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span lang="SL"
style="font-size:10.0pt;
font-family:Arial">Any ideas? </span></font><font face="Wingdings" size="2"><span lang="SL"
style="font-size:10.0pt;font-family:Wingdings">J</span></font><fontface="Arial" size="2"><span lang="SL"
style="font-size:10.0pt;font-family:Arial"></span></font><pclass="MsoNormal"><font face="Arial" size="2"><span
lang="SL"style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span lang="SL"
style="font-size:10.0pt;
font-family:Arial">Regards,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span lang="SL"
style="font-size:10.0pt;
font-family:Arial">Tadej</span></font></div>

Re: weird SQL statement question

От
Frank Bax
Дата:
At 01:55 PM 4/23/05, Tadej Kanizar wrote:

>Ok, so I installed the latest version of Postresql (8.02) on a WinXP SP2
>machine..
>
>My question is why won't the statement SELECT * FROM table work, whereas
>the statement SELECT * FROM »table« works!
>
>And, to explain a bit more, here's another example:
>
>INSERT INTO TestTable (Name, Surname) VALUES ('name', 'surname');  .. this
>DOESN'T work
>
>INSERT INTO »TestTable« (»Name«, »Surname«) VALUES ('name', 'surname'); ..
>this DOES work


If you create a table using quotes and mixed-case, you will need quotes
every time you reference the table.  Don't use quotes when you create the
table and you won't need them when you acces the table with other commands.



Re: weird SQL statement question

От
Mischa Sandberg
Дата:
Quoting Frank Bax <fbax@sympatico.ca>: 
> At 01:55 PM 4/23/05, Tadej Kanizar wrote: 
>  
> >Ok, so I installed the latest version of Postresql (8.02) on a 
WinXP 
> SP2  
> >machine.. 
> > 
> >My question is why won't the statement SELECT * FROM table work, 
> whereas  
> >the statement SELECT * FROM �table� works! 
> If you create a table using quotes and mixed-case, you will need 
> quotes  
> every time you reference the table.  Don't use quotes when you 
create 
> the  
> table and you won't need them when you acces the table with other 
> commands. 
I don't suppose that the original poster actually named the table 
"table"? In which case, being a keyword, it will ALWAYS need quotes. 
"Dreams come true, not free." -- S.Sondheim, ITW