Manish Pansiniya's Blog

.NET, C#, Javascript, ASP.NET and lots more…:)

Archive for the ‘SQL Server’ Category

Create Temporary Table in SQL Server

leave a comment »

if you Wanted to create temporary tables without create and all stuff.


Select * into #TEMPTABLENAME from TABLE


Written by Manish

September 7, 2013 at 4:47 pm

Posted in SQL Server

Microsoft.Practices.ServiceLocation.ActivationException–EnterpriseLibrary The type Database cannot be constructed

with 15 comments

While moving code first time to live server, we started to get following error. I found that the issue in my case is, I do not put providerName="System.Data.SqlClient"  in following connection string.

    <add name="XYZ" connectionString="Data Source=localhost;Initial Catalog=LondonDreams;Persist Security Info=True;User ID=dream;Password=dream" providerName="System.Data.SqlClient"/>

Once I put that in above part, it worked fine for below error.

Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type Database, key "XYZ"
—> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of
—> the dependency failed, type =
"Microsoft.Practices.EnterpriseLibrary.Data.Database", name = "XYZ".
Exception occurred while: while resolving.
Exception is: InvalidOperationException – The type Database cannot be constructed. You must configure the container to supply this value.
At the time of the exception, the container was:
—> System.InvalidOperationException: The type Database cannot be constructed. You must configure the container to supply this value.


Written by Manish

November 12, 2010 at 10:49 am

Countries/States/City list for development

with 2 comments

I have just needed the countries/states/city list for the development purpose. After searching a bit, I found 2 good sites for the same.

Another is for many used lists

Written by Manish

September 19, 2010 at 12:46 pm

SQL Server 2005 installation problem – Error 1053 (Error in setup) – Multicore CPU issue

with one comment



For resolution to this specific error.

You need to install first SQL Server 2005 on blank machine. Install SP3.

Now, goto Binn directory of installation, take both the file mentioned in KB and keep it.

Now, start installation on the machine and when error occurs, dont quit. On dialog of retry, just overwrite both the file on Binn directory and then retry. It works for me.

If you dont have two PC, i think you should install blank SQL Server SP3 and copy the files.

Written by Manish

September 4, 2010 at 11:49 pm

float to string sql cast or convert

leave a comment »

If you directly use convert it gives you solution in terms of +e. But if we convert it to bigint first then it provide the correct conversion to string.

CONVERT(nvarchar,  CAST(floattoconvert as bigint))

You can use str function but you need to be careful as it appends 0 or space while converting the same. So it would be bit tricky to use str function.

Written by Manish

August 10, 2010 at 7:29 pm

Service Dependency deleted in Sql Server when enabling Full Text Search

leave a comment »

To resolve this error:

1. Open the registry key HKEY_LOCAL_MACHINE\System\CurrentControlSet
2. Rename the value DependOnService to anything
3. Restart the server

Written by Manish

June 24, 2010 at 1:16 pm

Custom Format Specify in DateTime Format String C#

with one comment

Whenever we specify / in the DateTime format, it shows and convert the DateTime Separator that is setup in your regional settings.

so DateTime.Now.Date.ToString(@"d/MM/yyyy") will display “3-06-2010” on my pc as my regional setting has “–” as datetime separator.

If you require / in the date (or if you need any char as it is without converting it to Format specified in DateTime) then you need to add escape char before the char you require.

And that is the reason, DateTime.Now.Date.ToString(@"d\/MM\/yyyy") will give you “3/06/2010”

🙂 Happy ProgRaMMing

Written by Manish

June 3, 2010 at 4:31 pm