Yearly Archives - 2010

JavaScript regular expression to match a comma delimited list

This method uses the JavaScript String's match() method to parse a comma delimited list and show its content in a Panel control. You can try it here http://jsfiddle.net/38tXU/ function parseList(list) { var reg = list.match(/\w+(,\w+)*/g); document.getElementById('pnl').innerHTML = 'Total length:' + reg.length + '<br />'; for (var i =...

Difference between inner and outer join in SQL

Joins are used to combine the data from two tables, with the result being a new, temporary table.The temporary table is created based on column(s) that the two tables share, which represent meaningful column(s) of comparison.The goal is to extract meaningful data from the resulting temporary table.Joins are performed based on something called a...

How to check SQL Server database is exists using C#.NET

The following method using sys. schema and views such as sys.databases and sys.tables.As we know that the old style sysobjects and sysdatabases and those catalog views have been deprecated since SQL Server. private static bool CheckDatabaseExists(string connectionString, string databaseName) { string sqlQuery; bool result = false; try { ...

Prevent Saving Changes That Require Table Re-creation SQL Server

I was modifying an existing table using SQL Server Management Studio, but I got this error message on saving: Saving changes is not permitted. The changes that you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option...

How to Dynamically Select rows in SQL Server

If you want to restrict other developers from using your Stored Procedures that returns a huge amount of data which affects server performance and Application Performance weather it is a Windows or Web Application. You can use the following idea when you create Stored Procedures: -- ============================================= -- Author: Amr...

How to convert DataRow to DataRowView

Converting DataRow to DataRowView is not possible, but we can go around this by using DefaultView property of the Data Row Table. The following code example demonstrate how to get DataRowView out of DataRow: DataTable dt = new DataTable(); dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("Name", typeof(string)); for (int i = 0; i < 10; i++) { DataRow tempDR = dt.NewRow(); tempDR["ID"] = (i...