Thursday, May 31, 2018

OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error"

OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error

or

ole db provider "microsoft.ace.oledb.12.0" for linked server "(null)" returned message "the select statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.".

Here is the quick resolution for this fix, try run below commands in SQL Server

USE [master] 
GO

EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE
GO

This resolved my problem!

Tuesday, May 29, 2018

New partition created after Windows 10 update 1803

A new partition of size 450 MB was created after this Windows 10 1803 recent update.

Resolution:

This is a known issue in the 1803 Update
It is the recovery drive created during the windows 1803 update, we are not meant to see this partition. Since we are seeing and update was successful we can remove the drive letter and everything will return to normal.

  1. Click your Start Button, type cmd, then right click Command Prompt and choose 'Run as Administrator'
  2. Run this command and hit Enter
  3. diskpart
  4. Run this command and hit Enter
  5. list volume
  6. Note down the letter associated with that new drive
  7. Run these commands one at a time and hit Enter (replace X with the correct drive letter)
  8. select volume X
  9. remove letter=X
  10. Close Command Prompt and restart your PC

Monday, May 28, 2018

“md-select” - How to set a selected option of a dropdown list control using angular JS?

Try this following code to set selected value based on selected index.

<div layout="row" flex layout-align="start">
	<md-input-container flex>
		<label>{{'TicketType_Label'| translate}}</label>
		<md-select ng-model="feedbackObj.ticketType"  ng-required="true" md-no-asterisk="false" >
			<md-option ng-selected="i == 0 ? true:false"  ng-repeat="(i,type) in TicketTypes" >{{type}}</md-option>
		</md-select>					
	</md-input-container>
</div>

Wednesday, May 16, 2018

Difference between #temptable and ##TempTable and table variable?

Local Temporary tables

Local temp tables are only available to the current connection for the user; and they are automatically deleted when the user disconnects from instances. Local temporary table name is stared with hash ("#") sign. scope of Local Temporary table is only bounded with the current connection of current user.

CREATE TABLE #TempTable(
 ID int,
 Name varchar(50))

Global Temporary tables

Global Temporary tables name starts with a double hash ("##"). Once this table has been created by a connection, like a permanent table it is then available to any user by any connection. It can only be deleted once all connections have been closed. Global temporary tables are visible to all SQL Server connections. When you create one of these, all the users can see it.

CREATE TABLE ##GlobalTempTable(
 ID int,
 Name varchar(50))

Table variables in T-SQL

Microsoft introduced table variables with SQL Server 2000 as an alternative to using temporary tables. In many cases a table variable can outperform a solution using a temporary table
Table variables store a set of records, so naturally the declaration syntax looks very similar to a CREATE TABLE statement, as you can see in the following example:

DECLARE @UserTable TABLE
( ID int,
  Name varchar(50))

Unlike the majority of the other data types in SQL Server, you cannot use a table variable as an input or an output parameter. In fact, a table variable is scoped to the stored procedure, batch, or user-defined function just like any local variable you create with a DECLARE statement. The variable will no longer exist after the procedure exits - there will be no table to clean up with a DROP statement.

Because of the well-defined scope, a table variable will generally use fewer resources than a temporary table. Transactions touching table variables only last for the duration of the update on the table variable, so there is less locking and logging overhead.
Using a temporary table inside of a stored procedure may result in additional re-compilations of the stored procedure. Table variables can often avoid this recompilation hit.

Configure the remote query timeout Server Configuration Option

Use below query to increase default time out or disable time out time.

USE ps;  
GO  
EXEC sp_configure 'remote query timeout', 0 ;  
GO  
RECONFIGURE ;  
GO 

The remote query timeout option specifies how long, in seconds, a remote operation can take before SQL Server times out. The default value for this option is 600, which allows a 10-minute wait. This value applies to an outgoing connection initiated by the Database Engine as a remote query. This value has no effect on queries received by the Database Engine. To disable the time-out, set the value to 0. A query will wait until it completes.

For more information, see Server Configuration Options (SQL Server).