2010/06/10

Enabling xp_cmdshell in SQL Server

EXEC master.dbo.sp_configure 'show advanced options', 1

RECONFIGURE

EXEC master.dbo.sp_configure 'xp_cmdshell', 1

RECONFIGURE

2010/05/04

SSIS Deployment to SQL Server

SSIS Deployment to SQL Server


1) Go to SSIS project folder\bin\, double click the DeploymentManifest file
2) Choose “SQL Server deployment”.
3) Fill in the information then you are done.

2010/04/22

SSIS - read excel column as text (string)

Case: when you use SSIS to input excel data, and one of the column contains number and letter like this:

[Column A]
700
700
800
800A

When you try to use SSIS to read the excel and import to MSSQL database, 800A will then become null value and you have no idea what the heck is going on...

To solve the problem:
In SSIS, click on your connection manager in connection manager panel. Look up ConnectionString in properties panel (on your right hand side) and fix your connection string like this:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Profiles\alanhui\Desktop\CMP Data Conversion\template\DataConversion-Step1.xls;Extended Properties="EXCEL 8.0;HDR=YES;IMEX=1;";

IMEX=1 is the key factor to solve this problem.

To learn more about this, you can go to the following website:
http://support.microsoft.com/kb/194124

Enjoy

2010/04/21

SQL - How to reset identity increment value is MSSQL?

run the script below...BRAVO!

DBCC CHECKIDENT ( #table_name# ,RESEED, #number_starting_from#)

#table_name# = the table you wish to reset the identity increment
#number_starting_from# = the number you wish to reset to. For example, if you wish to start your new item at 1, then put in 0, like the example below:

DBCC CHECKIDENT ( my_table ,RESEED, 0)

Enjoy!

2010/04/09

Enabling the table for SQL Cache Dependency

To enable the table for SQL Cache dependency

First go to c:\WINDOWS\Microsoft.NET\Framework\versionNumber
Then type in the following command:
aspnet_regsql -S [DB server] -U [user name] -P [password] -d [DB name] -ed -et -t [table]

2010/02/23

Microsoft Visio

For Microsoft Visio

To show table column properties (like varchar(100)), click on Database, Option, Document, click on table tab, then check for Data Types - show physical.

2009/10/09

C# - Sys.webforms.pagerequestmanagerparsererrorexception: the message received from the server could not be parsed

Error: Sys.webforms.pagerequestmanagerparsererrorexception: the message received from the server could not be parsed

Problem: if you are using updatepanel (ajax) then you have to follow the list below:

(To start with, don't do anything from the preceding list! Here's a matching list of how to avoid a given error (when possible):

  1. Calls to Response.Write():
    Place an or similar control on your page and set its Text property. The added benefit is that your pages will be valid HTML. When using Response.Write() you typically end up with pages that contain invalid markup.
  2. Response filters:
    The fix might just be to not use the filter. They're not used very often anyway. If possible, filter things at the control level and not at the response level.
  3. HttpModules:
    Same as response filters.
  4. Server trace is enabled:
    Use some other form of tracing, such as writing to a log file, the Windows event log, or a custom mechanism.
  5. Calls to Server.Transfer():
    I'm not really sure why people use Server.Transfer() at all. Perhaps it's a legacy thing from Classic ASP. I'd suggest using Response.Redirect() with query string parameters or cross-page posting.

Another way to avoid the parse error is to do a regular postback instead of an asynchronous postback. For example, if you have a button that absolutely must do a Server.Transfer(), make it do regular postbacks. There are a number of ways of doing this:

  1. The easiest is to simply place the button outside of any UpdatePanels. Unfortunately the layout of your page might not allow for this.
  2. Add a PostBackTrigger to your UpdatePanel that points at the button. This works great if the button is declared statically through markup on the page.
  3. Call ScriptManager.RegisterPostBackControl() and pass in the button in question. This is the best solution for controls that are added dynamically, such as those inside a repeating template.

Enjoy!