Month: July 2010

Posted in SQL Server Uncategorized

Rename SQL Table Name

exec sp_rename ‘TimeZone’, ‘TimeZone_Old’

Posted in Asp.Net Uncategorized

Convert DateTime into Specific TimeZone wise with DayLightSavingTime Changes

DateTime date1 = Convert.ToDateTime(“15-03-2010 3:30:00 AM”); //start day of daylighttime //DateTime date1 = Convert.ToDateTime(“07-11-2010 3:30:00 AM”); //DateTime…

Posted in Asp.Net Uncategorized

Get Last 20 Records From DataSet, DataTable, DataView to DataTable

string strSort = “OperationDate Desc”; DataView dvTemp = dtEventHistory.DefaultView; dvTemp.Sort = strSort; IEnumerable dtRow = dvTemp.ToTable().AsEnumerable().Take(20); DataTable…

Posted in Asp.Net Uncategorized

Datatable.Copy() & DataTable.Clone() ???

DataTable dtCopy = table.Copy(); it will create “dtCopy” datatable with the records from “table”, DataTable dtClone =…

Posted in Asp.Net Uncategorized

Distinct records from “DataTable”, “DataView”, “DataSet”??

From DataSet DataTable dtStates = dsStates.Tables[0].DefaultView.ToTable(true, “state”); From DataTable DataTable dtResult = dtTemp.DefaultView.ToTable(true, “HistoryDate”); From DataView DataTable…

Posted in SQL Server Uncategorized

How to create new table from existing table in SQL Server

Without Any Records select * into Temp_TimeZone from ExistingTableName where 1=2 With Records select * into Temp_TimeZone…

Posted in Asp.Net Uncategorized

TimeZone : Get the date and time as per time zone

//Get the Collection of System’s Time Zones. System.Collections.ObjectModel.ReadOnlyCollection timeZone = TimeZoneInfo.GetSystemTimeZones(); //Convert time zone collection to LIST…