VS 2012 with SSDT June 2013 check constraint with BETWEEN not handled correctly - by dejann

Status : 


Sign in
to vote
ID 794319 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 7/17/2013 4:30:29 PM
Access Restriction Public


When creating a CHECK COSTRAINIT using a word BETWEEN, this is allowed. 
For example CHECK CONTRAINT ReportMonth BETWEEN 1 and 12

When deployed to the database SQL server converts this to 
CHECK CONSTRAINT ReportMonth >= 1 and ReportMonth <= 12

When the project is deployed again, the check constraint will be dropped and recreated every time. 
Sign in to post a comment.
Posted by Microsoft on 7/29/2013 at 2:14 PM
Hi dejan1,

Looking at your description again, I got your point now. The constraint should not be dropped and recreated on subsequent deployment if it really hasn't changed.

I am investigating a fix for this issue.

Posted by Microsoft on 7/29/2013 at 2:06 PM
Hi dejan1,

Can you please provide the version of "SQL Server Data Tools" that you are using? To check the version in Visual Studio, go to Help\About and look at the vesion of "SQL Server Data Tools" in the list. You should have the latest, which is 11.1.30618.1.

On this version of "SQL Server Data Tools", I have tried the following repro, but the CHECK constraint was only created once on several deployments to the same database.

CREATE TABLE [dbo].[Table1]
    [c1] INT NOT NULL,
    CHECK (c1 BETWEEN 1 and 5)

Please let me know what are the exact repro steps that you are using to get the constraint created twice. Also, make sure that you don't have the "un-named" CHECK defined twice (once in table and another in alter statement), as that might be the reason why you're having two instances of the constraint created.

Posted by Microsoft on 7/18/2013 at 4:52 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 7/17/2013 at 4:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)