WordPad formatting causes syntax error when file opened with SQL Query Editor

  • Created a text file via WordPad v5.2 R2

    Opened it with SQL 2008's editor; saw following gibberish which caused syntax errors.

    {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}{\f1\fnil\fcharset0 Courier New;}{\f2\fswiss\fcharset0 Arial;}}

    {\colortbl ;\red0\green0\blue0;}

    {\*\generator Msftedit 5.41.21.2500;}\viewkind4\uc1\pard\cf1\lang1033\f0\fs20 CREATE TABLE TryFulltextLengthFull (SourceID\tab varchar(3) NOT NULL,\par

    FxID\tab varchar(8) NOT NULL,\par

    TextSeqID int NOT NULL, TextID\tab numeric(19,0) IDENTITY (1,1) NOT NULL,\par

    TextLine\tab varchar(108) NULL, TextTimeStamp\tab timestamp NULL,\par

    RowUpdateDateTime\tab datetime NULL)\par

    GO\par

    \cf0\f1\par

    \f2\par

    }

    ___Wanted:___

    CREATE TABLE TryFulltextLengthFull (SourceID varchar(3) NOT NULL,

    FxIDvarchar(8) NOT NULL,

    TextSeqID int NOT NULL,

    TextIDnumeric(19,0) IDENTITY (1,1) NOT NULL,

    TextLinevarchar(108) NULL,

    TextTimeStamptimestamp NULL,

    RowUpdateDateTimedatetime NULL)

    GO

    ___

    Any ideas on how to get rid of the formatting? have thousands of these files.

  • First, don't use wordpad as a text editor.

    Second, exactly how did you save the files? Are you sure you saved tham as full fledge text files?

  • Created first file via Windows Explorer -> File -> New -> Text Document,

    renamed to trfxLa.SQL,

    then copied that to the others which were edited slightly & renamed.

    Now wonder if I clicked RichText Document by mistake ?

    In any case, need a way to clean them up that is less painful than editing each file.

  • May be the only way to clean up the files, sorry.

    I use either SSMS or UltraEdit when writing my SQL code, so I don't run into this problem.

  • unfortunately didn't have much choice in how to make this particular script batch.

    Thank you.

  • A nice free text editor is SciTE.

    Maybe it's also possible to use SQL Server Express studio to connect to usual SQL Server versions (I don't know that). There are many other free SQL editors.

    Flo

  • This has been resolved (the hard way). Thanks for suggestions.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply