-->
Showing posts from May, 2010

Generate Comma Separated List – SQL Server

In one to many relationships of two tables, sometimes we need to write a query which can return comma separated list of all child values for each parent. Here are two different methods by which yo…

Add Column With Default Column Constraint to Table

I found many questions regarding the inline named default constraints in many user groups, its actually pretty simple CREATE TABLE dbo.tempabc ( [col1] [ varchar ] (16), [col2] [ int ] NULL CONS…

Alter column set default

CREATE TABLE dbo.tempabc ( [col1] [ varchar ] (16), [col2] [ int ] NULL CONSTRAINT df__tempabc__Col2 DEFAULT ((0)) ) ON [ PRIMARY ] GO ALTER TABLE dbo.tempabc ALTER COLUMN Col1 VARCHAR (32)…

Script to find the No of reads/ writes on DB files

SELECT DB_NAME(mf.database_id) AS databaseName ,mf.physical_name ,num_of_reads ,num_of_bytes_read ,io_stall_read_ms ,num_of_writes ,num_of_bytes_written …
Subscribe Our Newsletter