|
 |
asp_databases thread: Column name with spaces!!!!!
Message #1 by dag@i... on Tue, 24 Jul 2001 22:36:25
|
|
I'm trying to return a recordset by using the following query:
stringSQL = "SELECT LASTMODIFIED FROM TICKDET WHERE [PROBLEM #] = '62'"
Without the brackets, I get ORA-00911 invalid character.
With the brackets, I get ORA-00936 missing expression.
The select statement works fine in sqlplus when I put double quotes around
the column name (ex. "PROBLEM #"). The select statement will work fine in
the asp if I use a different column out of the table. Any ideas....
--thanks--
Doug
Message #2 by Steve Carter <Steve.Carter@t...> on Wed, 25 Jul 2001 10:48:20 +0100
|
|
Aaaargh!
I don't think the space is half of your problem! I think the # will
screw
stuff up BIG TIME.
I recommend limiting field names to [A-Za-z][A-Za-z0-9_]* i.e. an alpha
character followed by 0-or-more or alpha, numeric and "_" characters.
Nothing else. No spaces, no punctuation.
> -----Original Message-----
> From: dag@i... [mailto:dag@i...]
> Sent: 24 July 2001 23:36
> To: ASP Databases
> Subject: [asp_databases] Column name with spaces!!!!!
>
>
> I'm trying to return a recordset by using the following query:
>
> stringSQL =3D "SELECT LASTMODIFIED FROM TICKDET WHERE [PROBLEM
> #] =3D '62'"
>
> Without the brackets, I get ORA-00911 invalid character.
> With the brackets, I get ORA-00936 missing expression.
>
> The select statement works fine in sqlplus when I put double
> quotes around
> the column name (ex. "PROBLEM #"). The select statement will
> work fine in
> the asp if I use a different column out of the table. Any ideas....
>
> --thanks--
> Doug
Message #3 by "Grant I" <giswim1@a...> on Wed, 25 Jul 2001 14:43:34
|
|
On your asp page, try
stringSQL = "SELECT LASTMODIFIED FROM TICKDET WHERE [""PROBLEM #""] = '62'"
The "" inside a string assignment puts " in the string.
HTH
Grant
> I'm trying to return a recordset by using the following query:
>
> stringSQL = "SELECT LASTMODIFIED FROM TICKDET WHERE [PROBLEM #] = '62'"
>
> Without the brackets, I get ORA-00911 invalid character.
> With the brackets, I get ORA-00936 missing expression.
>
> The select statement works fine in sqlplus when I put double quotes
around
> the column name (ex. "PROBLEM #"). The select statement will work fine in
> the asp if I use a different column out of the table. Any ideas....
>
> --thanks--
> Doug
Message #4 by Jeff Scott <jscott17171@y...> on Wed, 25 Jul 2001 10:26:10 -0700 (PDT)
|
|
rename PROBLEM # TO PROBLEM_# or PROBLEM#.
that should work.
jeff
--- dag@i... wrote:
> I'm trying to return a recordset by using the
> following query:
>
> stringSQL = "SELECT LASTMODIFIED FROM TICKDET WHERE
> [PROBLEM #] = '62'"
>
> Without the brackets, I get ORA-00911 invalid
> character.
> With the brackets, I get ORA-00936 missing
> expression.
>
> The select statement works fine in sqlplus when I
> put double quotes around
> the column name (ex. "PROBLEM #"). The select
> statement will work fine in
> the asp if I use a different column out of the
> table. Any ideas....
>
> --thanks--
> Doug
|
|
 |