How to find a column name in SQL Server database

13. August 2009
Sometimes, there is a need to find a column in SQL Server database, and we have no clue what so ever, where in this huge set of tables, this column would lie. One way to quickly narrow down the search is to use this following query:     SELECT name colname FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE... [More]

SQL

Understand the Replication Models in SQL Server 2008

30. January 2009
The architecture for the replication process is extensive. This ensures that the architecture is versatile enough to meet the needs of almost any replication situation. Unfortunately, this versatility also makes replication tricky to configure. To make the replication go smoothly, you should do a bit of planning, which involves selecting a specifi... [More]

SQL

Monitor SQL Server Performance and Activity with Built-In Functions

30. January 2009
SQL Server 2008 includes a new “eventing” mechanism called SQL Server Extended Events that enables some sophisticated troubleshooting. Get an overview of Extended Events and find out how you can use this new functionality for monitoring and troubleshooting. In addition to having the use of log files and Transact-SQL statements, you will find a set... [More]

SQL

Delete duplicate rows from table in SQL

29. November 2008
Suppose there is a table called "EmployeeTable" which have some duplicate records. There is a three way to delete the duplicate rows. First way to delete duplicate rows : Select distinct * into Emp_Temp_Table from EmployeeTable In the above line we are inserting all the distinct row of the "EmployeeTable" to another table "Emp... [More]

SQL , ,

SQL Query To Filter Out Clients With Invalid System Enclosure Asset Tag Information

9. September 2008
This SQL Query will filter out all of the invalid system enclosure asset tags using NOT NULL, Not Like (<>) and NOT IN SQL commands. SQL Query: Select SD.Name0 'Machine Name', SD.User_Name0 'User Name', SE.SmBiosAssetTag0 'Asset Tag' From v_R_System SD Join v_GS_System_Enclosure SE On SD.ResourceID = SE.ResourceID Where SD.Client0 = '1' And S... [More]

SQL

Using COALESCE function to concatenate column data in sql query

16. August 2008
May time we need column's data into a single row from a database table. This is easy to do if we are doing this at application level. However this could also be done in a sql query as well. For example, suppose we have a table for "Employees":SELECT * FROM Employees EmpId EmployeeName ----------------------- 1001 Susan 1002 ... [More]

SQL

SQL to show all column or field names of the specified table

14. July 2008
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '<TableNameGoesHere>' Tags: SQL

SQL

SQL How To - Syntax of INNER JOIN, EQUIJOIN and NATURAL JOIN

30. May 2008
 An INNER  JOIN combines the records from two tables using comparison operators in a condition. Columns are returned only where the joined rows match the condition. Here the quick review of the syntax of the INNER JOIN:  SELECT somecolumns FROM table1 INNER  JOIN table2 ON someconditionIf the condition... [More]

SQL