Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQLCMD and inserting data


SQLCMD and inserting data

Author
Message
TeraByteMe
TeraByteMe
SSC-Enthusiastic
SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)

Group: General Forum Members
Points: 171 Visits: 589
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))
TeraByteMe
TeraByteMe
SSC-Enthusiastic
SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)

Group: General Forum Members
Points: 171 Visits: 589
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))
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search