Posts

Table Variable in MS SQL Server

1. Syntax: DECLARE @T TABLE (...) 2. A Table variable is also created on disk in the tempDB system database. But the name of this table variable is generated completely by the SQL engine and it also differs from other similar named tables created in the same or other sessions.                -  check with the below query          select*from tempdb. INFORMATION_SCHEMA.tables 3. A Table Variable is created in memory, this is a myth. They are also treated as Temp-Tables and created in tempdb but they perform slightly better than temp-tables because there is even less locking and logging in a table variable. 4. Table variables are the only way you can use DML statements (INSERT, UPDATE, DELETE) on temporary data within a UDF (User Defined Function). You can create a Table Variable within a UDF, and modify the data using one of the DML Statements, this is not possible with temp-tables.  5. A Table variable ...

Error on renaming database in SQL Server 2008 R2

Error on renaming database in SQL Server 2008 R2 use master ALTER DATABASE OldDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE     ALTER DATABASE  OldDatabaseName  MODIFY NAME = [New_DatabaseName] ALTER DATABASE  New_DatabaseName  SET MULTI_USER Notes:  you should use  WITH ROLLBACK IMMEDIATE  while altering a database that other users might be operating on, in order to ensure the integrity of these operations. But it is not really necessary when setting the database back to MULTI_USER mode again since the database is already at SINGLE_USER mode and you are the only user able to run any transactions anyway.

Convert Viewmodel to JSON string using C#, convert json string to JSON Format using C#

//CONVERT POST PARAMETERS INTO JSON-SERIALIZE var json = JsonConvert.SerializeObject(model); // Convert Json String to JSON Format in C# dynamic responseData = Newtonsoft.Json.Linq.JObject.Parse(_responseData);

Accessed JArray values with invalid key value. Array position index expected

Accessed JArray values with invalid key value: “fields”. Array position index expected  ========================================================== { "response" :{ "status" : "ok" , "userTier" : "approved" , "total" : 1 , "startIndex" : 1 , "pageSize" : 10 , "currentPage" : 1 , "pages" : 1 , "orderBy" : "newest" , "results" :[{ "id" : "sustainable-business/sustainable-finance-where-next-open-thread" , "sectionId" : "sustainable-business" , "sectionName" : "Guardian Sustainable Business" , "webPublicationDate" : "2014-02-13T13:27:00Z" , "webTitle" : "Where next for sustainable finance? - open thread" , "webUrl" : "http://www.theguardian.com/sustainable-busi...

The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine

Image

recovery pending in sql server

ALTER DATABASE [ DBName ] SET EMERGENCY ; GO ALTER DATABASE [ DBName ] set single_user GO DBCC CHECKDB ([ DBName ], REPAIR_ALLOW_DATA_LOSS ) WITH ALL_ERRORMSGS ; GO ALTER DATABASE [ DBName ] set multi_user GO For more info:  https://www.stellarinfo.com/blog/fix-sql-database-recovery-pending-state-issue/

convert string to MD5 hash C#

public static string MD5Hash ( string input ) { StringBuilder hash = new StringBuilder (); MD5CryptoServiceProvider md5provider = new MD5CryptoServiceProvider (); byte [] bytes = md5provider . ComputeHash ( new UTF8Encoding (). GetBytes ( input )); for ( int i = 0 ; i < bytes . Length ; i ++) { hash . Append ( bytes [ i ]. ToString ( "x2" )); } return hash . ToString (); }