This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Adapted from Jon Galloway: http://weblogs.asp.net/jgalloway/archive/2006/04/12/442616.aspx | |
-- This couldn't handle multiple schemas in the same table. Fixed. | |
-- Removed concat to widen support to earlier versions of MSSQL. | |
CREATE PROCEDURE [dbo].[sp_drop_constraints] | |
@database [sysname] = NULL, | |
@table [sysname], | |
@verbose [bit] = 0 | |
AS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. Fill out the DbName. | |
-- 2. Run Script | |
-- 3. Select column with scripts | |
-- 4. Copy to another the column | |
-- 5. Paste scripts into new scripts screen and execute | |
DECLARE @Db varchar(100) = 'TechShare-Prosecutor_midland-smoke-test' | |
SELECT 1, 'USE [' + @Db + ']' | |
-- Drops unique and foreign key constraints | |
UNION SELECT 2, 'ALTER TABLE [' + @Db + '].[' + CONSTRAINT_SCHEMA + '].['+ TABLE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- turn off constraints on db | |
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' | |
-- turn on constraints on db | |
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>json serialize form</title> | |
<script src="https://code.jquery.com/jquery-2.1.3.js"></script> | |
<script type="javascript/text"> | |
$.fn.serializeForm = function () { | |
var serializedObject = {}; | |
var inputsArray = this.serializeArray(); | |
for (var i = inputsArray.length - 1; i >= 0; i--) { | |
var input = inputsArray[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//catch EF Exceptions and report them in fixie | |
namespace Test.Tests | |
{ | |
using System; | |
using System.Data.Entity.Validation; | |
using Fixie; | |
public class CustomConvention : Convention | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (SqlConnection conn = new SqlConnection(strConn)) | |
using (SqlCommand cmd = new SqlCommand(strQuery, conn)) | |
using (SqlCommand cmdReset = new SqlCommand("DBCC CHECKIDENT('Doctor', RESEED, 0)", conn)) | |
using (SqlCommand cmdUnCheck = new SqlCommand("alter table [dbo].[Doctor] nocheck constraint all",conn)) | |
using (SqlCommand cmdCheck = new SqlCommand("alter table [dbo].[Doctor] with check check constraint all",conn)) | |
{ | |
// do stuff | |
} |