Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SV: SQL Escape Characters...


Message #1 by =?iso-8859-1?Q?H=E5kan_Frennesson?= <hakan@c...> on Fri, 17 Aug 2001 08:11:23 +0200
Hi!



You cannot use a select statement like that. You have to specify what table

you are getting your results from. Do you have a table called *? Rename it

if so.

Secondly, do you have a column in that table called "Word"? If so, I suggest

you rename it to something more specific. <That> looks like a HTML tag that

doesn´t exist..

I suggest you look into some SQL books to get a more "firm" grasp of what

SQL is about.

Try this link: http://w3.one.net/~jhoffman/sqltut.htm



Hakan









-----Ursprungligt meddelande-----

Från: Kevin Thompson [mailto:kevn77@a...]

Skickat: den 17 augusti 2001 02:11

Till: ASP Databases

Ämne: [asp_databases] SQL Escape Characters...





i am trying to do something and it wont work...



this is the statement i try:



SELECT * FROM * WHERE Word = '<THAT>'



it says there is an error in the from clause....

"*" is one of the Tables in the database.... whats wrong??





Message #2 by Kevn77@a... on Fri, 17 Aug 2001 03:31:23 EDT
In a message dated 8/16/2001 11:59:15 PM Pacific Daylight Time,

hakan@c... writes:





> Hi!

>

> You cannot use a select statement like that. You have to specify what tabl

e

> you are getting your results from. Do you have a table called *? Rename it

> if so.

> Secondly, do you have a column in that table called "Word"? If so, I sugge

st

> you rename it to something more specific. <That> looks like a HTML tag tha

t

> doesn=B4t exist..

> I suggest you look into some SQL books to get a more "firm" grasp of what

> SQL is about.

> Try this link: http://w3.one.net/~jhoffman/sqltut.htm

>

> Hakan



i need to get it from a table called "*" not from all the tables... and

stored in that table("*") are two fields....."Word" and "Template"



one of the recordsets has "<THAT>" for the "Word" field and something else

for the "Template" field.....



i need to select that table("*") and the recordset that has "<THAT>" in its

"Word" field....



this is the way i need to do it....



i know in Java you have escape characters like \'  or  \"  etc is there

something similar in SQL?? ie



SELECT * FROM \* WHERE Word =3D '<THAT>'



Message #3 by Steve Carter <Steve.Carter@t...> on Fri, 17 Aug 2001 11:03:04 +0100
Suggestions:



1) Rename the * table to something more sensible.



2) If you can't, get your DB administrator to do so



3) If he won't, sack the DBA :-)



4) If he can't because of official policy, look for a new job :-)



Try to keep names of all db objects to contain only characters



ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_



and do not start names with _



This applies to tables, column names, views/queries, storedprocedures 

and

everything.  It will make everybody's life a lot easier.  Hint: certain

combinations of the above characters form useful informative strings 

like



  Customer_Registration



or



  Stock_Code



or



  Login_Attempt



which will make the db a lot nicer to maintain.  :-)





The short answer about escape characters is that you will not find 

anything

as sensible as Java's scheme here.  It depends on the db driver, but 

using [

] to surround names often works, and using '' to represent ' within a

'string' often works.



> -----Original Message-----

> From: Kevn77@a... [mailto:Kevn77@a...]

> Sent: 17 August 2001 08:31

> To: ASP Databases

> Subject: [asp_databases] Re: SV: SQL Escape Characters...

>

>

> In a message dated 8/16/2001 11:59:15 PM Pacific Daylight Time,

> hakan@c... writes:

>

>

> > Hi!

> >

> > You cannot use a select statement like that. You have to

> specify what table

> > you are getting your results from. Do you have a table

> called *? Rename it

> > if so.

> > Secondly, do you have a column in that table called "Word"?

> If so, I suggest

> > you rename it to something more specific. <That> looks like

> a HTML tag that

> > doesn=B4t exist..

> > I suggest you look into some SQL books to get a more "firm"

> grasp of what

> > SQL is about.

> > Try this link: http://w3.one.net/~jhoffman/sqltut.htm

> >

> > Hakan

>

> i need to get it from a table called "*" not from all the

> tables... and

> stored in that table("*") are two fields....."Word" and "Template"

>

> one of the recordsets has "<THAT>" for the "Word" field and

> something else

> for the "Template" field....

>

> i need to select that table("*") and the recordset that has

> "<THAT>" in its

> "Word" field....

>

> this is the way i need to do it....

>

> i know in Java you have escape characters like \'  or  \" 

> etc is there

> something similar in SQL?? ie

>

> SELECT * FROM \* WHERE Word =3D '<THAT>'


  Return to Index