Page 1 of 1

SQL Proboblem/Bug

PostPosted: Dec 19, 2001 @ 5:03pm
by RwGast
How would you run a WHERE on 17' monitors? <br>LIKE SELECT * FROM tblTable WHERE fldPRoducts = '17' monitors' SQL doesnt likt the single quaote. Is there an escape sequence like \' or something?

Re: SQL Proboblem/Bug

PostPosted: Dec 19, 2001 @ 5:13pm
by Paul
&' i think...

Re: SQL Proboblem/Bug

PostPosted: Dec 20, 2001 @ 5:15am
by RICoder
Did you try double quotes?<br><br>"17' Monitor"<br><br>Depends on the implimentation of SQL, and I never tried it on a PPC.

Re: SQL Proboblem/Bug

PostPosted: Dec 21, 2001 @ 6:47pm
by RwGast
Ok heres the deal &' doesnt work i get this error<br><br>Query:<br>select * from CCIProducts where pdctProductCode LIKE '&''<br><br>Error:<br>Server: Msg 105, Level 15, State 1, Line 1<br>Unclosed quotation mark before the character string '&'<br>'.<br>Server: Msg 170, Level 15, State 1, Line 1<br>Line 1: Incorrect syntax near '&'<br>'.<br><br>I tried to use double quotes with  the where attribute and it didnt work<br><br>Query:<br>select * from CCIProducts where pdctProductCode LIKE "memory"<br><br>Error:<br>Server: Msg 207, Level 16, State 3, Line 1<br>Invalid column name 'memory'.<br><br>I am using Microsoft SQL server 7.0 with Visual Basic and ADO, This has nothing to do with the ppc RICoder. I ran all thoughs Querys in the SQL Quey Analizyer to make sure there was no middle man problem with VB and ADO.<br><br>So does anyone know how to do a querly like<br><br>SELECT * FROM CCIProducts WHERE pdctProductCode = '17' monitor'<br><br>The problem is sql thinks im termanating my query at the ' after 17. I know there has to be a way of doing this i just dont know how. <br><br>Any help would be qreatly appriciated becuase this is for my job, thanks. :)

Re: SQL Proboblem/Bug

PostPosted: Dec 22, 2001 @ 2:52am
by RICoder
ADO is funky like that.  Mostly it requires strict adherence to STANDARD SQL.  Meaning that you need to do stuff like using % as a wild card, even though some DBs use *.  But, in other cases it doesn't care what you do, like you can use a terminating ; in the statement, even though only Access (that I know of) lets you do that.  This is all fluff, but I wrote it anyway.<br><br>My point is, I guess, that standard SQL uses ' as string literal containers, NOT ".  In fact the " will raise an error in some cases in ADO.  It ALWAYS did for me when I tried to write some test code.<br><br>I don't know if there are any escape sequences in SQL...and I won't be in my office to ask our resident SQL guru until Thurs...If you still want to know then, let me know.

Re: SQL Proboblem/Bug

PostPosted: Dec 22, 2001 @ 1:38pm
by RwGast
ok, ill let you know i think i may be talking to a guy today.

Re: SQL Proboblem/Bug

PostPosted: Dec 24, 2001 @ 6:58am
by Mr Visitor
Try two single quotes e.g. ''  That works on 'Big' SQL

Re: SQL Proboblem/Bug

PostPosted: Dec 24, 2001 @ 7:06am
by Mr Visitor

Re: SQL Proboblem/Bug

PostPosted: Dec 24, 2001 @ 7:08am
by Mr Visitor

Re: SQL Proboblem/Bug

PostPosted: Dec 24, 2001 @ 7:11am
by Mr Visitor

Re: SQL Proboblem/Bug

PostPosted: Dec 24, 2001 @ 7:13am
by Mr Visitor

Re: SQL Proboblem/Bug

PostPosted: Dec 24, 2001 @ 4:19pm
by RwGast