Thursday, May 30, 2013

ERROR :- Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance.

Sql Server 2008 Express Run Under Windows 7.

Connection String:- Data Source=.\SQLEXPRESS; AttachDbFilename= '|DataDirectory|\Database1.mdf'; Integrated Security=True;User Instance=True;Connect Timeout =60


Connection failed with Following Error Message.
"Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance."

Solution
 
1. Stop all user instance processes of SQL Server running under your local account (open up task manager and look for sqlsrv.exe process and end it)

2. Delete all files in the %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS folder
(In Windows XP 'C:\Documents and Settings\<<<currentuser>>>\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS)'

3. Restart sql server instance

The problem is known issue.
SQL Express cannot create a user instance using the set of engine files in your local app data folder, deleting them should allow sql server to recreate them with the correct credentials.

Wednesday, May 15, 2013

ENABLE REMOTE CONNECTION IN SQL SERVER AND ENABLE 'sa' ACCOUNT


http://www.linglom.com/it-support/enable-remote-connection-on-sql-server-2008-express/

http://sudeeptaganguly.wordpress.com/2010/04/20/how-to-enable-sa-account-in-sql-server/


ATTACH/DETACH SQL SERVER DATABASE FILE USING COMMAND PROPMT

GO TO 'Start - > Run ->
OPEN  THE TERMINAL [Using Command 'cmd']


sqlcmd -S <server\instance>



USE [master]
GO
CREATE DATABASE [database_name] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Data\<database name>.mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Data\<database name>.ldf' )
 FOR ATTACH ;
GO

---------------------------------------------------------------------------------------------------------
To verify that the database has been attached, type the following two commands:
select name from sys.databases
go
---------------------------------------------------------------------------------------------------------

TO DETACH DB

USE master;
GO
EXEC sp_detach_db @dbname = N'AdventureWorks';
GO



ADD WINDOWS FIREWALL EXCEPTION - SQL SERVER TCP PORT

Note the Sql Server port no.
Start-> Programs-> Microsoft SQL Server 2008 -> Configuration Tools ->SQL Server Configuration Manager

FROM THE TREE VIEW - SELECT Sql Server Network Configuration -> Protocols for 'SQLEXPRESS'
SELECT TCP/IP FROM THE RIGHT PANE
RIGHT CLICK -> PROPERTIES -> IP Address Tab - Note the Dynamic port No

TO ADD EXCEPTION TO WINDOWS FIREWALL
Settings -> Control panel - > Windows Firewall -> Choose Exceptions Tab
Add Port... -> Give a name and specify the port number

[IN WINDOWS 7]
# Add above port in inbound rule and also create another rule - for sqlBrowser.exe

Tuesday, May 7, 2013

To Pass Main Reports Parameter Field Value to Subreport (Crystal Reports)


Step-1 Right click on sub report container in main report, Select -> Edit Sub Report
Step-2 Create the parameter in sub report (if not exists)
Step-3 Return to Main report
Step-4 Right click on sub report container once again and select -> Change sub report links..
Step-5 Select the parameter field (defined in master report) from 'Container Report fields to link'--> Available fields  (shown in left hand side), and add it into 'Fields to Link' list box. Select the newly added field. Select the sub report parameter field name from 'Subreport parameter fields to use' combo box.

DONE..!!!