Tag: database

How do you unit test your T-SQL

How do you unit test your T-SQL? Which libraries/tools do you use? What percentage of your code is covered by unit tests and how do you measure it? How do you decide which modules to unit test first? Do you think the time and effort which you invested in your unit testing harness has paid […]

SQL Server 2008 R2 Stuck in Single User Mode

Having executed a DB deploy (from a VS SQL Server database project) on a local database, which failed, the database has been left in a state where it has single user mode left on (the deploy runs as single user mode). When I connect to it from SSMS and try something like the following: ALTER […]

Why database designers do not make IDENTITY columns start from the min value rather than 1?

As we know, In Sql Server, The IDENTITY (n,m) means that the values will start from n, and the increment value is m, but I noticed that all database designers make Identity columns as IDENTITY(1,1) , without taking advantage of all values of int data type which are from (-2,147,483,648) to (2,147,483,647), I am planning […]

How do you migrate SQL Server Database Diagrams to another Database?

My team recently rebuilt their SQL Server 2005 development database from scratch using the TFS source files. Afterwards, we had a nice clean database that more closely matched our test and production environments. However, we also lost the database diagrams that had been created over the months in the old development database. Does anyone know […]

Why is “close existing connections to destination database” is grayed out on SQL Server 2012 Management Studio?

I am normally using SQL Server 2012 Management Studio to restore a SQL Server database from a “bak” file. I do this by overwriting an existing database. In the “Options” page, there is a check-box labeled “Close existing connections to destination database”, which I mostly check because the target database is always “in use”, even […]

Which tools do people use to create Data Dictionaries?

On the project that I am working on I have a couple of databases. Each table and each column in the database has a description set (as an extended property in SQL 2005). As a part of the documentation going to the client we need to produce a data dictionary showing all of the tables […]

SQL Query – how do filter by null or not null

I want to filter a record…. If statusid is null, filter the record (where statusId is not null) If statusid is not null, filter the record where statusid is equal to the specified statusid. How do I do this?

How come the message “Table is marked for deletion” keeps appearing?

Using SQL Server 2008 and I’m doing some schema construction in the Management Studio designer. I created a table early in the process called “Animal”, but then decided to delete shortly after. I deleted it via the tree view in Management Studio (right-click delete). Now I’m late in the process, I would like to recreate […]

A powerful management tool for MySQL with similar features to SQL Server Management studio

I am currently working with a developer who is experienced at Ms-SQL, but not much at MySQL. He has been cursing MySQL for having Bugs, and also being far harder to use. Is is because his experience has been so good with Management studio. It seems to me that his problems are with using phpMyAdmin. […]

Sharing data between SQL databases

I’m trying to solve a problem, that for once, I didn’t create. I work in an environment with many web apps backed by different databases on different servers. Each database is rather unique in its design and application but there still remains common data in each that I would like to abstract out. Each database, […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.