About 152,000 results
Open links in new tab
  1. How to check if a Constraint exists in Sql server?

    Mar 23, 2010 · FROM sys.objects WHERE type_desc LIKE '%CONSTRAINT' AND OBJECT_NAME(OBJECT_ID)='XYZ' If you need even more constraint information, look inside …

  2. Turn off constraints temporarily (MS SQL) - Stack Overflow

    Inside the loop, the code builds the ALTER TABLE command differently depending on whether the intention is to disable or enable the foreign key constraint (using the CHECK or NOCHECK …

  3. How do I get constraints on a SQL Server table column

    31 I have a column called MealType (VARCHAR) in my table with a CHECK constraint for {"Veg", "NonVeg", "Vegan"} That'll take care of insertion. I'd like to display these options for selection, …

  4. How can I check if a SQL Server constraint exists?

    Jul 6, 2013 · I want to be able to check if there is a constraint existing before I drop it. I use the code above with a type of 'U' for tables. How could I modify the code above (change the xxxx) …

  5. sql - WITH CHECK ADD CONSTRAINT followed by CHECK …

    Feb 10, 2009 · The first syntax is redundant - the WITH CHECK is default for new constraints, and the constraint is turned on by default as well. This syntax is generated by the SQL …

  6. Microsoft SQL Server : check constraint with generated name

    Jan 10, 2022 · In T-SQL, it's normally best to name all constraints you create, including check constraints. alter table mytable with check add constraint myconstraint check (mycol > 0) If …

  7. sql - How do I find a default constraint using …

    Sep 27, 2008 · I'm trying to test if a given default constraint exists. I don't want to use the sysobjects table, but the more standard INFORMATION_SCHEMA. I've used this to check for …

  8. Limit SQL Server column to a list of possible values

    Aug 16, 2012 · For column with more possible values maybe choose tinyint type and then with a check constraint like "<= 10". Say a column has 10 possible values then a constraint "< 10" will …

  9. sql - I need a check constraint on two columns, at least one must …

    Sep 29, 2014 · I have a table in SQL Server with two numeric columns. At least one of these numeric fields must be filled. How do I write a check constraint to verify this?

  10. Deleting a SQL row ignoring all foreign keys and constraints

    The SQL statement to delete the row always times out. From my design, I know the row I wish to delete is never referenced any where else. Hence I would like SQL to ignore having to check …