Friday 19 February 2021

Creating a non-XML format file

Please review Non-XML Format Files (SQL Server) for detailed information. The following command will use the bcp utility to generate a non-xml format file, myFirstImport.fmt, based on the schema of myFirstImport. To use a bcp command to create a format file, specify the format argument and use nul instead of a data-file path. The format option also requires the -f option. In addition, for this example, the qualifier c is used to specify character data, t, is used to specify a comma as a field terminator, and T is used to specify a trusted connection using integrated security. At a command prompt, enter the following command: 


bcp TestDatabase.dbo.myFirstImport format nul -c -f D:\BCP\myFirstImport.fmt -t, -T

REM Review file Notepad D:\BCP\myFirstImport.fmt

https://docs.microsoft.com/en-us/sql/relational-databases/import-export/use-a-format-file-to-bulk-import-data-sql-server?view=sql-server-ver15 

Tuesday 9 February 2021

System.Web.HttpException: Request timed out

 Server Error in '/' Application. Request timed out. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Request timed out.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[HttpException (0x80004005): Request timed out.]

To solve the timeout issue we can specify the request timeout (in seconds) in the web.config, like this:

<httpRuntime executionTimeout="300" />

For context, here's a complete web.config with just this setting:

<configuration>
    <system.web>
        <httpRuntime executionTimeout="300" />
    </system.web>
</configuration> 

Also you can Open IIS -> click on the your siteName -> configuration Editor on the Section, scroll to system.web/httpRuntime. Increase the executionTimeout to the time you think it will take to execute your process.