-
Help with Insert into
My problem that I got is that I want data with a special character inserted into my database. The character what I'm talking about is this one: '. But as you can gess it gives an error. What should I do?
I tried it with [] but that didn't work.
help me please.
-
You need to put another single quote next to any single quote that you want to insert. For example, if you want to insert the word: can't, use this syntax:
INSERT INTO YourTable VALUES('can''t')
As another example, if you want to insert a word and include the single quotes around it, like: 'hello', then use this:
INSERT INTO YourTable VALUES('''hello''')
Rule of thumb: in any SQL statement, you need to have an even number of single quotes in the statement.
-
Whenever I insert or select end-user free form text, I always use the replace function. Replace 1 single quote with two for the insert and 2 single quotes with 1 for the select.
-
thanks guy's this helped me alot.
now my site will run smoothly
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|