February 2012

Convert Date into Integer like YYYYMMDD in SSIS package

by Ali Raza Zaidi on February 29, 2012

i used following Expression in  Integer values expression shap

 

(DT_WSTR, 4) YEAR( @[User::StartDate]  )  +
Right("0"+ (DT_WSTR, 2) MONTH( @[User::StartDate] ) ,2) +
Right("0"+ (DT_WSTR, 2) DAY( @[User::StartDate]  ) ,2)

It convert the date into integer like  20120229

{ Comments on this entry are closed }

Cumulative update package 4 for BizTalk Server 2010 is now available and it is a rollup update that contains the following items:

  • All previously released hotfixes for BizTalk Server 2010
  • Some hotfixes for Microsoft BizTalk Server 2009 and for Microsoft BizTalk Server 2006 R2
  • Some other fixes that improve the product

This cumulative update package for Microsoft BizTalk Server 2010 contains hotfixes for the BizTalk Server 2010 issues that were resolved after the release of BizTalk Server 2010.

Hotfixes that are included in cumulative update package 4 for BizTalk Server 2010

BizTalk Server EDI support

  • 2642402: FIX: An EDI pipeline does not work after you install BizTalk Server 2010 CU1 or BizTalk Server 2010 CU2
  • 2662496: FIX: Incorrect outbound messages if the Envelopes default transaction type is not set to the HIPAA 277_A message in BizTalk Server 2010
  • 2662536: FIX: Invalid value for the AK301 segment when you receive an EDI message that has a bad segment identifier in BizTalk Server 2010

BizTalk Server Message Runtime and Pipelines

  • 2672494: FIX: The BizTalk Server MessageBox database grows very large because records are not cleared in the EqualsPredicate2ndPass table in BizTalk Server 2010
  • 2662532: FIX: A “Backup BizTalk Server (BizTalkMgmtDb)” job on BizTalk Server 2010 fails when you try to back up a custom database

Collapse this tableExpand this tableBizTalk Server Management Tools

  • 2673264: FIX: “Error saving map. Stored procedure returned non-zero result.” error message when you deploy the BizTalk Server 2010 applications in BizTalk Server 2010 Administration Console
  • 2672496: FIX: A 64-bit application that uses the Microsoft.BizTalk.ExplorerOM.dll file fails if the BizTalk Management Database is on a named instance in BizTalk Server 2010

Note: It is recommended that you test hotfixes before you deploy them in a production environment. Because the builds are cumulative, each new update release contains all the hotfixes and all the security updates that were included in the previous BizTalk Server 2010 update release. However, it is recommended that you consider applying the most recent BizTalk Server 2010 update release.

To know more about this CU check Microsoft Help and Support.

Original post by Guru Venkataraman (BizTalk Customer Response Team) here

{ Comments on this entry are closed }

Currently i have to make query dynamic, i have to  pass date variable to query to execute for specific date range, and this date range could be very time by time, Previously I tried for script component or expression of variable to build query but failed, but then I found command option of  oledb command. I placed query there with “?” sign at places where my parameter will replace the date value . Consider following

 

When I passed query there Parameter button on wizard activate.  I set there variable to parameter .

 

 

This approach is work fine for me, but if you have places are more then 3 to 4 , query parsing failed. so you have to write query in such a way that minimum number of places parameter are used.

{ Comments on this entry are closed }

Delete with identity reset

by Ali Raza Zaidi on February 27, 2012

I am dropping the rows but insertion start with next to last max identity . Something was missing in my knowledge. To reset Identity i have use one extra statement, other option is use trunc  statement to drop rows.  but if i have too drop rows with delete statement and reset the identity what should do,   i have to use

DBCC CHECKIDENT("table_name", RESEED, "reseed_value")
This will reset identity back to 1. for example

DELETE from tblstudent;

DBCC CHECKIDENT("tblstudent, RESEED, 0)



{ Comments on this entry are closed }

How to extract date and time in Tsql

by Ali Raza Zaidi on February 27, 2012

I extract date and time  from dateTime filed in TSQL as

 

select

CAST(CONVERT(varchar(8),vm_dm_StudentDet.Dep,112) AS int) DepDate,
Cast(CONVERT(VARCHAR(8),vm_dm_StudentDet.Dep,108) AS time) DepTime,
Cast(CONVERT(VARCHAR(8),vm_dm_StudentDet.Dep,101) as date) dt
from vm_dm_StudentDet

if you test this on current date you use as follow.

select

CAST(CONVERT(varchar(8),GETDATE(),112) AS int) DepDate,
Cast(CONVERT(VARCHAR(8),GETDATE(),108) AS time) DepTime,
Cast(CONVERT(VARCHAR(8),GETDATE(),101) as date) dt

{ Comments on this entry are closed }

How to convert date to interger In TSQL

by Ali Raza Zaidi on February 27, 2012

During my assignment I have to generate Integer value from datetime filed for Date Dimension . I found excellent  id this way.

 

 

CAST(CONVERT(varchar(8),StartDATE,112) AS int) DateDateKey,

 

The whole Query is  as follow.

 

SELECT
CAST(CONVERT(varchar(8),BEGDATE,112) AS int) DateDateKey,
,Name
,Address
,Joindate
,EndDate
FROM dbo.from Student
 

:) its works for me.

{ Comments on this entry are closed }

How to get site visitor Api in asp.net

by Ali Raza Zaidi on February 25, 2012

How to get IP Host Address of remote Client

// To get IP of the client meachine
// There is two methods to obtain IP address

// Method 1
//     Gets the IP host address of the remote client.
// Returns:
//     The IP address of the remote client.
string ipMethod1 = Request.UserHostAddress; // HttpContext.Current.Request.UserHostAddress;

//Methord 2
//Request.ServerVariables is a Name Value Collection
//     Gets a collection of Web server variables.
// Returns:
//     A System.Collections.Specialized.NameValueCollection of server variables.
string ipMethod2 = Request.ServerVariables["REMOTE_ADDR"]; //HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
Response.Write(ipAdddress);

{ Comments on this entry are closed }

How to create dynamic connection string with variables SSIS

by Ali Raza Zaidi on February 22, 2012

Create Parameter on package level with string datatype with following Name, set default value with respect to your machine configuration I set according to mine

VServerName =”pc-aliraza”

VSQLUserName=”aliraza”

VSQLDbName =”Nwind”

VSQLPassword =”123”

If  integrated securtity with database is false or you connect with windows authentication following is the expression you have to set  expression at connection string property.

 

"Data Source=" + @[User::VServerName]  + ";Initial Catalog=" + @[User:: VSQLDbName]   + ";Provider=SQLNCLI10.1;Integrated Security=SSPI;"

 

If you want to connect with database with  Sql server authentication you have to use following expression string at  expression of connection string at connection in SSIS.

"Data Source="+ @[User::VServerName] +";User ID="+ @[User::VSQLUserName]  +"Password= "+ @[User::VSQLPassword] +" ;Initial Catalog=" + @[User::VSQLDbName] + ";Provider=SQLNCLI10.1;Persist Security Info=True;"

{ Comments on this entry are closed }

The command I forget, so i log it here

 

Using the command line

  1. Open Command Prompt.
  2. Type:

    mstsc /console.

  3. Remote Desktop Connection will start. Type the computer name or IP address of the computer you want to connect to in the Computer box.
  4. Configure any other desired options, and then click Connect.

{ Comments on this entry are closed }

You know the word “@@IDENTITY” it really has magic, It returns me the latest inserted rows identity in my access database using oldebcommand. For this purpose i have to execute command object two times first for insert query and second time by execute secular for getting value back

 

public void InsertReviews(string _Nick, string _Name, string _EmailAddress, string _RealStateTitle, string _Address, string _City, string _ZipCode, string _Country, string _Comments, string _FromIP, string _Status, string _Langi, string _Lit)
{
string ConnString = Util.GetConnString();
string SqlString = "Insert Into ClientInfo (Nick,Name,EmailAddress,RealStateTitle,Address,City,ZipCode,Country,Comments,FromIP,Status,Langi,Lit) Values (?,?,?,?,?,?,?,?,?,?,?,?,?)";
  string SqlString2 = "Select @@Identity";
using (OleDbConnection conn = new OleDbConnection(ConnString))
{
using (OleDbCommand cmd = new OleDbCommand(SqlString, conn))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("Nick", _Nick);
cmd.Parameters.AddWithValue("Name", _Name);
cmd.Parameters.AddWithValue("EmailAddress", _EmailAddress);
cmd.Parameters.AddWithValue("RealStateTitle", _RealStateTitle);
cmd.Parameters.AddWithValue("Address", _Address);
cmd.Parameters.AddWithValue("City", _City);
cmd.Parameters.AddWithValue("ZipCode", _ZipCode);
cmd.Parameters.AddWithValue("Country", _Country);
cmd.Parameters.AddWithValue("Comments", _Comments);
cmd.Parameters.AddWithValue("FromIP", _FromIP);
cmd.Parameters.AddWithValue("Status", _Status);
cmd.Parameters.AddWithValue("Langi", _Langi);
cmd.Parameters.AddWithValue("Lit", _Lit);
conn.Open();
cmd.ExecuteNonQuery();
cmd.CommandText = SqlString2;
  int _Count = (int) cmd.ExecuteScalar();
}
}

}

Its working for me

{ Comments on this entry are closed }