Tag Archives: MSSQL

Clear all connections to a MSSQL database

Simple script to close all connections to a MSSQL database. USE master; GO ALTER DATABASE dbName SET SINGLE_USER WITH ROLLBACK IMMEDIATE; GO ALTER DATABASE dbName SET MULTI_USER; GO
Posted in MSSQL | Tagged | Comments closed

Getting the auto generated id after insert in MSSQL

With thanks to some smart people on the CFTalk mailing list, here is a concise strategy for getting an automatically generated primary key id after inserting a record into an MSSQL database. Suppose you have a table Person with fields: personId – int, auto Id, Primary Key firstName – varchar lastName – varchar To insert [...]
Posted in MSSQL | Tagged | Comments closed