SQLCMD and inserting data

  • I am not that familiar with SQLCMD. I am calling a main script which in turn calls other script files. All the other scripts work fine but I am having a problem with only one. In this script I am inserting data into three tables that do have foreign constraints between them. I have no problem running the script in a query window of SSMS when I first drop the constraints, then insert the data, and then add the constraints back. However, when I call the file form the main script it fails with foreign constraint errors. I don't understand why the contents in the file wouldn't be handled in the same way it is when run through SSMS? It is driving me nuts. The worse part is my manager did run it shortly before I got there - i started a week long project leading up to the deployment of their website - and now the thing doesn't work, and I look like the one who broke it. This one file is just many that process the same way. First the tables are created, then the constraints are added, and then data is inserted. Has anyone have any idea what maybe causing the problem?

    A clever person solves a problem. A wise person avoids it. ~ Einstein
    select cast (0x5365616E204465596F756E67 as varchar(128))

  • Nevermind, I got it working. I was missing a GO batch command after the statement.

    A clever person solves a problem. A wise person avoids it. ~ Einstein
    select cast (0x5365616E204465596F756E67 as varchar(128))

Viewing 2 posts - 1 through 1 (of 1 total)

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