FIX: Error message when you run a “BULK INSERT” statement on a table that does not have a clustered index in SQL Server 2005 or SQL Server 2008: “spid1005 Error: 5243, Severity: 22, State: 1 An i …
Symptoms
Consider the following scenario:In Microsoft SQL Server 2005 or Microsoft SQL Server 2008, you have a table that does not have a clustered index. You run a BULK INSERT statement on this table.In this scenario, you may receive the following error message in the SQL Servererror log file:
<Date><Time> spid1005Error: 5243, Severity: 22, State: 1.
<Date><Time>2009-02-13 03:26:46.09 spid1005An inconsistency was detected during an internal operation.
<Date><Time>Please contact technical support. Reference number 8.
Additionally, a mini-dump file is generated in the SQL Server log folder.
Note This problem may occur when you run a BULK INSERT statement on a table in a database that is used by Microsoft SharePoint.
Resolution
SQL Server 2005 Service Pack 2 (SP2)Important You must use this fix if you are running SQL Server 2005 Service Pack 2 (SP2).
The fix for this issue was first released in Cumulative Update15 for SQL Server 2005 Service Pack 2. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:
972510?(http://support.microsoft.com/kb/972510/LN/) Cumulative update package 15 for SQL Server 2005 Service Pack 2Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
937137?(http://support.microsoft.com/kb/937137/LN/) The SQL Server 2005 builds that were released after SQL Server 2005 Service Pack 2 was releasedMicrosoft SQL Server 2005hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2005 Service Pack 2 hotfix to an installation of SQL Server 2005 Service Pack 2. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack. SQL Server 2005 Service Pack 3 (SP3)Important You must use this fix if you are running SQL Server 2005 Service Pack 3 (SP3).
The fix for this issue was first released in Cumulative Update5 for SQL Server 2005 Service Pack 3. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:
972511?(http://support.microsoft.com/kb/972511/LN/) Cumulative update package 5 for SQL Server 2005 Service Pack 3Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
960598?(http://support.microsoft.com/kb/960598/LN/) The SQL Server 2005 builds that were released after SQL Server 2005 Service Pack 3 was releasedMicrosoft SQL Server 2005hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2005 Service Pack 3 hotfix to an installation of SQL Server 2005 Service Pack 3. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack. SQL Server 2008Important You must use this fix if you are running the release version of SQL Server 2008.
The fix for this issue was first released in Cumulative Update 7. For more information about how to obtain this cumulative update package for SQL Server 2008, click the following article number to view the article in the Microsoft Knowledge Base:
973601?(http://support.microsoft.com/kb/973601/) Cumulative update package 7 for SQL Server 2008Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
956909?(http://support.microsoft.com/kb/956909/) The SQL Server 2008 builds that were released after SQL Server 2008 was releasedSQL Server 2008 Service Pack 1 (SP1)Important You must use this fix if you are running SQL Server 2008 Service Pack 1 (SP1).
The fix for this issue was first released in Cumulative Update4 for SQL Server 2008 Service Pack 1. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:
973602?(http://support.microsoft.com/kb/973602/LN/) Cumulative update package 4 for SQL Server 2008 Service Pack 1Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
970365?(http://support.microsoft.com/kb/970365/LN/) The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 1 was releasedMicrosoft SQL Server 2008hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2008 Service Pack 1 hotfix to an installation of SQL Server 2008 Service Pack 1. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.
Error message when you try to install SQL Server 2008 if the path of the SQL Server 2008 installation media contains a number sign (#) character: “Could not load file or assembly ‘<Path>\Mi …
Symptoms
When you try to install Microsoft SQL Server 2008 from a local path or from a network path, you receive the following error message:
Could not load file or assembly 'Path\Microsoft.SQL.Chainer.PackageData.dll' or one of its dependencies. The system cannot find the file specified.This issue occurs if the path of the SQL Server 2008 installation media contains a number sign (#) character.
Additionally, the following error message is logged in the Detail_GlobalRules.txt file:
Date Time Slp: Log provider 'Microsoft.SqlServer.Chainer.Infrastructure.LogProviderFile' has been registered
Date Time Slp: Log provider 'Microsoft.SqlServer.Chainer.Infrastructure.LogProviderStatus' has been registered
Date Time Slp: Received request to add the following file to Watson reporting: C:\Documents and Settings\Administrator\Local Settings\Temp\tmpDC5.tmp
Date Time Slp: The following is an exception stack listing the exceptions in outermost to innermost order
Date Time Slp: Inner exceptions are being indented
Date Time Slp:
Date Time Slp: Exception type: Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException
Date Time Slp:Message:
Date Time Slp:Could not load file or assembly '<Path>\Microsoft.SQL.Chainer.PackageData.dll' or one of its dependencies. The system cannot find the file specified.
Date Time Slp:Stack:
Date Time Slp:at Microsoft.SqlServer.Chainer.Infrastructure.ExtensionService.RegisterExtension(String extensionId, String name, String path)
Date Time Slp:at Microsoft.SqlServer.Chainer.Setup.Setup.LoadPackageXML(ServiceContainer context)
Date Time Slp:at Microsoft.SqlServer.Chainer.Setup.Setup.Run()
Date Time Slp:at Microsoft.SqlServer.Chainer.Setup.Setup.Start()
Date Time Slp:at Microsoft.SqlServer.Chainer.Setup.Setup.Main()
Date Time Slp:Inner exception type: System.IO.FileNotFoundException
Date Time Slp:Message:
Date Time Slp:Could not load file or assembly <Path>\Microsoft.SQL.Chainer.PackageData.dll' or one of its dependencies. The system cannot find the file specified.
Date Time Slp:Stack:
Date Time Slp:at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
Date Time Slp:at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
Date Time Slp:at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
Date Time Slp:at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
Date Time Slp:at System.Reflection.Assembly.LoadFrom(String assemblyFile)
Date Time Slp:at Microsoft.SqlServer.Chainer.Infrastructure.ExtensionService.RegisterExtension(String extensionId, String name, String path)
Date Time Slp: The following exception occurred while preparing status logs during Watson failure processing: /Datastore/InputSettings
Date Time Slp: Sco: Attempting to write hklm registry key SOFTWARE\Microsoft\Microsoft SQL Server to file C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\DateTime\Registry_SOFTWARE_Microsoft_Microsoft SQL Server.reg_
Date Time Slp: Sco: Unable to write hklm registry key SOFTWARE\Microsoft\Microsoft SQL Server to file C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\DateTime\Registry_SOFTWARE_Microsoft_Microsoft SQL Server.reg_, Win32 error 2
Date Time Slp: Sco: Attempting to write hklm registry key SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall to file C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\DateTime\Registry_SOFTWARE_Microsoft_Windows_CurrentVersion_Uninstall.reg_
Date Time Slp: Sco: Attempting to write hklm registry key SOFTWARE\Microsoft\MSSQLServer to file C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\DateTime\Registry_SOFTWARE_Microsoft_MSSQLServer.reg_
Date Time Slp: Sco: Unable to write hklm registry key SOFTWARE\Microsoft\MSSQLServer to file C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\DateTime\Registry_SOFTWARE_Microsoft_MSSQLServer.reg_, Win32 error 2
Date Time Slp: Could not load file or assembly '<Path>\Microsoft.SQL.Chainer.PackageData.dll' or one of its dependencies. The system cannot find the file specified.
Date Time Slp: Watson bucket for exception based failure has been created
Date Time Slp: Sco: Attempting to create base registry key HKEY_LOCAL_MACHINE, machine
Date Time Slp: Sco: Attempting to open registry subkey Software\Microsoft\PCHealth\ErrorReporting\DW\Installed
Date Time Slp: Sco: Attempting to get registry value DW0200
Date Time Slp: Submitted 1 of 1 failures to the Watson data repository
Date Time Slp:
Date Time Slp: ----------------------------------------------------------------------
Date Time Slp:
Date Time Slp: Error result: -2068774911
Date Time Slp: Result facility code: 1201
Date Time Slp: Result error code: 1
Resolution
This issue occurs because the Setup program cannot load an assembly from the path of the SQL Server 2008 installation media if the pathcontains a number sign (#) character.
Shrinking Session State in asp.net
ASP.NET provides two default options for storing session state across a Web farm: a session-state provider that invokes an out-of-process session-state server, and a session-state provider that stores data in a Microsoft SQL Server database. Because both options involve storing state information outside a Web application's worker process, session state has to be serialized before it is sent to remote storage. Depending on how much information a developer saves in session state, the size of the serialized data can grow quite large.
ASP.NET 4 introduces a new compression option for both kinds of out-of-process session-state providers. When the compressionEnabled configuration option shown in the following example is set to true, ASP.NET will compress (and decompress) serialized session state by using the .NET Framework System.IO.Compression.GZipStream class.
sqlConnectionString="data source=dbserver;Initial Catalog=aspnetstate"
allowCustomSqlDatabase="true"
compressionEnabled="true"
/>
With the simple addition of the new attribute to the Web.config file, applications with spare CPU cycles on Web servers can realize substantial reductions in the size of serialized session-state data.
Database Interview: What is fillfactor? What is the use of it ? What happens when we ignore it? When you should use low fill factor?
When you create a clustered index, the data in the table is stored in
the data pages of the database according to the order of the values in
the indexed columns. When new rows of data are inserted into the table
or the values in the indexed columns are changed, Microsoft® SQL
Server™ 2000 may have to reorganize the storage of the data in the
table to make room for the new row and maintain the ordered storage of
the data. This also applies to nonclustered indexes. When data is
added or changed, SQL Server may have to reorganize the storage of the
data in the nonclustered index pages. When a new row is added to a
full index page, SQL Server moves approximately half the rows to a new
page to make room for the new row. This reorganization is known as a
page split. Page splitting can impair performance and fragment the
storage of the data in a table.
When creating an index, you can specify a fill factor to leave extra
C# interview questions and answers, part 2
14. What debugging tools come with the .NET SDK?
Cordbg - command-line debugger, and DbgCLR - graphic debugger. Visual Studio. NET uses the DbgCLR. Cordbg To use, you must compile the original C # using the / debug.
15. What does assert() do?
In debug compilation, assert themselves in a Boolean condition as a parameter, and displays the error dialog if the condition is false. The program continues without interruption if the condition is true.
16. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be detailed for some applications that are constantly walking, you run the risk of overloading the machine and the hard drive there. Six levels range from None to detail, which allows you to change search activities.
17. How do you debug an ASP.NET Web application?
Attach the aspnet_wp.exe process to the DbgClr debugger.
18. What are three test cases you should go through in unit testing?
Positive check cases (correct information, correct output), negative check cases (broken or missing information, proper handling), exception check cases (exceptions are thrown & caught properly).
19. Can you change the value of a variable while debugging a C# application?
Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
20. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET information provider is high speed and robust, but requires purchasing a license for Microsoft SQL Server. OLE-DB.NET is universal for accessing other sources, such as Oracle, DB2, Informix and Microsoft Access, but it is. Network layer on top of OLE layer, so do not fastest in the world. ODBC.NET is a deprecated layer provided for backward compatibility with ODBC engines.
21. What is the wildcard character in SQL? Let’s say you want to query database with LIKE for all employees whose name starts with La.
The wildcard character is %, the proper query with LIKE would involve ‘La%’.
22. Explain ACID rule of thumb for transactions.
Transaction must be atomic (that is four units of work and not depend on previous and subsequent transactions), made (the information is confirmed or roll back, no "between" if something has been updated and something is not any), isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the information had been committed, even if the process is blocked just after).
23. What does the parameter Initial Catalog define inside Connection String?
The database name to connect to.
24. What is a pre-requisite for connection pooling?
Multiple processes must agree that they will share the same connection, where each parameter is the same, including security settings.
ADO.NET and Database Questions
- What is the wildcard character in SQL?
Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’. - What is the role of the DataReader class in ADO.NET connections?
It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed. - What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET. - What connections does Microsoft SQL Server support?
Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password). - Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?
Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction. - What does the Dispose method do with the connection object?
Deletes it from the memory.
To Do: answer better. The current answer is not entirely correct. - What is a pre-requisite for connection pooling?
Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings. The connection string must be identical. - What does the Initial Catalog parameter define in the connection string?
The database name to connect to. - Explain ACID rule of thumb for transactions.
A transaction must be:
1. Atomic - it is one unit of work and does not dependent on previous and following transactions.
2. Consistent - data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t.
3. Isolated - no transaction sees the intermediate results of the current transaction).
4. Durable - the values persist if the data had been committed even if the system crashes right after.
.NET Interview Questions on CLR
Overview of CLR integration.
The CLR (Common Language Runtime) integration is hosted in the Microsoft SQL Server 2005.
With CLR integration, stored procedures, triggers, user- defined functions, user-defined types, and user-defined aggregates in managed code, etc can be written.
As managed code compiles to native code before executing, significant performance can be achieved.
The SQL Server acts as an operating system for the CLR when it is hosted inside SQL Server.
Following are the steps to build a CLR stored procedure in SQL Server 2005
* Enable CLR integration in SQL Server 2005
* Create a CLR stored procedure Assembly
* Deploy the Assembly in SQL Server 2005
* Create and execute the CLR stored procedure in SQL Server 2005
Explain CLR in brief.
CLR stands for Common Language Runtime. The CLR is a development platform. It provides a runtime, defines functionality in some libraries, and supports a set of programming languages. The CLR provides a runtime so that the softwares can utilize its services. The CLR Base Class Library allows interaction with the runtime. The CLR supports various programming languages, several standards and is itself been submitted as an open standard.
Describe the parts of assembly.
An assembly is a partially compiled code library. In .NET, an assembly is a portable executable and can be an EXE (process assembly) or a DLL (library assembly). An assembly can consist of one or more files or modules in various languages. It is used in deployment, versioning and security.