Update two tables from different database

Yesterday i had some tables to move from database1 to database2. I just moved the tables using SQL Export command. After that i had modify some columns in the table in the database1 and now i want to get the old value for a particular column in the table.

So was thinking what to do, then i found i have a primary key column in the table, I used a single update query and updated the data using database name with “..”.

Here is the query

update database1..table1 set column1= (select column1 from database2..table1 where primarykeycolumn=
database1..table1.primarykeycolumn) from database1..table1

This query worked in sql server, Not sure on the other database’s


Configuring ASP.NET website to use SQL Server 2005 for Session state

Today i was working on an application. The session breaks in between and when i was trying to find a problem and i found that ” if anti virus scan’s the website then the session will break it seems”. so thought of storing the session in sql server
and Here is the steps to follow

Step 1

Here is the code to add in web.config

< sessionState mode="SQLServer" sqlConnectionString="data source=#;UID=######;PWD=*******;" cookieless="false" timeout="20"/>

(no need to give DBname)

Step 2

Now we need to run the Install script (InstallPersistSqlState.sql) “Download here” on sql server. Download the Uninstall script here “Download here”

Step 3

After run the script. i got this error “Unable to use SQL Server because ASP.NET version 2.0 Session State is not installed on the SQL server. Please install ASP.NET Session State SQL Server version 2.0 or above.” when i run the website.

Later i found that we need to update the framework for the database . here is the command to run it

Go to command prompt and execute this

C:WINDOWSMicrosoft.NETFrameworkv2.0.50727>aspnet_regsql.exe -S -U ###### -P ******* -d ASPstate -ssadd -sstype c

Change the ##### to userid and ******* to password

after this it solved my problem and now my sessionstate is capture in sql server :).