February 3, 2005 at 4:33 pm
Dear Experts,
I am having a very odd problem writing Transact-SQL. I am writing a text file in MS Word and then running osql on the command line to execute it. Whenever the parser or compiler or whatever reaches a quotation mark in the text file, it generates an error. It doesn't matter if it's a single or double quotation mark--it can't handle it. The command line complains and shows the character as some bizarre non-quotation mark. Setting QUOTED_IDENTIFIER on and off makes no difference. I can load my database fine, unless I try to put a string value in. I can do that by concatenating CHAR(123) and so on, because that doesn't use quotes, but that's not very pleasant, and there is other SQL syntax that seems to require quotes (such as ...like...'blahblah'). If I do the same things using Visual Basic and .execute commands, I have no trouble. I wonder if I am having problems because I have Japanese text things loaded, even though the language is set to US_English. Sometimes ordinary characters such as slashes display as Kanji, although they are recognized just fine by all other software.
I'm grateful for any advice,
Michael Corey
February 4, 2005 at 2:31 am
Try using notepad or another dedicated (ie. better) text editor (ultraedit, etc.) to write the text file.
Word is not very good at writing simple text.
Steven H
February 4, 2005 at 2:32 am
I suspect Word is automatically formatting your quotation marks as 'smart quotes' (ie the curly ones). This is from the Word 2002 help file, I'm sure a similar process applies to other versions:
Microsoft Word automatically changes straight quotation marks ( ' or " ) to curly (smart or typographer's) quotes ( or ) as you type.
To turn this feature on or off:
Note You can find and replace all instances of single or double curly quotes with straight quotes in your document. To do this, clear the "Straight quotes" with "smart quotes" check box on the AutoFormat As You Type tab. On the Edit menu, click Replace. In both the Find what and Replace with boxes, type ' or ", and then click Find Next or Replace All.
To replace all straight quotes with curly quotes, select the "Straight quotes" with "smart quotes" check box, and repeat the find and replace procedure
The lesson is: don't use a word processor as your text editor
February 4, 2005 at 5:16 pm
Right!! Thanks to you and Stephen for being heroic.
Michael
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply