Thursday, August 23, 2012

Unable to open DTS package in SQL 2008 Management Studio

Problem
When trying to import a SQL Server 2000 DTS package to SQL Server 2008 R2 using SSMS, the following error occurs:



Managing DTS packages in SQL Server Management Studio requires the SQL Server 2000 Data Transformation Services (DTS) runtime. To install the DTS runtime, on your SQL Server 2008 R2 installation media, locate and run the Windows Installer package for SQL Server 2005 Backward Compatibility (SQLServer2005_BC*.msi). You can also download the DTS runtime from the SQL Server Feature Pack page on the Microsoft Download Center. (Microsoft.SqlServer.DtsObjectExplorerUI)

Solution
As suggested, the “Microsoft SQL Server 2005 Backward compatibility” package must be installed. It can be found on this location:
http://www.microsoft.com/en-us/download/details.aspx?id=3522

...

After the installation of “Microsoft SQL Server 2005 Backward compatibility” package the DTS package is imported successfully.
Now when we try to open the DTS package, the following error appears:


SQL Server 2000 DTS Designer components are required to edit DTS packages. Install the special Web download, “SQL Server 2000 DTS Designer Components” to use this feature. (Microsoft.SqlServer.DtsObjectExplorerUI)

To solve this error the “Sql Server 2000 DTS Designer Components” package must be installed. It can be found on this location:
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11988


After the installation try to open again the DTS package in SSMS.  
SQL Server 2000 DTS Designer components are required to edit DTS packages. Install the special Web download, “SQL Server 2000 DTS Designer Components” to use this feature. (Microsoft.SqlServer.DtsObjectExplorerUI)

If the same error appears, copy the DLL and RLL files as described in below Microsoft link:
http://msdn.microsoft.com/en-us/library/ms143755.aspx

To ensure that the DTS designer can be used in SQL Server Management Studio
1.       Copy the files, SEMSFC.DLL, SQLGUI.DLL, and SQLSVC.DLL, from the %ProgramFiles%\Microsoft SQL Server\80\Tools\Binn folder to the %ProgramFiles%\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE folder.
2.       Copy the files, SEMSFC.RLL, SQLGUI.RLL, and SQLSVC.RLL, from the %ProgramFiles%\Microsoft SQL Server\80\Tools\Binn\Resources\%lang_id% folder to the %ProgramFiles%\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Resources\%lang_id% folder.
       For example, for U.S. English, the lang_id subfolder will be "1033".

To ensure that the DTS designer can be used in Business Intelligence Development Studio
1.       Copy the files, SEMSFC.DLL, SQLGUI.DLL, and SQLSVC.DLL, from the %ProgramFiles%\Microsoft SQL Server\80\Tools\Binn folder to the %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE folder.
2.       Copy the files, SEMSFC.RLL, SQLGUI.RLL, and SQLSVC.RLL, from the %ProgramFiles%\Microsoft SQL Server\80\Tools\Binn\Resources folder to the %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\Resources\%lang_id% folder. For example, for U.S. English, the lang_id subfolder will be "1033".

Export DataTable to Excel File

dt = city.GetAllCity();//your datatable 
string attachment = "attachment; filename=city.xls"; 
 Response.ClearContent(); 
 Response.AddHeader("content-disposition", attachment); 
 Response.ContentType = "application/vnd.ms-excel"; 
 string tab = "";  
foreach (DataColumn dc in dt.Columns) { 
    Response.Write(tab + dc.ColumnName); 
    tab = "\t"; 
 } 
 Response.Write("\n"); 
 int i; 
 foreach (DataRow dr in dt.Rows) { 
    tab = ""; 
    for (i = 0; i < dt.Columns.Count; i++) 
    { 
        Response.Write(tab + dr[i].ToString()); 
        tab = "\t"; 
    } 
    Response.Write("\n"); } Response.End(); 

Monday, May 14, 2012

how to formate date as dd/mm/yyyy in c#

string dateString = String.Format("{0:MM/dd/yyyy}",dt.Rows[incriment]["wdate"]);

Thursday, May 10, 2012

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider)

1)Go to All Programs >> Microsoft SQL Server 2005/2008 >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Services, and check if SQL Server service status is “Running”.


2)1)Go to All Programs >> Microsoft SQL Server 2005/2008 >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server netwok confi.>Protocol for mssql>tcp/ip make it true


3)go to sql login>right click on sql(sql server)>connection >true allowo remote connection true





Monday, May 7, 2012

BSE STOCK TIPS

5/7/2012 (BSE STOCK TIPS)
buy jsw steel at 721 target 1000 in month
20/03/2013 (BSE STOCK TIPS)
buy mcx 888 target 1150 in 2 month

Wednesday, April 18, 2012

Adding an identity to an existing column

BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLESET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION

GO

GOCREATE TABLE dbo.Tmp_User
    (
    UserID int NOT NULL IDENTITY (1, 1),
    LastName varchar(50) NOT NULL,
    FirstName varchar(50) NOT NULL,
    MiddleInitial char(1) NULL

    )  ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_User ON
GOIF EXISTS(SELECT * FROM dbo.[User])
 EXEC('INSERT INTO dbo.Tmp_User (UserID, LastName, FirstName, MiddleInitial)
    SELECT UserID, LastName, FirstName, MiddleInitialFROM dbo.[User] TABLOCKX')
GOSET IDENTITY_INSERT dbo.Tmp_User OFF
GO

GODROP TABLE dbo.[User]
GOEXECUTE sp_rename N'dbo.Tmp_User', N'User', 'OBJECT'
GOALTER TABLE dbo.[User] ADD CONSTRAINT
    PK_User PRIMARY KEY CLUSTERED 
    (
    UserID
    ) ON [PRIMARY]

GOCOMMIT