Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • MBE 235 posts 816 karma points
    1 week ago
    MBE
    0

    Converting SFD > SQL > Syntax error when importing

    Dear everyone,

    I have a large sdf file (114mb) which I have imported into CompactView and exported as SQL.

    I create a new, empty database, opened a new query and pasted all the SQL inside but when I run it I get a lot of these errors:

    Msg 102, Level 15, State 1, Line 857175
    Incorrect syntax near ')'.
    
    Msg 102, Level 15, State 1, Line 857175
    Incorrect syntax near 'ACTION'.
    
    ALTER TABLE [cmsContentTypeAllowedContentType] ADD CONSTRAINT [FK_cmsContentTypeAllowedContentType_cmsContentType] FOREIGN KEY ([Id])
       REFERENCES [cmsContentType] () ON DELETE NO ACTION ON UPDATE NO ACTION;
    
    ALTER TABLE [cmsContentTypeAllowedContentType] ADD CONSTRAINT [FK_cmsContentTypeAllowedContentType_cmsContentType1] FOREIGN KEY ([AllowedId])
       REFERENCES [cmsContentType] () ON DELETE NO ACTION ON UPDATE NO ACTION;
    
    ALTER TABLE [cmsContentVersion] ADD CONSTRAINT [FK_cmsContentVersion_cmsContent_nodeId] FOREIGN KEY ([ContentId])
       REFERENCES [cmsContent] () ON DELETE NO ACTION ON UPDATE NO ACTION;
    
    ALTER TABLE [cmsContentXml] ADD CONSTRAINT [FK_cmsContentXml_cmsContent_nodeId] FOREIGN KEY ([nodeId])
       REFERENCES [cmsContent] () ON DELETE NO ACTION ON UPDATE NO ACTION;
    

    The list continues with these empty parentheses. I don't know SQL so it's hard for me to track down the issue.

    Do I have to install Umbraco first in the empty database? I just want to switch from SDF to SQL.

    Thank you!

  • Huw Reddick 16 posts 127 karma points
    1 week ago
    Huw Reddick
    1

    You may find it works better if you use the sqlcmd line to import the file rather than pasting it into a sql window. I've had problems in the past when just pasting large SQL files in the query windows.

    like below

    sqlcmd -S <server> -i C:\<your file here>.sql 
    

    replace

    qlcmd -S <server>\instance -i C:\<your file here>.sql
    
  • Yakov Lebski 385 posts 1499 karma points
    7 days ago
  • MBE 235 posts 816 karma points
    6 days ago
    MBE
    0

    This worked like a charm! I did however get a lot of SQL files but I used this command to combine them:

    copy /b *.sql combined-sql-database.sql
    

    Thanks for the help everone, it's much appreciated!

    // Mike

  • Huw Reddick 16 posts 127 karma points
    6 days ago
    Huw Reddick
    0

    Yes, I used the same tool. What version of SQL are you importing it into?

    Did you try loading from the sql cmd line?

Please Sign in or register to post replies

Write your reply to:

Draft