List/Grid

Tag Archives: SQL

Generate GUID In SQL Server

T0 Generate a new GUID in sql server, we can use NEWID() SELECT NEWID() GUID are always helpful. They can be used to generate global temporary tables. As a replacement… Read more »

Convert Columns to a Comma Separated string – sql server

To get the values of a column in a comma separated string, we can use for xml. SELECT SUBSTRING( (SELECT ‘,’ + COLUMN_NAME FROM TABLE FOR XML PATH(”)),2,10000)

Pass A DataTable To A Stored Procedure SQL Server 2008

From SQL Server 2008, now we can pass a DataTable from .NET as a parameter to SQL stored procedure. We need to create a User Defined Table Type, which will… Read more »

How SQL Server Works

When you submit a change to SQL Server—using either an INSERT, UPDATE, or DELETE statement—the product doesn’t actually run out to the database file on disk and make your changes…. Read more »

Running OpenRowSet on 64 Bit SQL Server

To run openrowset on 64 bit sql server. Install Microsoft Access Database Engine 2010 Redistributable on server from this link 1. http://www.microsoft.com/downloads/en/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en Change the connection string from “Microsoft.Jet.OLEDB.4.0″ to “Microsoft.ACE.OLEDB.12.0″

OVER / PARTITION BY – SQL Server

These features are available in SQL server 2005 and above. Prior to this, if we have to do a group by on column A and we also require other columns… Read more »

ABS function in SQL

Most of the time when it is required to check that a number is > Constant and < Negative Constant Then I use to create 2 variables, may be I… Read more »

Execute Stored procedure on a remote server

To execute stored procedure on a random remote server use the following. Add server as a linked server at runtime and execute the proc IF @@SERVERNAME <> @PrevServerName BEGIN IF… Read more »

EventData() in SQL

EventData() function is provided by sql server and you can access this function inside database level triggers. It returns the event information of a DDL in form of XML. Like… Read more »

SQL Commands

Here are the few basic commands that one must be aware before even opening sql server. SELECT : use to select data from a database Syntax : SELECT Column_1,Column_2 FROM… Read more »