Search This Blog

December 22, 2011

Adventure Work Sample Database download for Sql Server

You can download AdventureWork database from the following link.

http://msftdbprodsamples.codeplex.com/

December 20, 2011

SilverLight Promlems and solutions

Q1. Disgner window displays the following error message without displaying silverlight GUI

System.ArgumentNullException
Value cannot be null.Parameter name: parentContext


ANS. Restart the VisualStudio and reload the project.

August 30, 2011

How to generate comma seprated values from rows of data in Sql Server

/*Before converting to comma separated values*/
SELECT NAME
FROM SYS.databases
order by name

/*Declare a variable to store the comma separated value*/
DECLARE @NameString VARCHAR(MAX)
SELECT @NameString =''

/*Convert the Rows to Comma Separated values*/
SELECT @NameString = @NameString + ISNULL(NAME,'')+', '
FROM SYS.databases
order by name

/* Remove the comma at the end of the value*/
SELECT @NameString = LEFT(@NameString,LEN(@NameString)-1)

/*Display the Comma seprated values*/
SELECT @NameString AS Name



Second Method


/*Before converting to comma separated values*/
SELECT NAME
FROM SYS.databases
order by name

/*Declare a variable to store the comma separated value*/
DECLARE @NameString VARCHAR(MAX)

/*Convert the Rows to Comma Separated values using COALESCE function*/
SELECT @NameString = COALESCE(@NameString + ', ','') + Name
FROM SYS.databases
order by name

/*Display the Comma separated values*/
SELECT @NameString AS Name


May 05, 2011

How to generate SQL (INSERT) Script for existing data in MS SQL Server

• Select the Database in SQL Server Management Studio (SSMS)
• Right Click on the Database
• Select Tasks then Generate Scripts
• In “Generate and Publish Scripts” wizard
• Select the required tables
• In “set Scripting Options” window select “Advanced
• Under General tab
o Types of data to script Select the value as “Data Only