Home Dashboard Directory Help
Search

Invoke-Sqlcmd erroneously Inserts multiple rows when check constraint occurs by cashfoley


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 811560
Opened: 12/13/2013 1:52:36 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

I was prototyping using Invoke-Sqlcmd using the script at http://msdn.microsoft.com/en-us/library/ms188792.aspx

I was getting strange behavior with duplicate entries. I tested the script using sqlcmd.exe and had no issues.

I simplified the example to use one table with a check constraint and was able to reproduce the error.

In my steps to reproduce, if you remove the line inserting 4 you correctly get 1,2,3

The same error occurs if you pass the query by parameter
> Invoke-Sqlcmd -ServerInstance $Server -Database $Database -Query $Query

If you execute the query using sqlcmd.exe it works correctly

> & sqlcmd -S $Server -d $Database -i $TempFile

Details
Sign in to post a comment.
Sign in to post a workaround.