#130 <sql> truncates data

open
nobody
None
5
2007-11-23
2007-11-23
UserAcc
No

I have a .sql file (attached to this message) :

BEGIN TRANSACTION

INSERT INTO [dbo].[Currency] ([CurrencyID], [CurrencyCode], [CurrencyName], [CurrencySymbol], [CurrencyDec]) VALUES (93, 'MNT', 'MONGOLIAN TUGRIK', N'$', 2)
COMMIT TRANSACTION

when I try to execute <sql> with this file I get an error:

[loadtasks] Scanning assembly "NAnt.Contrib.Tasks" for extensions.
[sql] SQL Error: Incorrect syntax near 'MON'.
[sql] Unclosed quotation mark after the character string 'MON'.
[sql] Statement: BEGIN TRANSACTION
[sql] INSERT INTO [dbo].[Currency] ([CurrencyID], [CurrencyCode], [CurrencyName], [CurrencySymbol], [CurrencyDec]) VALUES (93, 'MNT', 'MON

BUILD FAILED - 2 non-fatal error(s), 0 warning(s)

If I remove "G" from "MONGOLIAN" the <sql> executes with no errors.

Another statement that does not execute:

INSERT INTO [dbo].[Currency] ([CurrencyID], [CurrencyCode], [CurrencyName], [CurrencySymbol], [CurrencyDec]) VALUES (59, 'HTG', 'HAITI GOURDE', N'$', 2)

again, if I remove the second "G", it works fine

here is my script:
<target name="c">
<loadtasks assembly="${nantcontrib.dir}/NAnt.Contrib.Tasks.dll" />
<sql connstring="Provider=SQLOLEDB;Data Source=${srv.name};Initial Catalog=${db.name};${sql.logon}" delimiter="GO" delimstyle="Normal" source="${branch.dir}/Database/SQLData.sql" batch="false" />
</target>

Discussion

  • UserAcc
    UserAcc
    2007-11-23

     
    Attachments
  • Logged In: YES
    user_id=1825905
    Originator: NO

    Need to set delimstyle="Line" as delimstyle="Normal" tells it to take the GO in MONGOLIAN (and HAITI GOURDE) as a delimiter. Generally delimstyle="Line" is for strings (e.g. GO), delimstyle="Normal" is for semi-colon and the like.