affiliate_link
Showing posts with label SQL Server. Show all posts
Showing posts with label SQL Server. Show all posts

Wednesday, February 15, 2012

Altering table adding columns

Alter Table TableName

Add    [ColumnName1] [float] NULL,
           [ColumnName2] [nvarchar](50) NULL,
          

Tuesday, September 13, 2011

How to find trigger assosiated with a table ?

select 'alter table '+quotename(s.name)+'.'+quotename(object_name(o.parent_obj))+ ' disable trigger '+quotename(o.name)
from sys.sql_modules m
join sys.sysobjects o on m.object_id=o.id
join sys.schemas s on s.schema_id = o.uid
where o.type='tr'
and definition like '%TABLENAME%'

Thursday, April 16, 2009

Formatting DateTime to Date in SQL

Select convert(varchar(10),GetDate(),101)

Output: 04/16/2009

Select convert(varchar(10),GetDate(),103)

Output: 16/04/2009

Tuesday, December 2, 2008

Executing a SQL script using ADO.NET

The following article is a good starting point

http://www.mattberther.com/2005/04/11/executing-a-sql-script-using-adonet/