Al's BrainDump

RSS

Navigation





Quick Search
»
Advanced Search »

PoweredBy

Count(*)

If you use Count(*) then you will get the total no. of rows but if you use Count(SomeColumn) you may or may not get total no. of rows. This is because, if you have NULL values in your given column then they will not be counted and you will get the total count of Non-Null values but Count(*) will always give you Total Count regardless of NULL or Non-Null values.

CONVERT

Use CONVERT to get dates into right format:
UPDATE X SET EventDate = CONVERT(CHAR(10),dateadd(d,(23456)-2), '1/1/1900'),103)

OBJECT_ID

OBJECT_ID() is best way to see if an object exists. Can take a 2nd object type param if necessary. IF OBJECT_ID('dbo.T1') IS NOT NULL DROP TABLE dbo.T1;

ScrewTurn Wiki version 3.0.5.600. Some of the icons created by FamFamFam.