In the MYSQL Console, I was attempting to add multiple values to a table and in an effort to start a new line, I selected shift+enter which produced '>. Now, every time I hit enter, I get '> rather than inserting my values or really being able to do anything now. How do I stop this?
It means you have opened a quote ' and did not closed it. Add another quote ' to close the opened one, add a semicolon ; to end the command and hit enter to execute it (you maybe get a syntax error, it the opened quote must be closed earlier).
Related
when using mysql command line, I forgot to put a ' in the varchar input and this is the result. No matter how many times I try to enter some other things nothing is happening. Can anyone tell me why this happening?
The mysql command line program is waiting for you to complete an incomplete quoted string; it shows > continuation line prompts.
Either finish the string with a closing ', or better, use <ctrl>-c to abandon your input and try again.
I'm new to sql and for some reason, the arrow symbol ( -> ) that I am used to seeing in teh command line, which mean it is ready for input, is now displayed as ( '> ) and it does not accept commands. What does it mean and how do I get back to ( -> ) ?
Thanks
It means that it is treating any input which follows as part of a string literal, until it encounters a(n unescaped) string termination quote ' character.
This will have happened because you previously began the string literal with such a string termination quote character. For example:
mysql> SELECT foo
-> FROM tbl
-> WHERE bar LIKE 'somestring
'> this is still part of somestring'
-> ;
find the attached image
use '/ command and press enter then it will go on next line starting with ->
then use ; and press enter.
it happens if there is unbalanced '(single quote) in query.
It means you have an incomplete query. Most likely it's something related to a missing quotation, semi-colon at the end, or parentheses aren't closed.
You can exit the query with: '\c
Not sure what happens to the query but it gets you back to the mysql> prompt.
enter image description here
As you can see, I encountered the same issue, the solution is :
type '> in the command line, then insert some command as I did(please refer to the picture attached), and then the new line starts.
I have this column in my MySQL database. It is of type TINYTEXT. I fetch this column with a PHP script and displays it in an HTML. I find that all of my text has a trailing character in it. It shows up as a question mark with a diamond behind it in the browser.
I opened MySQL workbench and selected the column into the editor. I opened the value in the editor. The words seemed normal, except that they all have a trailing space behind it. I also took a look at the binary tab and the last group of letter/numbers is always 'a0'.
What could this be? I tried to trim the title, replace '\r' with '', replace '\n' with '', but nothing seem to work. How do I get rid of this? I also tried replacing '\xa0', though I don't know what this does (one of the solutions google turned up). But it does not work.
Any help would be appreciated.
I'm new to sql and for some reason, the arrow symbol ( -> ) that I am used to seeing in teh command line, which mean it is ready for input, is now displayed as ( '> ) and it does not accept commands. What does it mean and how do I get back to ( -> ) ?
Thanks
It means that it is treating any input which follows as part of a string literal, until it encounters a(n unescaped) string termination quote ' character.
This will have happened because you previously began the string literal with such a string termination quote character. For example:
mysql> SELECT foo
-> FROM tbl
-> WHERE bar LIKE 'somestring
'> this is still part of somestring'
-> ;
find the attached image
use '/ command and press enter then it will go on next line starting with ->
then use ; and press enter.
it happens if there is unbalanced '(single quote) in query.
It means you have an incomplete query. Most likely it's something related to a missing quotation, semi-colon at the end, or parentheses aren't closed.
You can exit the query with: '\c
Not sure what happens to the query but it gets you back to the mysql> prompt.
enter image description here
As you can see, I encountered the same issue, the solution is :
type '> in the command line, then insert some command as I did(please refer to the picture attached), and then the new line starts.
I'm working in classical ASP and am trying to simply insert some user input into my MS SQL 2008 database. This is something I do basically every day, but I don't think I've ever experienced this bug before.
The bug I am getting is that, if a user ends a line of text in backslash, and starts a new line below, both the backslash and line break are lost after the data is stored in the DB.
If i try the following statement, hardcoded from an ASP file:
UPDATE TBLarticle_text SET Introduction = 'Text on first line \" & vbCrLf & " text on second line' WHERE ArticleGuid = 28
The resulting data is without the backslash or the line break. The string is correct if stored in a variable and printed on the page.
Here is the example user input (normally from a form, but it's not really relevant). The input:
Text on first line \
text on second line
... is stored as:
Text on first line text on second line
I don't see any issues if the backslash is followed by anything other than a line break.
I know this is old, but I just came across a MS KB article that discusses this: http://support.microsoft.com/kb/164291/en-us. The long and short of it is that the three characters \<CR><LF> together is some weird escape sequence, and you need to replace all occurrences of \<CR><LF> with \\<CR><LF><CR><LF> when inserting or updating because the first backslash in \\<CR><LF><CR><LF> escapes the weird escape sequence, i.e. the next three characters \<CR><LF>, and then the additional <CR><LF> puts the carriage return back in place. Annoying, yes.
I am seeing a similar issue. I would say the best way to work around this is to not let ASP pass such strings to SQL Server. You can clean this up by simply replacing that character sequence and injecting a space at the end of such a line (which a user is unlikely to ever notice):
sql = REPLACE(sql, "\" & vbCrLf, "\ " & vbCrLf)
You don't have to be using ASP or VBScript to observe this behavior:
CREATE TABLE #floobar(i INT, x VARCHAR(255));
INSERT #floobar SELECT 1, 'foo \
bar';
INSERT #floobar SELECT 2, 'foo \\
bar';
INSERT #floobar SELECT 3, 'foo
bar';
SELECT * FROM #floobar;
I don't know that you're ever going to get Microsoft to fix this to not treat this character sequence special, so the "fix" is going to be to work around it. You may also have to watch out for non-traditional CR/LF, e.g. CHR(10) or CHR(13) on their own, or also vbTab (Chr(9))).