T-SQL

SQL icon baseIf you need calculate week number from date, you can use DATEPART with parameter ISO_WEEK. Unfortunately there is nothing like ISO YEAR parameter. In case you need to show YearWeek value in some report you have to take care about correct value manually.

SQL_icon_base.jpgAre you looking for simple way, how to get count of distinct values for each column in a table on MS-SQL database? There is a simple script with solution to help you.
SQL_icon_base.jpgWhen you try alter column in MSSQL 2005 from one datatype to other with some default value by ALTER TABLE xxx ALTER COLUMN column_name you get error about existing constraint. Unfortunately there is nothing like CASCADE CONSTRAINT. You must DROP constraint first and then you can ALTER column and finally you have to create CONSTRAINT again. I will show you easy way, how to do it.

SQL_icon_base.jpgCommon situation, you need to make same changes in database, and you have column name.  But you aren't sure in which tables this column is, where to look etc. Here is the simple solution.

SQL_icon_base.jpgWhen you try drop column in MSSQL 2005 with some default value by ALTER TABLE xxx DROP column_name you get error about existing constraint. Unfortunately there is nothing like CASCADE CONSTRAINT. You must DROP constraint first and then you can DROP column. I will show you the easiest way, how to do it.