If you would like to see the row count of each table in a database and you don’t want to go through every single table……
SELECT ID FROM yourTable GROUP BY ID HAVING (COUNT(ID) > 1) In SQL 2005+ you can do the following and get all of the columns:……
If you have a multiselect parameter but you would like to have the “None” option added to it here is how you can accomplish it.……
In order to check is a Date is the same as today use the following code: DATEDIFF(d, SOMEDATE, GETDATE()) = 0 Tweet Tweet
Here is how you get the 00:00:00 timestamp for GETDATE() or any other date: SELECT DATEADD(d, DATEDIFF(d, 0 , DATEADD(d, 1, GETDATE())),0) Tweet Tweet
If you would like to find the start and the end of a Quarter based of a date here is the t-sql code you will……
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME=’table_name’ and COLUMN_NAME in (‘column_name’,’column_name2′) OR SELECT ORDINAL_POSITION ,COLUMN_NAME ,DATA_TYPE ,CHARACTER_MAXIMUM_LENGTH ,IS_NULLABLE ,COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ‘youtablename’ ORDER……
If you have a single select parameter but you would like to have the “Select All” option added to it here is how you can……
The problem of trying to use DISTINCT when you have a ntext field is that it will not let you do it. So here is……
The problem with case statements is that usually each one takes up a row for itself and then assigns a NULL value for the next……